diff options
Diffstat (limited to 'tests/ui/sized-hierarchy/incomplete-inference-issue-143992.rs')
| -rw-r--r-- | tests/ui/sized-hierarchy/incomplete-inference-issue-143992.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/ui/sized-hierarchy/incomplete-inference-issue-143992.rs b/tests/ui/sized-hierarchy/incomplete-inference-issue-143992.rs new file mode 100644 index 00000000000..3e3e1dc50e5 --- /dev/null +++ b/tests/ui/sized-hierarchy/incomplete-inference-issue-143992.rs @@ -0,0 +1,29 @@ +//@ compile-flags: --crate-type=lib +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[current] check-pass +//@[next] compile-flags: -Znext-solver +//@[next] check-fail + +// 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(()); +//[next]~^ ERROR mismatched types +} |
