-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-coercionsArea: implicit and explicit `expr as Type` coercionsArea: implicit and explicit `expr as Type` coercionsA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-raw-pointersArea: raw pointers, MaybeUninit, NonNullArea: raw pointers, MaybeUninit, NonNullA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
STR
fn foo<'a>(v: *const &'a ()) {
let v: *const &'static () = v as *const &'static ();
}
fn main() {}
Expected result
cast will be successful
Actual Result
<anon>:2:33: 2:34 error: mismatched types:
expected `*const &'static ()`,
found `*const &'a ()`
(lifetime mismatch) [E0308]
<anon>:2 let v: *const &'static () = v as *const &'static ();
^
<anon>:2:33: 2:34 help: see the detailed explanation for E0308
<anon>:1:30: 3:2 note: the lifetime 'a as defined on the block at 1:29...
<anon>:1 fn foo<'a>(v: *const &'a ()) {
<anon>:2 let v: *const &'static () = v as *const &'static ();
<anon>:3 }
note: ...does not necessarily outlive the static lifetime
error: aborting due to previous error
playpen: application terminated with error code 101
Rufflewind
Metadata
Metadata
Assignees
Labels
A-coercionsArea: implicit and explicit `expr as Type` coercionsArea: implicit and explicit `expr as Type` coercionsA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-raw-pointersArea: raw pointers, MaybeUninit, NonNullArea: raw pointers, MaybeUninit, NonNullA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.