From 3b9d62646030e582cf4d84158cce0a81856f3728 Mon Sep 17 00:00:00 2001 From: lcnr Date: Thu, 8 Dec 2022 10:58:59 +0100 Subject: [PATCH] retry with Reveal::All in mir_assign_valid_types --- .../rustc_const_eval/src/transform/validate.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs index bf700d3122465..c66989000ce21 100644 --- a/compiler/rustc_const_eval/src/transform/validate.rs +++ b/compiler/rustc_const_eval/src/transform/validate.rs @@ -144,7 +144,20 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { return true; } - crate::util::is_subtype(self.tcx, self.param_env, src, dest) + if crate::util::is_subtype(self.tcx, self.param_env, src, dest) { + return true; + } + + // FIXME(@lcnr): This is needed to fix #105009 but it isn't yet clear to me why this is + // needed. The check for opaque types above should deal with all cases where we're in the + // defining scope of an opaque type and outside of the defining scope we shouldn't be able + // to rely on the hidden type. + crate::util::is_subtype( + self.tcx, + self.param_env.with_reveal_all_normalized(self.tcx), + src, + dest, + ) } }