2023-07-26 18:54:55 -05:00
|
|
|
//@ check-pass
|
|
|
|
// issue: 114035
|
|
|
|
//@ revisions: current next
|
2024-03-10 20:18:41 -05:00
|
|
|
//@ ignore-compare-mode-next-solver (explicit revisions)
|
2023-12-14 06:11:28 -06:00
|
|
|
//@[next] compile-flags: -Znext-solver
|
2023-07-26 18:54:55 -05:00
|
|
|
|
2024-01-22 06:23:50 -06:00
|
|
|
#![feature(trait_upcasting)]
|
|
|
|
|
2023-07-26 18:54:55 -05:00
|
|
|
trait A: B {
|
|
|
|
type Assoc;
|
|
|
|
}
|
|
|
|
|
|
|
|
trait B {}
|
|
|
|
|
|
|
|
fn upcast(a: &dyn A<Assoc = i32>) -> &dyn B {
|
|
|
|
a
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make sure that we can drop the existential projection `A::Assoc = i32`
|
|
|
|
// when upcasting `dyn A<Assoc = i32>` to `dyn B`. Before, we used some
|
|
|
|
// complicated algorithm which required rebuilding a new object type with
|
|
|
|
// different bounds in order to test that an upcast was valid, but this
|
|
|
|
// didn't allow upcasting to t that have fewer associated types
|
|
|
|
// than the source type.
|
|
|
|
|
|
|
|
fn main() {}
|