Skip to content

Fix evaluating trivial drop glue in constants#57734

Merged
bors merged 3 commits intorust-lang:masterfrom
oli-obk:fixes_and_cleanups
Jan 26, 2019
Merged

Fix evaluating trivial drop glue in constants#57734
bors merged 3 commits intorust-lang:masterfrom
oli-obk:fixes_and_cleanups

Conversation

@oli-obk
Copy link
Copy Markdown
Contributor

@oli-obk oli-obk commented Jan 18, 2019

struct A;
impl Drop for A {
    fn drop(&mut self) {}
}

const FOO: Option<A> = None;

const BAR: () = (FOO, ()).1;

was erroring with

error: any use of this value will cause an error
 --> src/lib.rs:9:1
  |
9 | const BAR: () = (FOO, ()).1;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^-^
  |                           |
  |                           calling non-const function `std::ptr::real_drop_in_place::<(std::option::Option<A>, ())> - shim(Some((std::option::Option<A>, ())))`
  |
  = note: #[deny(const_err)] on by default

error: aborting due to previous error

before this PR. According to godbolt this last compiled successfully in 1.27

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants