]>
git.proxmox.com Git - rustc.git/blob - tests/ui/object-lifetime/object-lifetime-default-ambiguous.rs
1 // Test that if a struct declares multiple region bounds for a given
2 // type parameter, an explicit lifetime bound is required on object
11 struct Ref0
<T
:?Sized
> {
15 struct Ref1
<'a
,T
:'a
+?Sized
> {
19 struct Ref2
<'a
,'b
:'a
,T
:'a
+'b
+?Sized
> {
23 fn a
<'a
,'b
>(t
: Ref2
<'a
,'b
, dyn Test
>) {
24 //~^ ERROR lifetime bound for this object type cannot be deduced from context
27 fn b(t
: Ref2
<dyn Test
>) {
28 //~^ ERROR lifetime bound for this object type cannot be deduced from context
31 fn c(t
: Ref2
<&dyn Test
>) {
32 // In this case, the &'a overrides.
35 fn d(t
: Ref2
<Ref1
<dyn Test
>>) {
36 // In this case, the lifetime parameter from the Ref1 overrides.
39 fn e(t
: Ref2
<Ref0
<dyn Test
>>) {
40 // In this case, Ref2 is ambiguous, but Ref0 overrides with 'static.
43 fn f(t
: &Ref2
<dyn Test
>) {
44 //~^ ERROR lifetime bound for this object type cannot be deduced from context