Skip to content

Commit b42ada2

Browse files
authored
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```
2 parents 80599b9 + c856c74 commit b42ada2

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,9 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> {
302302
match ty.kind() {
303303
ty::Adt(adt_def, _) => Some(*adt_def),
304304
// FIXME(#104767): Should we handle bound regions here?
305-
ty::Alias(ty::Projection | ty::Inherent, _) if !ty.has_escaping_bound_vars() => {
305+
ty::Alias(ty::Projection | ty::Inherent | ty::Weak, _)
306+
if !ty.has_escaping_bound_vars() =>
307+
{
306308
self.normalize(span, ty).ty_adt_def()
307309
}
308310
_ => None,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Regression test for issue #113736.
2+
// check-pass
3+
4+
#![feature(lazy_type_alias)]
5+
6+
enum Enum {
7+
Unit,
8+
Tuple(),
9+
Struct {},
10+
}
11+
12+
fn main() {
13+
type Alias = Enum;
14+
let _ = Alias::Unit;
15+
let _ = Alias::Tuple();
16+
let _ = Alias::Struct {};
17+
}

0 commit comments

Comments
 (0)