Skip to content

Commit 5689335

Browse files
committed
Add a test for upcasting into a lifetimed supertrait
1 parent 92b4a48 commit 5689335

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/test/unsize.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,14 @@ fn dyn_upcasting() {
191191
#[object_safe]
192192
trait GenericSuper<T> {}
193193
#[object_safe]
194+
trait LifetimedSuper<'a> {}
195+
#[object_safe]
194196
trait Super
195197
where
196198
Self: SuperSuper,
197199
Self: GenericSuper<i32>,
198200
Self: GenericSuper<i64>,
201+
forall<'a> Self: LifetimedSuper<'a>,
199202
{}
200203
#[object_safe]
201204
trait Principal where Self: Super {}
@@ -270,6 +273,18 @@ fn dyn_upcasting() {
270273
} yields {
271274
expect![[r#"Ambiguous; no inference guidance"#]]
272275
}
276+
277+
goal {
278+
forall<'a> {
279+
forall<'b> {
280+
forall<'c> {
281+
dyn Principal + 'a: Unsize<dyn LifetimedSuper<'b> + 'c>
282+
}
283+
}
284+
}
285+
} yields {
286+
expect!["Unique; lifetime constraints [InEnvironment { environment: Env([]), goal: '!1_0: '!3_0 }, InEnvironment { environment: Env([]), goal: '!2_0: '!5_0 }, InEnvironment { environment: Env([]), goal: '!5_0: '!2_0 }]"]
287+
}
273288
}
274289
}
275290

0 commit comments

Comments
 (0)