Rollup merge of #94057 - lcnr:simplify_type-uwu, r=nikomatsakis
improve comments for `simplify_type` Should now correctly describe what's going on. Experimented with checking the invariant for projections but that ended up requiring fairly involved changes. I assume that it is not possible to get unsoundness here, at least for now and I can pretty much guarantee that it's impossible to trigger it by accident. r? `````@nikomatsakis````` cc #92721
This commit is contained in:
commit
fec7a79088
7 changed files with 66 additions and 60 deletions
|
@ -36,7 +36,7 @@ use rustc_infer::infer::LateBoundRegionConversionTime;
|
|||
use rustc_middle::dep_graph::{DepKind, DepNodeIndex};
|
||||
use rustc_middle::mir::interpret::ErrorHandled;
|
||||
use rustc_middle::thir::abstract_const::NotConstEvaluatable;
|
||||
use rustc_middle::ty::fast_reject::{self, SimplifyParams};
|
||||
use rustc_middle::ty::fast_reject::{self, TreatParams};
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use rustc_middle::ty::relate::TypeRelation;
|
||||
use rustc_middle::ty::subst::{GenericArgKind, Subst, SubstsRef};
|
||||
|
@ -2176,8 +2176,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
fn fast_reject_trait_refs(
|
||||
&mut self,
|
||||
obligation: &TraitObligation<'_>,
|
||||
impl_trait_ref: &ty::TraitRef<'_>,
|
||||
obligation: &TraitObligation<'tcx>,
|
||||
impl_trait_ref: &ty::TraitRef<'tcx>,
|
||||
) -> bool {
|
||||
// We can avoid creating type variables and doing the full
|
||||
// substitution if we find that any of the input types, when
|
||||
|
@ -2193,10 +2193,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
let simplified_obligation_ty = fast_reject::simplify_type(
|
||||
self.tcx(),
|
||||
obligation_ty,
|
||||
SimplifyParams::Yes,
|
||||
TreatParams::AsBoundTypes,
|
||||
);
|
||||
let simplified_impl_ty = fast_reject::simplify_type(
|
||||
self.tcx(),
|
||||
impl_ty,
|
||||
TreatParams::AsPlaceholders,
|
||||
);
|
||||
let simplified_impl_ty =
|
||||
fast_reject::simplify_type(self.tcx(), impl_ty, SimplifyParams::No);
|
||||
|
||||
simplified_obligation_ty.is_some()
|
||||
&& simplified_impl_ty.is_some()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue