]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/impl-trait/multiple-lifetimes/error-handling.rs
8d02d635094be46c270d8eae84c6cc303fc9f005
1 // compile-flags:-Zborrowck=mir
3 #![feature(member_constraints)]
4 #![feature(type_alias_impl_trait)]
7 struct CopyIfEq
<T
, U
>(T
, U
);
9 impl<T
: Copy
> Copy
for CopyIfEq
<T
, T
> {}
11 type E
<'a
, 'b
> = impl Sized
;
13 fn foo
<'a
, 'b
, 'c
>(x
: &'
static i32, mut y
: &'a
i32) -> E
<'b
, 'c
> {
14 let v
= CopyIfEq
::<*mut _
, *mut _
>(&mut { x }
, &mut y
);
16 // This assignment requires that `x` and `y` have the same type due to the
17 // `Copy` impl. The reason why we are using a copy to create a constraint
18 // is that only borrow checking (not regionck in type checking) enforces
21 let _
: *mut &'a
i32 = u
.1;
23 let _
: &'b
i32 = *u
.0;
24 //~^ ERROR lifetime may not live long enough