Skip to content

Commit

Permalink
Add a test for upcasting into a lifetimed supertrait
Browse files Browse the repository at this point in the history
  • Loading branch information
WaffleLapkin committed Jan 8, 2025
1 parent 92b4a48 commit 5689335
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test/unsize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,14 @@ fn dyn_upcasting() {
#[object_safe]
trait GenericSuper<T> {}
#[object_safe]
trait LifetimedSuper<'a> {}
#[object_safe]
trait Super
where
Self: SuperSuper,
Self: GenericSuper<i32>,
Self: GenericSuper<i64>,
forall<'a> Self: LifetimedSuper<'a>,
{}
#[object_safe]
trait Principal where Self: Super {}
Expand Down Expand Up @@ -270,6 +273,18 @@ fn dyn_upcasting() {
} yields {
expect![[r#"Ambiguous; no inference guidance"#]]
}

goal {
forall<'a> {
forall<'b> {
forall<'c> {
dyn Principal + 'a: Unsize<dyn LifetimedSuper<'b> + 'c>
}
}
}
} yields {
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 }]"]
}
}
}

Expand Down

0 comments on commit 5689335

Please sign in to comment.