You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
From my perspective, it seem that the real bug is that we allow lifetimes as part of the addr-of expression. According to the parser, we don't actually use the lifetime.
Code:
Compiler incorrectly reports that values does not live long enough:
The text was updated successfully, but these errors were encountered: