mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Rollup merge of #120590 - compiler-errors:dead, r=Nilstrieb
Remove unused args from functions `#[instrument]` suppresses the unused arguments from a function, *and* suppresses unused methods too! This PR removes things which are only used via `#[instrument]` calls, and fixes some other errors (privacy?) that I will comment inline. It's possible that some of these arguments were being passed in for the purposes of being instrumented, but I am unconvinced by most of them.
This commit is contained in:
commit
4ffb1a7f3d
@ -184,7 +184,7 @@ pub(crate) fn compute_regions<'cx, 'tcx>(
|
||||
|
||||
// Solve the region constraints.
|
||||
let (closure_region_requirements, nll_errors) =
|
||||
regioncx.solve(infcx, param_env, body, polonius_output.clone());
|
||||
regioncx.solve(infcx, body, polonius_output.clone());
|
||||
|
||||
if !nll_errors.is_empty() {
|
||||
// Suppress unhelpful extra errors in `infer_opaque_types`.
|
||||
|
@ -658,7 +658,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
pub(super) fn solve(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
polonius_output: Option<Rc<PoloniusOutput>>,
|
||||
) -> (Option<ClosureRegionRequirements<'tcx>>, RegionErrors<'tcx>) {
|
||||
@ -674,7 +673,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
// eagerly.
|
||||
let mut outlives_requirements = infcx.tcx.is_typeck_child(mir_def_id).then(Vec::new);
|
||||
|
||||
self.check_type_tests(infcx, body, outlives_requirements.as_mut(), &mut errors_buffer);
|
||||
self.check_type_tests(infcx, outlives_requirements.as_mut(), &mut errors_buffer);
|
||||
|
||||
debug!(?errors_buffer);
|
||||
debug!(?outlives_requirements);
|
||||
@ -932,7 +931,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
fn check_type_tests(
|
||||
&self,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
mut propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
|
||||
errors_buffer: &mut RegionErrors<'tcx>,
|
||||
) {
|
||||
@ -957,12 +955,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
}
|
||||
|
||||
if let Some(propagated_outlives_requirements) = &mut propagated_outlives_requirements {
|
||||
if self.try_promote_type_test(
|
||||
infcx,
|
||||
body,
|
||||
type_test,
|
||||
propagated_outlives_requirements,
|
||||
) {
|
||||
if self.try_promote_type_test(infcx, type_test, propagated_outlives_requirements) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -1016,7 +1009,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
fn try_promote_type_test(
|
||||
&self,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
type_test: &TypeTest<'tcx>,
|
||||
propagated_outlives_requirements: &mut Vec<ClosureOutlivesRequirement<'tcx>>,
|
||||
) -> bool {
|
||||
@ -1179,35 +1171,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
Some(ClosureOutlivesSubject::Ty(ClosureOutlivesSubjectTy::bind(tcx, ty)))
|
||||
}
|
||||
|
||||
/// Returns a universally quantified region that outlives the
|
||||
/// value of `r` (`r` may be existentially or universally
|
||||
/// quantified).
|
||||
///
|
||||
/// Since `r` is (potentially) an existential region, it has some
|
||||
/// value which may include (a) any number of points in the CFG
|
||||
/// and (b) any number of `end('x)` elements of universally
|
||||
/// quantified regions. To convert this into a single universal
|
||||
/// region we do as follows:
|
||||
///
|
||||
/// - Ignore the CFG points in `'r`. All universally quantified regions
|
||||
/// include the CFG anyhow.
|
||||
/// - For each `end('x)` element in `'r`, compute the mutual LUB, yielding
|
||||
/// a result `'y`.
|
||||
#[instrument(skip(self), level = "debug", ret)]
|
||||
pub(crate) fn universal_upper_bound(&self, r: RegionVid) -> RegionVid {
|
||||
debug!(r = %self.region_value_str(r));
|
||||
|
||||
// Find the smallest universal region that contains all other
|
||||
// universal regions within `region`.
|
||||
let mut lub = self.universal_regions.fr_fn_body;
|
||||
let r_scc = self.constraint_sccs.scc(r);
|
||||
for ur in self.scc_values.universal_regions_outlived_by(r_scc) {
|
||||
lub = self.universal_region_relations.postdom_upper_bound(lub, ur);
|
||||
}
|
||||
|
||||
lub
|
||||
}
|
||||
|
||||
/// Like `universal_upper_bound`, but returns an approximation more suitable
|
||||
/// for diagnostics. If `r` contains multiple disjoint universal regions
|
||||
/// (e.g. 'a and 'b in `fn foo<'a, 'b> { ... }`, we pick the lower-numbered region.
|
||||
|
@ -213,7 +213,6 @@ pub(crate) fn type_check<'mir, 'tcx>(
|
||||
CustomTypeOp::new(
|
||||
|ocx| {
|
||||
ocx.infcx.register_member_constraints(
|
||||
param_env,
|
||||
opaque_type_key,
|
||||
decl.hidden_type.ty,
|
||||
decl.hidden_type.span,
|
||||
|
@ -243,9 +243,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
|
||||
speculative: bool,
|
||||
dup_bindings: &mut FxHashMap<DefId, Span>,
|
||||
path_span: Span,
|
||||
constness: ty::BoundConstness,
|
||||
only_self_bounds: OnlySelfBounds,
|
||||
polarity: ty::ImplPolarity,
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
// Given something like `U: SomeTrait<T = X>`, we want to produce a
|
||||
// predicate like `<U as SomeTrait>::T = X`. This is somewhat
|
||||
|
@ -16,7 +16,7 @@ use rustc_middle::ty::{
|
||||
self, GenericArgsRef, GenericParamDef, GenericParamDefKind, IsSuggestable, Ty, TyCtxt,
|
||||
};
|
||||
use rustc_session::lint::builtin::LATE_BOUND_LIFETIME_ARGUMENTS;
|
||||
use rustc_span::{symbol::kw, Span};
|
||||
use rustc_span::symbol::kw;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
/// Report an error that a generic argument did not match the generic parameter that was
|
||||
@ -404,7 +404,6 @@ pub fn create_args_for_parent_generic_args<'tcx: 'a, 'a>(
|
||||
/// Used specifically for function calls.
|
||||
pub fn check_generic_arg_count_for_call(
|
||||
tcx: TyCtxt<'_>,
|
||||
span: Span,
|
||||
def_id: DefId,
|
||||
generics: &ty::Generics,
|
||||
seg: &hir::PathSegment<'_>,
|
||||
@ -418,17 +417,7 @@ pub fn check_generic_arg_count_for_call(
|
||||
};
|
||||
let has_self = generics.parent.is_none() && generics.has_self;
|
||||
|
||||
check_generic_arg_count(
|
||||
tcx,
|
||||
span,
|
||||
def_id,
|
||||
seg,
|
||||
generics,
|
||||
gen_args,
|
||||
gen_pos,
|
||||
has_self,
|
||||
seg.infer_args,
|
||||
)
|
||||
check_generic_arg_count(tcx, def_id, seg, generics, gen_args, gen_pos, has_self, seg.infer_args)
|
||||
}
|
||||
|
||||
/// Checks that the correct number of generic arguments have been provided.
|
||||
@ -436,7 +425,6 @@ pub fn check_generic_arg_count_for_call(
|
||||
#[instrument(skip(tcx, gen_pos), level = "debug")]
|
||||
pub(crate) fn check_generic_arg_count(
|
||||
tcx: TyCtxt<'_>,
|
||||
span: Span,
|
||||
def_id: DefId,
|
||||
seg: &hir::PathSegment<'_>,
|
||||
gen_params: &ty::Generics,
|
||||
|
@ -25,7 +25,7 @@ use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorOf, DefKind, Namespace, Res};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::intravisit::{walk_generics, Visitor as _};
|
||||
use rustc_hir::{GenericArg, GenericArgs, OpaqueTyOrigin};
|
||||
use rustc_hir::{GenericArg, GenericArgs};
|
||||
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
|
||||
use rustc_infer::traits::ObligationCause;
|
||||
use rustc_middle::middle::stability::AllowUnstable;
|
||||
@ -379,7 +379,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
|
||||
let mut arg_count = check_generic_arg_count(
|
||||
tcx,
|
||||
span,
|
||||
def_id,
|
||||
seg,
|
||||
generics,
|
||||
@ -773,9 +772,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
speculative,
|
||||
&mut dup_bindings,
|
||||
binding.span,
|
||||
constness,
|
||||
only_self_bounds,
|
||||
polarity,
|
||||
);
|
||||
// Okay to ignore `Err` because of `ErrorGuaranteed` (see above).
|
||||
}
|
||||
@ -2493,7 +2490,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
let opaque_ty = tcx.hir().item(item_id);
|
||||
|
||||
match opaque_ty.kind {
|
||||
hir::ItemKind::OpaqueTy(&hir::OpaqueTy { origin, .. }) => {
|
||||
hir::ItemKind::OpaqueTy(&hir::OpaqueTy { .. }) => {
|
||||
let local_def_id = item_id.owner_id.def_id;
|
||||
// If this is an RPITIT and we are using the new RPITIT lowering scheme, we
|
||||
// generate the def_id of an associated type for the trait and return as
|
||||
@ -2503,7 +2500,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
} else {
|
||||
local_def_id.to_def_id()
|
||||
};
|
||||
self.impl_trait_ty_to_ty(def_id, lifetimes, origin, in_trait)
|
||||
self.impl_trait_ty_to_ty(def_id, lifetimes, in_trait)
|
||||
}
|
||||
ref i => bug!("`impl Trait` pointed to non-opaque type?? {:#?}", i),
|
||||
}
|
||||
@ -2559,7 +2556,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
&self,
|
||||
def_id: DefId,
|
||||
lifetimes: &[hir::GenericArg<'_>],
|
||||
origin: OpaqueTyOrigin,
|
||||
in_trait: bool,
|
||||
) -> Ty<'tcx> {
|
||||
debug!("impl_trait_ty_to_ty(def_id={:?}, lifetimes={:?})", def_id, lifetimes);
|
||||
|
@ -521,7 +521,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
/// We must not attempt to select obligations after this method has run, or risk query cycle
|
||||
/// ICE.
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
pub(in super::super) fn resolve_coroutine_interiors(&self, def_id: DefId) {
|
||||
pub(in super::super) fn resolve_coroutine_interiors(&self) {
|
||||
// Try selecting all obligations that are not blocked on inference variables.
|
||||
// Once we start unifying coroutine witnesses, trying to select obligations on them will
|
||||
// trigger query cycle ICEs, as doing so requires MIR.
|
||||
@ -1179,14 +1179,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// parameter internally, but we don't allow users to specify the
|
||||
// parameter's value explicitly, so we have to do some error-
|
||||
// checking here.
|
||||
let arg_count = check_generic_arg_count_for_call(
|
||||
tcx,
|
||||
span,
|
||||
def_id,
|
||||
generics,
|
||||
seg,
|
||||
IsMethodCall::No,
|
||||
);
|
||||
let arg_count =
|
||||
check_generic_arg_count_for_call(tcx, def_id, generics, seg, IsMethodCall::No);
|
||||
|
||||
if let ExplicitLateBound::Yes = arg_count.explicit_late_bound {
|
||||
explicit_late_bound = ExplicitLateBound::Yes;
|
||||
|
@ -286,7 +286,7 @@ fn typeck_with_fallback<'tcx>(
|
||||
debug!(pending_obligations = ?fcx.fulfillment_cx.borrow().pending_obligations());
|
||||
|
||||
// This must be the last thing before `report_ambiguity_errors`.
|
||||
fcx.resolve_coroutine_interiors(def_id.to_def_id());
|
||||
fcx.resolve_coroutine_interiors();
|
||||
|
||||
debug!(pending_obligations = ?fcx.fulfillment_cx.borrow().pending_obligations());
|
||||
|
||||
|
@ -436,7 +436,8 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
|
||||
pub(crate) fn cat_rvalue(
|
||||
&self,
|
||||
hir_id: hir::HirId,
|
||||
span: Span,
|
||||
// FIXME: remove
|
||||
_span: Span,
|
||||
expr_ty: Ty<'tcx>,
|
||||
) -> PlaceWithHirId<'tcx> {
|
||||
PlaceWithHirId::new(hir_id, expr_ty, PlaceBase::Rvalue, Vec::new())
|
||||
|
@ -356,7 +356,6 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
|
||||
|
||||
let arg_count_correct = check_generic_arg_count_for_call(
|
||||
self.tcx,
|
||||
self.span,
|
||||
pick.item.def_id,
|
||||
generics,
|
||||
seg,
|
||||
|
@ -863,7 +863,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||
}
|
||||
|
||||
#[instrument(skip(self, snapshot), level = "debug")]
|
||||
fn rollback_to(&self, cause: &str, snapshot: CombinedSnapshot<'tcx>) {
|
||||
fn rollback_to(&self, snapshot: CombinedSnapshot<'tcx>) {
|
||||
let CombinedSnapshot { undo_snapshot, region_constraints_snapshot, universe } = snapshot;
|
||||
|
||||
self.universe.set(universe);
|
||||
@ -895,7 +895,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||
self.commit_from(snapshot);
|
||||
}
|
||||
Err(_) => {
|
||||
self.rollback_to("commit_if_ok -- error", snapshot);
|
||||
self.rollback_to(snapshot);
|
||||
}
|
||||
}
|
||||
r
|
||||
@ -909,7 +909,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||
{
|
||||
let snapshot = self.start_snapshot();
|
||||
let r = f(&snapshot);
|
||||
self.rollback_to("probe", snapshot);
|
||||
self.rollback_to(snapshot);
|
||||
r
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,6 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
pub fn register_member_constraints(
|
||||
&self,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
opaque_type_key: OpaqueTypeKey<'tcx>,
|
||||
concrete_ty: Ty<'tcx>,
|
||||
span: Span,
|
||||
|
@ -221,11 +221,11 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||
}
|
||||
|
||||
(ty::ConstKind::Infer(InferConst::Var(vid)), _) => {
|
||||
return self.unify_const_variable(vid, b, relation.param_env());
|
||||
return self.unify_const_variable(vid, b);
|
||||
}
|
||||
|
||||
(_, ty::ConstKind::Infer(InferConst::Var(vid))) => {
|
||||
return self.unify_const_variable(vid, a, relation.param_env());
|
||||
return self.unify_const_variable(vid, a);
|
||||
}
|
||||
|
||||
(ty::ConstKind::Infer(InferConst::EffectVar(vid)), _) => {
|
||||
@ -298,7 +298,6 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||
&self,
|
||||
target_vid: ty::ConstVid,
|
||||
ct: ty::Const<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
) -> RelateResult<'tcx, ty::Const<'tcx>> {
|
||||
let span = match self.inner.borrow_mut().const_unification_table().probe_value(target_vid) {
|
||||
ConstVariableValue::Known { value } => {
|
||||
|
@ -1038,7 +1038,6 @@ impl<'tcx> PatRangeBoundary<'tcx> {
|
||||
a.partial_cmp(&b)
|
||||
}
|
||||
ty::Int(ity) => {
|
||||
use rustc_middle::ty::layout::IntegerExt;
|
||||
let size = rustc_target::abi::Integer::from_int_ty(&tcx, *ity).size();
|
||||
let a = size.sign_extend(a) as i128;
|
||||
let b = size.sign_extend(b) as i128;
|
||||
|
@ -55,7 +55,7 @@ impl<'tcx> TypeRelation<'tcx> for MatchAgainstFreshVars<'tcx> {
|
||||
fn regions(
|
||||
&mut self,
|
||||
a: ty::Region<'tcx>,
|
||||
b: ty::Region<'tcx>,
|
||||
_b: ty::Region<'tcx>,
|
||||
) -> RelateResult<'tcx, ty::Region<'tcx>> {
|
||||
Ok(a)
|
||||
}
|
||||
|
@ -541,12 +541,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
||||
}
|
||||
|
||||
#[instrument(level = "trace", skip(self), ret)]
|
||||
fn eval_rvalue(
|
||||
&mut self,
|
||||
rvalue: &Rvalue<'tcx>,
|
||||
location: Location,
|
||||
dest: &Place<'tcx>,
|
||||
) -> Option<()> {
|
||||
fn eval_rvalue(&mut self, rvalue: &Rvalue<'tcx>, dest: &Place<'tcx>) -> Option<()> {
|
||||
if !dest.projection.is_empty() {
|
||||
return None;
|
||||
}
|
||||
@ -734,7 +729,7 @@ impl<'tcx> Visitor<'tcx> for ConstPropagator<'_, 'tcx> {
|
||||
_ if place.is_indirect() => {}
|
||||
ConstPropMode::NoPropagation => self.ensure_not_propagated(place.local),
|
||||
ConstPropMode::OnlyInsideOwnBlock | ConstPropMode::FullConstProp => {
|
||||
if self.eval_rvalue(rvalue, location, place).is_none() {
|
||||
if self.eval_rvalue(rvalue, place).is_none() {
|
||||
// Const prop failed, so erase the destination, ensuring that whatever happens
|
||||
// from here on, does not know about the previous value.
|
||||
// This is important in case we have
|
||||
|
@ -10,7 +10,7 @@ use crate::MatchArm;
|
||||
/// Traverse the patterns to collect any variants of a non_exhaustive enum that fail to be mentioned
|
||||
/// in a given column.
|
||||
#[instrument(level = "debug", skip(cx), ret)]
|
||||
fn collect_nonexhaustive_missing_variants<'a, 'p, 'tcx>(
|
||||
fn collect_nonexhaustive_missing_variants<'p, 'tcx>(
|
||||
cx: &RustcMatchCheckCtxt<'p, 'tcx>,
|
||||
column: &PatternColumn<'p, RustcMatchCheckCtxt<'p, 'tcx>>,
|
||||
) -> Result<Vec<WitnessPat<'p, 'tcx>>, ErrorGuaranteed> {
|
||||
|
@ -52,7 +52,7 @@ impl From<DepNodeIndex> for QueryInvocationId {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct MarkFrame<'a> {
|
||||
pub struct MarkFrame<'a> {
|
||||
index: SerializedDepNodeIndex,
|
||||
parent: Option<&'a MarkFrame<'a>>,
|
||||
}
|
||||
@ -754,7 +754,6 @@ impl<D: Deps> DepGraphData<D> {
|
||||
&self,
|
||||
qcx: Qcx,
|
||||
parent_dep_node_index: SerializedDepNodeIndex,
|
||||
dep_node: &DepNode,
|
||||
frame: Option<&MarkFrame<'_>>,
|
||||
) -> Option<()> {
|
||||
let dep_dep_node_color = self.colors.get(parent_dep_node_index);
|
||||
@ -861,7 +860,7 @@ impl<D: Deps> DepGraphData<D> {
|
||||
let prev_deps = self.previous.edge_targets_from(prev_dep_node_index);
|
||||
|
||||
for dep_dep_node_index in prev_deps {
|
||||
self.try_mark_parent_green(qcx, dep_dep_node_index, dep_node, Some(&frame))?;
|
||||
self.try_mark_parent_green(qcx, dep_dep_node_index, Some(&frame))?;
|
||||
}
|
||||
|
||||
// If we got here without hitting a `return` that means that all
|
||||
|
@ -1646,7 +1646,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||
debug!(?rib.kind);
|
||||
match rib.kind {
|
||||
LifetimeRibKind::AnonymousCreateParameter { binder, .. } => {
|
||||
let res = self.create_fresh_lifetime(lifetime.id, lifetime.ident, binder);
|
||||
let res = self.create_fresh_lifetime(lifetime.ident, binder);
|
||||
self.record_lifetime_res(lifetime.id, res, elision_candidate);
|
||||
return;
|
||||
}
|
||||
@ -1738,7 +1738,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||
}
|
||||
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
fn create_fresh_lifetime(&mut self, id: NodeId, ident: Ident, binder: NodeId) -> LifetimeRes {
|
||||
fn create_fresh_lifetime(&mut self, ident: Ident, binder: NodeId) -> LifetimeRes {
|
||||
debug_assert_eq!(ident.name, kw::UnderscoreLifetime);
|
||||
debug!(?ident.span);
|
||||
|
||||
@ -1759,7 +1759,6 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
fn resolve_elided_lifetimes_in_path(
|
||||
&mut self,
|
||||
path_id: NodeId,
|
||||
partial_res: PartialRes,
|
||||
path: &[Segment],
|
||||
source: PathSource<'_>,
|
||||
@ -1892,7 +1891,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||
// Group all suggestions into the first record.
|
||||
let mut candidate = LifetimeElisionCandidate::Missing(missing_lifetime);
|
||||
for id in node_ids {
|
||||
let res = self.create_fresh_lifetime(id, ident, binder);
|
||||
let res = self.create_fresh_lifetime(ident, binder);
|
||||
self.record_lifetime_res(
|
||||
id,
|
||||
res,
|
||||
@ -3942,7 +3941,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
||||
if record_partial_res == RecordPartialRes::Yes {
|
||||
// Avoid recording definition of `A::B` in `<T as A>::B::C`.
|
||||
self.r.record_partial_res(node_id, partial_res);
|
||||
self.resolve_elided_lifetimes_in_path(node_id, partial_res, path, source, path_span);
|
||||
self.resolve_elided_lifetimes_in_path(partial_res, path, source, path_span);
|
||||
}
|
||||
|
||||
partial_res
|
||||
|
@ -826,7 +826,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
||||
#[instrument(level = "debug", skip(self), ret)]
|
||||
pub(super) fn merge_candidates(
|
||||
&mut self,
|
||||
mut candidates: Vec<Candidate<'tcx>>,
|
||||
candidates: Vec<Candidate<'tcx>>,
|
||||
) -> QueryResult<'tcx> {
|
||||
// First try merging all candidates. This is complete and fully sound.
|
||||
let responses = candidates.iter().map(|c| c.result).collect::<Vec<_>>();
|
||||
|
@ -124,25 +124,6 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
fn compute_closure_kind_goal(
|
||||
&mut self,
|
||||
goal: Goal<'tcx, (DefId, ty::GenericArgsRef<'tcx>, ty::ClosureKind)>,
|
||||
) -> QueryResult<'tcx> {
|
||||
let (_, args, expected_kind) = goal.predicate;
|
||||
let found_kind = args.as_closure().kind_ty().to_opt_closure_kind();
|
||||
|
||||
let Some(found_kind) = found_kind else {
|
||||
return self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS);
|
||||
};
|
||||
if found_kind.extends(expected_kind) {
|
||||
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
|
||||
} else {
|
||||
Err(NoSolution)
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
fn compute_object_safe_goal(&mut self, trait_def_id: DefId) -> QueryResult<'tcx> {
|
||||
if self.tcx().check_is_object_safe(trait_def_id) {
|
||||
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
|
||||
|
@ -483,7 +483,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
// Instead, we select the right impl now but report "`Bar` does
|
||||
// not implement `Clone`".
|
||||
if candidates.len() == 1 {
|
||||
return self.filter_reservation_impls(candidates.pop().unwrap(), stack.obligation);
|
||||
return self.filter_reservation_impls(candidates.pop().unwrap());
|
||||
}
|
||||
|
||||
// Winnow, but record the exact outcome of evaluation, which
|
||||
@ -557,7 +557,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
}
|
||||
|
||||
// Just one candidate left.
|
||||
self.filter_reservation_impls(candidates.pop().unwrap().candidate, stack.obligation)
|
||||
self.filter_reservation_impls(candidates.pop().unwrap().candidate)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -1436,7 +1436,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
fn filter_reservation_impls(
|
||||
&mut self,
|
||||
candidate: SelectionCandidate<'tcx>,
|
||||
obligation: &PolyTraitObligation<'tcx>,
|
||||
) -> SelectionResult<'tcx, SelectionCandidate<'tcx>> {
|
||||
let tcx = self.tcx();
|
||||
// Treat reservation impls as ambiguity.
|
||||
|
Loading…
Reference in New Issue
Block a user