Rollup merge of #113755 - fmease:probe-adt-norm-lazy-ty-alias, r=oli-obk
Normalize lazy type aliases when probing for ADTs Fixes #113736. r? ```@oli-obk```
This commit is contained in:
commit
b42ada2b12
2 changed files with 20 additions and 1 deletions
|
@ -302,7 +302,9 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> {
|
||||||
match ty.kind() {
|
match ty.kind() {
|
||||||
ty::Adt(adt_def, _) => Some(*adt_def),
|
ty::Adt(adt_def, _) => Some(*adt_def),
|
||||||
// FIXME(#104767): Should we handle bound regions here?
|
// FIXME(#104767): Should we handle bound regions here?
|
||||||
ty::Alias(ty::Projection | ty::Inherent, _) if !ty.has_escaping_bound_vars() => {
|
ty::Alias(ty::Projection | ty::Inherent | ty::Weak, _)
|
||||||
|
if !ty.has_escaping_bound_vars() =>
|
||||||
|
{
|
||||||
self.normalize(span, ty).ty_adt_def()
|
self.normalize(span, ty).ty_adt_def()
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
|
|
17
tests/ui/type-alias/lazy-type-alias-enum-variant.rs
Normal file
17
tests/ui/type-alias/lazy-type-alias-enum-variant.rs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// Regression test for issue #113736.
|
||||||
|
// check-pass
|
||||||
|
|
||||||
|
#![feature(lazy_type_alias)]
|
||||||
|
|
||||||
|
enum Enum {
|
||||||
|
Unit,
|
||||||
|
Tuple(),
|
||||||
|
Struct {},
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
type Alias = Enum;
|
||||||
|
let _ = Alias::Unit;
|
||||||
|
let _ = Alias::Tuple();
|
||||||
|
let _ = Alias::Struct {};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue