Do not reveal opaques in the param-env, we got lazy norm instead

This commit is contained in:
Michael Goulet 2024-11-09 03:54:08 +00:00
parent 328b759142
commit 13ab08d7dc
2 changed files with 7 additions and 5 deletions

View File

@ -1076,11 +1076,6 @@ pub fn new(caller_bounds: Clauses<'tcx>, reveal: Reveal) -> Self {
ty::ParamEnv { packed: CopyTaggedPtr::new(caller_bounds, ParamTag { reveal }) } ty::ParamEnv { packed: CopyTaggedPtr::new(caller_bounds, ParamTag { reveal }) }
} }
pub fn with_user_facing(mut self) -> Self {
self.packed.set_tag(ParamTag { reveal: Reveal::UserFacing, ..self.packed.tag() });
self
}
/// Returns a new parameter environment with the same clauses, but /// Returns a new parameter environment with the same clauses, but
/// which "reveals" the true results of projections in all cases /// which "reveals" the true results of projections in all cases
/// (even for associated types that are specializable). This is /// (even for associated types that are specializable). This is
@ -1095,6 +1090,12 @@ pub fn with_reveal_all_normalized(self, tcx: TyCtxt<'tcx>) -> Self {
return self; return self;
} }
// No need to reveal opaques with the new solver enabled,
// since we have lazy norm.
if tcx.next_trait_solver_globally() {
return ParamEnv::new(self.caller_bounds(), Reveal::All);
}
ParamEnv::new(tcx.reveal_opaque_types_in_bounds(self.caller_bounds()), Reveal::All) ParamEnv::new(tcx.reveal_opaque_types_in_bounds(self.caller_bounds()), Reveal::All)
} }

View File

@ -1751,6 +1751,7 @@ pub fn reveal_opaque_types_in_bounds<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
val: ty::Clauses<'tcx>, val: ty::Clauses<'tcx>,
) -> ty::Clauses<'tcx> { ) -> ty::Clauses<'tcx> {
assert!(!tcx.next_trait_solver_globally());
let mut visitor = OpaqueTypeExpander { let mut visitor = OpaqueTypeExpander {
seen_opaque_tys: FxHashSet::default(), seen_opaque_tys: FxHashSet::default(),
expanded_cache: FxHashMap::default(), expanded_cache: FxHashMap::default(),