Continue folding in query normalizer on weak aliases
This commit is contained in:
parent
939786223f
commit
493b18b653
@ -322,8 +322,12 @@ impl<'cx, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'cx, 'tcx>
|
|||||||
};
|
};
|
||||||
// `tcx.normalize_projection_ty` may normalize to a type that still has
|
// `tcx.normalize_projection_ty` may normalize to a type that still has
|
||||||
// unevaluated consts, so keep normalizing here if that's the case.
|
// unevaluated consts, so keep normalizing here if that's the case.
|
||||||
if res != ty && res.has_type_flags(ty::TypeFlags::HAS_CT_PROJECTION) {
|
// Similarly, `tcx.normalize_weak_ty` will only unwrap one layer of type
|
||||||
res.try_super_fold_with(self)?
|
// and we need to continue folding it to reveal the TAIT behind it.
|
||||||
|
if res != ty
|
||||||
|
&& (res.has_type_flags(ty::TypeFlags::HAS_CT_PROJECTION) || kind == ty::Weak)
|
||||||
|
{
|
||||||
|
res.try_fold_with(self)?
|
||||||
} else {
|
} else {
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
12
tests/ui/type-alias-impl-trait/debug-ty-with-weak.rs
Normal file
12
tests/ui/type-alias-impl-trait/debug-ty-with-weak.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// compile-flags: --crate-type=lib -Cdebuginfo=2
|
||||||
|
// build-pass
|
||||||
|
|
||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
type Debuggable = impl core::fmt::Debug;
|
||||||
|
|
||||||
|
static mut TEST: Option<Debuggable> = None;
|
||||||
|
|
||||||
|
fn foo() -> Debuggable {
|
||||||
|
0u32
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user