rename needs_infer
to has_infer
This commit is contained in:
parent
e3ccd4b9a5
commit
f04b8fe0af
@ -70,7 +70,7 @@ pub(crate) fn get_function_sig<'tcx>(
|
||||
default_call_conv: CallConv,
|
||||
inst: Instance<'tcx>,
|
||||
) -> Signature {
|
||||
assert!(!inst.substs.needs_infer());
|
||||
assert!(!inst.substs.has_infer());
|
||||
clif_sig_from_fn_abi(
|
||||
tcx,
|
||||
default_call_conv,
|
||||
|
@ -28,7 +28,7 @@ pub(crate) fn codegen_fn<'tcx>(
|
||||
module: &mut dyn Module,
|
||||
instance: Instance<'tcx>,
|
||||
) -> CodegenedFunction {
|
||||
debug_assert!(!instance.substs.needs_infer());
|
||||
debug_assert!(!instance.substs.has_infer());
|
||||
|
||||
let symbol_name = tcx.symbol_name(instance).name.to_string();
|
||||
let _timer = tcx.prof.generic_activity_with_arg("codegen fn", &*symbol_name);
|
||||
|
@ -17,7 +17,7 @@ use crate::context::CodegenCx;
|
||||
pub fn get_fn<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, instance: Instance<'tcx>) -> Function<'gcc> {
|
||||
let tcx = cx.tcx();
|
||||
|
||||
assert!(!instance.substs.needs_infer());
|
||||
assert!(!instance.substs.has_infer());
|
||||
assert!(!instance.substs.has_escaping_bound_vars());
|
||||
|
||||
let sym = tcx.symbol_name(instance).name;
|
||||
|
@ -31,7 +31,7 @@ impl<'gcc, 'tcx> PreDefineMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
|
||||
|
||||
#[cfg_attr(not(feature="master"), allow(unused_variables))]
|
||||
fn predefine_fn(&self, instance: Instance<'tcx>, linkage: Linkage, visibility: Visibility, symbol_name: &str) {
|
||||
assert!(!instance.substs.needs_infer());
|
||||
assert!(!instance.substs.has_infer());
|
||||
|
||||
let fn_abi = self.fn_abi_of_instance(instance, ty::List::empty());
|
||||
self.linkage.set(base::linkage_to_gcc(linkage));
|
||||
|
@ -27,7 +27,7 @@ pub fn get_fn<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'tcx>) ->
|
||||
|
||||
debug!("get_fn(instance={:?})", instance);
|
||||
|
||||
assert!(!instance.substs.needs_infer());
|
||||
assert!(!instance.substs.has_infer());
|
||||
assert!(!instance.substs.has_escaping_bound_vars());
|
||||
|
||||
if let Some(&llfn) = cx.instances.borrow().get(&instance) {
|
||||
|
@ -48,7 +48,7 @@ impl<'tcx> PreDefineMethods<'tcx> for CodegenCx<'_, 'tcx> {
|
||||
visibility: Visibility,
|
||||
symbol_name: &str,
|
||||
) {
|
||||
assert!(!instance.substs.needs_infer());
|
||||
assert!(!instance.substs.has_infer());
|
||||
|
||||
let fn_abi = self.fn_abi_of_instance(instance, ty::List::empty());
|
||||
let lldecl = self.declare_fn(symbol_name, fn_abi);
|
||||
|
@ -152,7 +152,7 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
cx: &'a Bx::CodegenCx,
|
||||
instance: Instance<'tcx>,
|
||||
) {
|
||||
assert!(!instance.substs.needs_infer());
|
||||
assert!(!instance.substs.has_infer());
|
||||
|
||||
let llfn = cx.get_fn(instance);
|
||||
|
||||
|
@ -2318,7 +2318,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
let infcx = match self.infcx() {
|
||||
Some(infcx) => infcx,
|
||||
None => {
|
||||
assert!(!self_ty.needs_infer());
|
||||
assert!(!self_ty.has_infer());
|
||||
infcx_ = tcx.infer_ctxt().ignoring_regions().build();
|
||||
&infcx_
|
||||
}
|
||||
@ -2489,7 +2489,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
let infcx = if let Some(infcx) = self.infcx() {
|
||||
infcx
|
||||
} else {
|
||||
assert!(!qself_ty.needs_infer());
|
||||
assert!(!qself_ty.has_infer());
|
||||
infcx_ = tcx.infer_ctxt().build();
|
||||
&infcx_
|
||||
};
|
||||
|
@ -1027,7 +1027,7 @@ fn check_type_defn<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item<'tcx>, all_sized: b
|
||||
packed && {
|
||||
let ty = tcx.type_of(variant.fields.raw.last().unwrap().did).subst_identity();
|
||||
let ty = tcx.erase_regions(ty);
|
||||
if ty.needs_infer() {
|
||||
if ty.has_infer() {
|
||||
tcx.sess
|
||||
.delay_span_bug(item.span, &format!("inference variables in {:?}", ty));
|
||||
// Just treat unresolved type expression as if it needs drop.
|
||||
|
@ -366,7 +366,7 @@ fn check_predicates<'tcx>(
|
||||
wf::obligations(infcx, tcx.param_env(impl1_def_id), impl1_def_id, 0, arg, span)
|
||||
.unwrap();
|
||||
|
||||
assert!(!obligations.needs_infer());
|
||||
assert!(!obligations.has_infer());
|
||||
impl2_predicates
|
||||
.extend(traits::elaborate(tcx, obligations).map(|obligation| obligation.predicate))
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
ocx.normalize(&ObligationCause::dummy(), self.param_env, fn_sig);
|
||||
if ocx.select_all_or_error().is_empty() {
|
||||
let normalized_fn_sig = self.resolve_vars_if_possible(normalized_fn_sig);
|
||||
if !normalized_fn_sig.needs_infer() {
|
||||
if !normalized_fn_sig.has_infer() {
|
||||
return normalized_fn_sig;
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ impl<'tcx> expr_use_visitor::Delegate<'tcx> for ExprUseDelegate<'tcx> {
|
||||
// If the type being assigned needs dropped, then the mutation counts as a borrow
|
||||
// since it is essentially doing `Drop::drop(&mut x); x = new_value;`.
|
||||
let ty = self.tcx.erase_regions(assignee_place.place.base_ty);
|
||||
if ty.needs_infer() {
|
||||
if ty.has_infer() {
|
||||
self.tcx.sess.delay_span_bug(
|
||||
self.tcx.hir().span(assignee_place.hir_id),
|
||||
&format!("inference variables in {ty}"),
|
||||
|
@ -460,7 +460,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> {
|
||||
// Avoid ICEs in needs_drop.
|
||||
let ty = self.fcx.resolve_vars_if_possible(ty);
|
||||
let ty = self.fcx.tcx.erase_regions(ty);
|
||||
if ty.needs_infer() {
|
||||
if ty.has_infer() {
|
||||
self.fcx
|
||||
.tcx
|
||||
.sess
|
||||
|
@ -2032,7 +2032,7 @@ impl<'tcx> Candidate<'tcx> {
|
||||
// means they are safe to put into the
|
||||
// `WhereClausePick`.
|
||||
assert!(
|
||||
!trait_ref.skip_binder().substs.needs_infer()
|
||||
!trait_ref.skip_binder().substs.has_infer()
|
||||
&& !trait_ref.skip_binder().substs.has_placeholders()
|
||||
);
|
||||
|
||||
|
@ -133,7 +133,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
||||
|
||||
fn write_ty_to_typeck_results(&mut self, hir_id: hir::HirId, ty: Ty<'tcx>) {
|
||||
debug!("write_ty_to_typeck_results({:?}, {:?})", hir_id, ty);
|
||||
assert!(!ty.needs_infer() && !ty.has_placeholders() && !ty.has_free_regions());
|
||||
assert!(!ty.has_infer() && !ty.has_placeholders() && !ty.has_free_regions());
|
||||
self.typeck_results.node_types_mut().insert(hir_id, ty);
|
||||
}
|
||||
|
||||
@ -508,7 +508,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
||||
fcx_typeck_results.user_provided_types().items().map(|(local_id, c_ty)| {
|
||||
let hir_id = hir::HirId { owner: common_hir_owner, local_id };
|
||||
|
||||
if cfg!(debug_assertions) && c_ty.needs_infer() {
|
||||
if cfg!(debug_assertions) && c_ty.has_infer() {
|
||||
span_bug!(
|
||||
hir_id.to_span(self.fcx.tcx),
|
||||
"writeback: `{:?}` has inference variables",
|
||||
@ -527,7 +527,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
||||
|
||||
self.typeck_results.user_provided_sigs.extend(
|
||||
fcx_typeck_results.user_provided_sigs.items().map(|(&def_id, c_sig)| {
|
||||
if cfg!(debug_assertions) && c_sig.needs_infer() {
|
||||
if cfg!(debug_assertions) && c_sig.has_infer() {
|
||||
span_bug!(
|
||||
self.fcx.tcx.def_span(def_id),
|
||||
"writeback: `{:?}` has inference variables",
|
||||
@ -618,7 +618,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
||||
if let Some(substs) = self.fcx.typeck_results.borrow().node_substs_opt(hir_id) {
|
||||
let substs = self.resolve(substs, &span);
|
||||
debug!("write_substs_to_tcx({:?}, {:?})", hir_id, substs);
|
||||
assert!(!substs.needs_infer() && !substs.has_placeholders());
|
||||
assert!(!substs.has_infer() && !substs.has_placeholders());
|
||||
self.typeck_results.node_substs_mut().insert(hir_id, substs);
|
||||
}
|
||||
}
|
||||
@ -693,7 +693,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
||||
{
|
||||
let hir_id = hir::HirId { owner: common_hir_owner, local_id };
|
||||
|
||||
if cfg!(debug_assertions) && container.needs_infer() {
|
||||
if cfg!(debug_assertions) && container.has_infer() {
|
||||
span_bug!(
|
||||
hir_id.to_span(self.fcx.tcx),
|
||||
"writeback: `{:?}` has inference variables",
|
||||
@ -711,7 +711,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
||||
{
|
||||
let mut resolver = Resolver::new(self.fcx, span, self.body);
|
||||
let x = x.fold_with(&mut resolver);
|
||||
if cfg!(debug_assertions) && x.needs_infer() {
|
||||
if cfg!(debug_assertions) && x.has_infer() {
|
||||
span_bug!(span.to_span(self.fcx.tcx), "writeback: `{:?}` has inference variables", x);
|
||||
}
|
||||
|
||||
|
@ -564,12 +564,12 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
|
||||
let _inside_canonical_ctxt_guard = infcx.set_canonicalization_ctxt();
|
||||
|
||||
let needs_canonical_flags = if canonicalize_region_mode.any() {
|
||||
TypeFlags::NEEDS_INFER |
|
||||
TypeFlags::HAS_INFER |
|
||||
TypeFlags::HAS_FREE_REGIONS | // `HAS_RE_PLACEHOLDER` implies `HAS_FREE_REGIONS`
|
||||
TypeFlags::HAS_TY_PLACEHOLDER |
|
||||
TypeFlags::HAS_CT_PLACEHOLDER
|
||||
} else {
|
||||
TypeFlags::NEEDS_INFER
|
||||
TypeFlags::HAS_INFER
|
||||
| TypeFlags::HAS_RE_PLACEHOLDER
|
||||
| TypeFlags::HAS_TY_PLACEHOLDER
|
||||
| TypeFlags::HAS_CT_PLACEHOLDER
|
||||
@ -600,7 +600,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
|
||||
// Once we have canonicalized `out_value`, it should not
|
||||
// contain anything that ties it to this inference context
|
||||
// anymore.
|
||||
debug_assert!(!out_value.needs_infer() && !out_value.has_placeholders());
|
||||
debug_assert!(!out_value.has_infer() && !out_value.has_placeholders());
|
||||
|
||||
let canonical_variables =
|
||||
tcx.mk_canonical_var_infos(&canonicalizer.universe_canonicalized_variables());
|
||||
|
@ -127,7 +127,7 @@ impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for TypeFreshener<'a, 'tcx> {
|
||||
|
||||
#[inline]
|
||||
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
|
||||
if !t.needs_infer() && !t.has_erasable_regions() {
|
||||
if !t.has_infer() && !t.has_erasable_regions() {
|
||||
t
|
||||
} else {
|
||||
match *t.kind() {
|
||||
|
@ -1327,7 +1327,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||
where
|
||||
T: TypeFoldable<TyCtxt<'tcx>>,
|
||||
{
|
||||
if !value.needs_infer() {
|
||||
if !value.has_infer() {
|
||||
return value; // Avoid duplicated subst-folding.
|
||||
}
|
||||
let mut r = InferenceLiteralEraser { tcx: self.tcx };
|
||||
@ -1365,7 +1365,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||
pub fn fully_resolve<T: TypeFoldable<TyCtxt<'tcx>>>(&self, value: T) -> FixupResult<'tcx, T> {
|
||||
let value = resolve::fully_resolve(self, value);
|
||||
assert!(
|
||||
value.as_ref().map_or(true, |value| !value.needs_infer()),
|
||||
value.as_ref().map_or(true, |value| !value.has_infer()),
|
||||
"`{value:?}` is not fully resolved"
|
||||
);
|
||||
value
|
||||
|
@ -347,7 +347,7 @@ where
|
||||
let is_opaque = alias_ty.kind(self.tcx) == ty::Opaque;
|
||||
if approx_env_bounds.is_empty()
|
||||
&& trait_bounds.is_empty()
|
||||
&& (alias_ty.needs_infer() || is_opaque)
|
||||
&& (alias_ty.has_infer() || is_opaque)
|
||||
{
|
||||
debug!("no declared bounds");
|
||||
let opt_variances = is_opaque.then(|| self.tcx.variances_of(alias_ty.def_id));
|
||||
|
@ -213,7 +213,7 @@ impl<'a, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for FullTypeResolver<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn try_fold_ty(&mut self, t: Ty<'tcx>) -> Result<Ty<'tcx>, Self::Error> {
|
||||
if !t.needs_infer() {
|
||||
if !t.has_infer() {
|
||||
Ok(t) // micro-optimize -- if there is nothing in this type that this fold affects...
|
||||
} else {
|
||||
let t = self.infcx.shallow_resolve(t);
|
||||
@ -243,7 +243,7 @@ impl<'a, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for FullTypeResolver<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn try_fold_const(&mut self, c: ty::Const<'tcx>) -> Result<ty::Const<'tcx>, Self::Error> {
|
||||
if !c.needs_infer() {
|
||||
if !c.has_infer() {
|
||||
Ok(c) // micro-optimize -- if there is nothing in this const that this fold affects...
|
||||
} else {
|
||||
let c = self.infcx.shallow_resolve(c);
|
||||
|
@ -215,7 +215,7 @@ impl<'tcx> CtxtInterners<'tcx> {
|
||||
) -> Fingerprint {
|
||||
// It's impossible to hash inference variables (and will ICE), so we don't need to try to cache them.
|
||||
// Without incremental, we rarely stable-hash types, so let's not do it proactively.
|
||||
if flags.flags.intersects(TypeFlags::NEEDS_INFER) || sess.opts.incremental.is_none() {
|
||||
if flags.flags.intersects(TypeFlags::HAS_INFER) || sess.opts.incremental.is_none() {
|
||||
Fingerprint::ZERO
|
||||
} else {
|
||||
let mut hasher = StableHasher::new();
|
||||
|
@ -40,7 +40,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for RegionEraserVisitor<'tcx> {
|
||||
}
|
||||
|
||||
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
if ty.needs_infer() { ty.super_fold_with(self) } else { self.tcx.erase_regions_ty(ty) }
|
||||
if ty.has_infer() { ty.super_fold_with(self) } else { self.tcx.erase_regions_ty(ty) }
|
||||
}
|
||||
|
||||
fn fold_binder<T>(&mut self, t: ty::Binder<'tcx, T>) -> ty::Binder<'tcx, T>
|
||||
|
@ -1151,7 +1151,7 @@ impl<'tcx> Ty<'tcx> {
|
||||
// context, or *something* like that, but for now just avoid passing inference
|
||||
// variables to queries that can't cope with them. Instead, conservatively
|
||||
// return "true" (may change drop order).
|
||||
if query_ty.needs_infer() {
|
||||
if query_ty.has_infer() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -79,10 +79,10 @@ pub trait TypeVisitableExt<'tcx>: TypeVisitable<TyCtxt<'tcx>> {
|
||||
self.has_type_flags(TypeFlags::HAS_TY_INFER)
|
||||
}
|
||||
fn has_non_region_infer(&self) -> bool {
|
||||
self.has_type_flags(TypeFlags::NEEDS_INFER - TypeFlags::HAS_RE_INFER)
|
||||
self.has_type_flags(TypeFlags::HAS_INFER - TypeFlags::HAS_RE_INFER)
|
||||
}
|
||||
fn needs_infer(&self) -> bool {
|
||||
self.has_type_flags(TypeFlags::NEEDS_INFER)
|
||||
fn has_infer(&self) -> bool {
|
||||
self.has_type_flags(TypeFlags::HAS_INFER)
|
||||
}
|
||||
fn has_placeholders(&self) -> bool {
|
||||
self.has_type_flags(
|
||||
|
@ -41,7 +41,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
|
||||
fn type_is_copy_modulo_regions(&self, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
let ty = self.resolve_vars_if_possible(ty);
|
||||
|
||||
if !(param_env, ty).needs_infer() {
|
||||
if !(param_env, ty).has_infer() {
|
||||
return ty.is_copy_modulo_regions(self.tcx, param_env);
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ impl<'a, 'tcx> Canonicalizer<'a, 'tcx> {
|
||||
};
|
||||
|
||||
let value = value.fold_with(&mut canonicalizer);
|
||||
assert!(!value.needs_infer());
|
||||
assert!(!value.has_infer());
|
||||
assert!(!value.has_placeholders());
|
||||
|
||||
let (max_universe, variables) = canonicalizer.finalize();
|
||||
|
@ -582,7 +582,7 @@ fn orphan_check_trait_ref<'tcx>(
|
||||
trait_ref: ty::TraitRef<'tcx>,
|
||||
in_crate: InCrate,
|
||||
) -> Result<(), OrphanCheckErr<'tcx>> {
|
||||
if trait_ref.needs_infer() && trait_ref.needs_subst() {
|
||||
if trait_ref.has_infer() && trait_ref.needs_subst() {
|
||||
bug!(
|
||||
"can't orphan check a trait ref with both params and inference variables {:?}",
|
||||
trait_ref
|
||||
|
@ -60,7 +60,7 @@ impl<'a, 'tcx: 'a> InferCtxtExt<'a, 'tcx> for InferCtxt<'tcx> {
|
||||
// We may however encounter unconstrained lifetime variables in invalid
|
||||
// code. See #110161 for context.
|
||||
assert!(!ty.has_non_region_infer());
|
||||
if ty.needs_infer() {
|
||||
if ty.has_infer() {
|
||||
self.tcx.sess.delay_span_bug(
|
||||
self.tcx.def_span(body_id),
|
||||
"skipped implied_outlives_bounds due to unconstrained lifetimes",
|
||||
|
@ -449,7 +449,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
|
||||
debug!(?stack, ?candidates, "winnowed to {} candidates", candidates.len());
|
||||
|
||||
let needs_infer = stack.obligation.predicate.has_non_region_infer();
|
||||
let has_non_region_infer = stack.obligation.predicate.has_non_region_infer();
|
||||
|
||||
// If there are STILL multiple candidates, we can further
|
||||
// reduce the list by dropping duplicates -- including
|
||||
@ -461,7 +461,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
self.candidate_should_be_dropped_in_favor_of(
|
||||
&candidates[i],
|
||||
&candidates[j],
|
||||
needs_infer,
|
||||
has_non_region_infer,
|
||||
) == DropVictim::Yes
|
||||
});
|
||||
if should_drop_i {
|
||||
@ -1330,7 +1330,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
}
|
||||
|
||||
if self.can_use_global_caches(param_env) {
|
||||
if !trait_pred.needs_infer() {
|
||||
if !trait_pred.has_infer() {
|
||||
debug!(?trait_pred, ?result, "insert_evaluation_cache global");
|
||||
// This may overwrite the cache with the same value
|
||||
// FIXME: Due to #50507 this overwrites the different values
|
||||
@ -1516,7 +1516,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
// If there are any inference variables in the `ParamEnv`, then we
|
||||
// always use a cache local to this particular scope. Otherwise, we
|
||||
// switch to a global cache.
|
||||
if param_env.needs_infer() {
|
||||
if param_env.has_infer() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1587,7 +1587,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
return false;
|
||||
}
|
||||
match result {
|
||||
Ok(Some(SelectionCandidate::ParamCandidate(trait_ref))) => !trait_ref.needs_infer(),
|
||||
Ok(Some(SelectionCandidate::ParamCandidate(trait_ref))) => !trait_ref.has_infer(),
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
@ -1613,8 +1613,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
if self.can_use_global_caches(param_env) {
|
||||
if let Err(Overflow(OverflowError::Canonical)) = candidate {
|
||||
// Don't cache overflow globally; we only produce this in certain modes.
|
||||
} else if !pred.needs_infer() {
|
||||
if !candidate.needs_infer() {
|
||||
} else if !pred.has_infer() {
|
||||
if !candidate.has_infer() {
|
||||
debug!(?pred, ?candidate, "insert_candidate_cache global");
|
||||
// This may overwrite the cache with the same value.
|
||||
tcx.selection_cache.insert((param_env, pred), dep_node, candidate);
|
||||
@ -1724,7 +1724,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
.map(|InferOk { obligations: _, value: () }| {
|
||||
// This method is called within a probe, so we can't have
|
||||
// inference variables and placeholders escape.
|
||||
if !trait_bound.needs_infer() && !trait_bound.has_placeholders() {
|
||||
if !trait_bound.has_infer() && !trait_bound.has_placeholders() {
|
||||
Some(trait_bound)
|
||||
} else {
|
||||
None
|
||||
@ -1840,7 +1840,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||
&mut self,
|
||||
victim: &EvaluatedCandidate<'tcx>,
|
||||
other: &EvaluatedCandidate<'tcx>,
|
||||
needs_infer: bool,
|
||||
has_non_region_infer: bool,
|
||||
) -> DropVictim {
|
||||
if victim.candidate == other.candidate {
|
||||
return DropVictim::Yes;
|
||||
@ -1956,7 +1956,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||
| (ObjectCandidate(i), ObjectCandidate(j)) => {
|
||||
// Arbitrarily pick the lower numbered candidate for backwards
|
||||
// compatibility reasons. Don't let this affect inference.
|
||||
DropVictim::drop_if(i < j && !needs_infer)
|
||||
DropVictim::drop_if(i < j && !has_non_region_infer)
|
||||
}
|
||||
(ObjectCandidate(_), ProjectionCandidate(..))
|
||||
| (ProjectionCandidate(..), ObjectCandidate(_)) => {
|
||||
@ -2062,7 +2062,8 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||
// existence of multiple marker trait impls tells us nothing
|
||||
// about which one should actually apply.
|
||||
DropVictim::drop_if(
|
||||
!needs_infer && other.evaluation.must_apply_considering_regions(),
|
||||
!has_non_region_infer
|
||||
&& other.evaluation.must_apply_considering_regions(),
|
||||
)
|
||||
}
|
||||
None => DropVictim::No,
|
||||
|
@ -353,8 +353,8 @@ pub(crate) fn vtable_trait_upcasting_coercion_new_vptr_slot<'tcx>(
|
||||
),
|
||||
) -> Option<usize> {
|
||||
let (source, target) = key;
|
||||
assert!(matches!(&source.kind(), &ty::Dynamic(..)) && !source.needs_infer());
|
||||
assert!(matches!(&target.kind(), &ty::Dynamic(..)) && !target.needs_infer());
|
||||
assert!(matches!(&source.kind(), &ty::Dynamic(..)) && !source.has_infer());
|
||||
assert!(matches!(&target.kind(), &ty::Dynamic(..)) && !target.has_infer());
|
||||
|
||||
// this has been typecked-before, so diagnostics is not really needed.
|
||||
let unsize_trait_did = tcx.require_lang_item(LangItem::Unsize, None);
|
||||
|
@ -47,7 +47,7 @@ fn try_normalize_after_erasing_regions<'tcx, T: TypeFoldable<TyCtxt<'tcx>> + Par
|
||||
// us a test case.
|
||||
debug_assert_eq!(normalized_value, resolved_value);
|
||||
let erased = infcx.tcx.erase_regions(resolved_value);
|
||||
debug_assert!(!erased.needs_infer(), "{erased:?}");
|
||||
debug_assert!(!erased.has_infer(), "{erased:?}");
|
||||
Ok(erased)
|
||||
}
|
||||
Err(NoSolution) => Err(NoSolution),
|
||||
|
@ -104,8 +104,8 @@ fn resolve_associated_item<'tcx>(
|
||||
"resolving ImplSource::UserDefined: {:?}, {:?}, {:?}, {:?}",
|
||||
param_env, trait_item_id, rcvr_substs, impl_data
|
||||
);
|
||||
assert!(!rcvr_substs.needs_infer());
|
||||
assert!(!trait_ref.needs_infer());
|
||||
assert!(!rcvr_substs.has_infer());
|
||||
assert!(!trait_ref.has_infer());
|
||||
|
||||
let trait_def_id = tcx.trait_id_of_impl(impl_data.impl_def_id).unwrap();
|
||||
let trait_def = tcx.trait_def(trait_def_id);
|
||||
|
@ -192,7 +192,7 @@ bitflags! {
|
||||
|
||||
/// Does this have inference variables? Used to determine whether
|
||||
/// inference is required.
|
||||
const NEEDS_INFER = TypeFlags::HAS_TY_INFER.bits
|
||||
const HAS_INFER = TypeFlags::HAS_TY_INFER.bits
|
||||
| TypeFlags::HAS_RE_INFER.bits
|
||||
| TypeFlags::HAS_CT_INFER.bits;
|
||||
|
||||
|
@ -226,7 +226,7 @@ pub fn implements_trait_with_env<'tcx>(
|
||||
ty_params: impl IntoIterator<Item = Option<GenericArg<'tcx>>>,
|
||||
) -> bool {
|
||||
// Clippy shouldn't have infer types
|
||||
assert!(!ty.needs_infer());
|
||||
assert!(!ty.has_infer());
|
||||
|
||||
let ty = tcx.erase_regions(ty);
|
||||
if ty.has_escaping_bound_vars() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user