Explain a test
This commit is contained in:
parent
35071e3e2e
commit
033bd8c7af
@ -12,10 +12,17 @@ type E<'a, 'b> = impl Sized;
|
||||
|
||||
fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
|
||||
//~^ ERROR lifetime may not live long enough
|
||||
let v = CopyIfEq::<*mut _, *mut _>(&mut {x}, &mut y);
|
||||
let v = CopyIfEq::<*mut _, *mut _>(&mut { x }, &mut y);
|
||||
|
||||
// This assignment requires that `x` and `y` have the same type due to the
|
||||
// `Copy` impl. The reason why we are using a copy to create a constraint
|
||||
// is that only borrow checking (not regionck in type checking) enforces
|
||||
// this bound.
|
||||
let u = v;
|
||||
let _: *mut &'a i32 = u.1;
|
||||
unsafe { let _: &'b i32 = *u.0; }
|
||||
unsafe {
|
||||
let _: &'b i32 = *u.0;
|
||||
}
|
||||
u.0
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user