Work around type normalization issues

This commit is contained in:
Nadrieril 2020-05-23 18:59:27 +01:00
parent 3bf94b2c9d
commit 7addc115eb
2 changed files with 26 additions and 1 deletions

View file

@ -1870,7 +1870,9 @@ crate fn is_useful<'p, 'tcx>(
return if any_is_useful { Useful(unreachable_pats) } else { NotUseful };
}
let pcx = PatCtxt { ty: v.head().ty, span: v.head().span };
// FIXME(Nadrieril): Hack to work around type normalization issues (see #72476).
let ty = matrix.heads().next().map(|r| r.ty).unwrap_or(v.head().ty);
let pcx = PatCtxt { ty, span: v.head().span };
debug!("is_useful_expand_first_col: pcx={:#?}, expanding {:#?}", pcx, v.head());

View file

@ -0,0 +1,23 @@
// check-pass
// From https://github.com/rust-lang/rust/issues/72476
trait A {
type Projection;
}
impl A for () {
type Projection = bool;
// using () instead of bool here does compile though
}
struct Next<T: A>(T::Projection);
fn f(item: Next<()>) {
match item {
Next(true) => {}
Next(false) => {}
}
}
fn main() {}