diff options
Diffstat (limited to 'tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs')
-rw-r--r-- | tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs b/tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs new file mode 100644 index 000000000..19a6fa990 --- /dev/null +++ b/tests/ui/traits/new-solver/dont-normalize-proj-with-error.rs @@ -0,0 +1,22 @@ +// compile-flags: -Ztrait-solver=next + +// Test that we don't incorrectly leak unconstrained inference variables +// if the projection contained an error. This caused an ICE in writeback. + +trait Mirror { + type Assoc: ?Sized; +} + +struct Wrapper<T: ?Sized>(T); +impl<T: ?Sized> Mirror for Wrapper<T> { + type Assoc = T; +} + +fn mirror<W: Mirror>(_: W) -> Box<W::Assoc> { todo!() } + +fn type_error() -> TypeError { todo!() } +//~^ ERROR cannot find type `TypeError` in this scope + +fn main() { + let x = mirror(type_error()); +} |