should looking up the defined opaque types be structural or semantic #17
Open
Description
a purely structural lookup is difficult to support in MIR typeck because we replace all regions with new variables.
a semantic lookup requires some special care to correctly handle universes. It also breaks the following example
trait Trait<'a, 'b> {}
impl<'a, 'b, T> Trait<'a, 'b> for T {}
#[derive(Copy, Clone)]
struct Inv<'a>(*mut &'a ());
fn foo<'a, 'b>(x: Inv<'a>, y: Inv<'b>, b: bool) -> impl Trait<'a, 'b> {
if b {
let _: Inv<'b> = foo(y, x, false);
}
x
}
Activity