Closed
Description
Code:
trait Foo {}
struct Bar;
impl Foo for Bar {}
fn main() {
&'static Bar as &'static Foo;
}
Compiler incorrectly reports that values does not live long enough:
tmp2.rs:8:5: 8:17 error: borrowed value does not live long enough
tmp2.rs:8 &'static Bar as &'static Foo;
^~~~~~~~~~~~
note: reference must be valid for the static lifetime...
tmp2.rs:8:5: 8:33 note: ...but borrowed value is only valid for the statement at 8:4
tmp2.rs:8 &'static Bar as &'static Foo;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error