2025-07-17 09:21:51 +00:00
|
|
|
//@ check-pass
|
2025-07-16 10:56:32 +00:00
|
|
|
//@ compile-flags: --crate-type=lib
|
2025-07-17 09:10:37 +00:00
|
|
|
//@ revisions: current next
|
2025-07-16 10:56:32 +00:00
|
|
|
//@ ignore-compare-mode-next-solver (explicit revisions)
|
|
|
|
|
//@[next] compile-flags: -Znext-solver
|
|
|
|
|
|
|
|
|
|
// Test that we avoid incomplete inference when normalizing. Without this,
|
|
|
|
|
// `Trait`'s implicit `MetaSized` supertrait requires proving `T::Assoc<_>: MetaSized`
|
|
|
|
|
// before checking the `new` arguments, resulting in eagerly constraining the inference
|
|
|
|
|
// var to `u32`. This is undesirable and would breaking code.
|
|
|
|
|
|
|
|
|
|
pub trait Trait {
|
|
|
|
|
type Assoc<G>: OtherTrait<G>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub trait OtherTrait<R> {
|
|
|
|
|
fn new(r: R) -> R {
|
|
|
|
|
r
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn function<T: Trait>()
|
|
|
|
|
where
|
|
|
|
|
T::Assoc<[u32; 1]>: Clone,
|
|
|
|
|
{
|
|
|
|
|
let _x = T::Assoc::new(());
|
|
|
|
|
}
|