Closed
Description
#![feature(type_alias_impl_trait)]
type Tait<T> = impl Sized;
fn foo<T, U>(x: T) {
loop {
break;
let _: Tait<U> = String::new();
}
let _: Tait<T> = x;
}
this passes but should error. The issue is that when writing the opaque type into the TypeckResults
we drop the previous entry without comparing them for equality.
normally this would get caught by borrowck which does handle them correctly, however Tait<U>
is defined in unreachable code so mir borrowck does not catch this.
we do explicitly check that the opaques from unreachable code are equal to the reachable ones but this check uses the opaques from hir typeck which means we again ignore Tait<U>
there.