mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-12 18:07:40 +00:00
tracing::instrument cleanup
This commit is contained in:
parent
ee3c835018
commit
1fc9ef1edd
@ -1139,7 +1139,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||||||
/// include the CFG anyhow.
|
/// include the CFG anyhow.
|
||||||
/// - For each `end('x)` element in `'r`, compute the mutual LUB, yielding
|
/// - For each `end('x)` element in `'r`, compute the mutual LUB, yielding
|
||||||
/// a result `'y`.
|
/// a result `'y`.
|
||||||
#[instrument(skip(self), level = "debug")]
|
#[instrument(skip(self), level = "debug", ret)]
|
||||||
pub(crate) fn universal_upper_bound(&self, r: RegionVid) -> RegionVid {
|
pub(crate) fn universal_upper_bound(&self, r: RegionVid) -> RegionVid {
|
||||||
debug!(r = %self.region_value_str(r));
|
debug!(r = %self.region_value_str(r));
|
||||||
|
|
||||||
@ -1151,8 +1151,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||||||
lub = self.universal_region_relations.postdom_upper_bound(lub, ur);
|
lub = self.universal_region_relations.postdom_upper_bound(lub, ur);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!(?lub);
|
|
||||||
|
|
||||||
lub
|
lub
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1333,15 +1331,15 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Evaluate whether `sup_region: sub_region`.
|
// Evaluate whether `sup_region: sub_region`.
|
||||||
#[instrument(skip(self), level = "debug")]
|
#[instrument(skip(self), level = "debug", ret)]
|
||||||
fn eval_outlives(&self, sup_region: RegionVid, sub_region: RegionVid) -> bool {
|
fn eval_outlives(&self, sup_region: RegionVid, sub_region: RegionVid) -> bool {
|
||||||
debug!(
|
debug!(
|
||||||
"eval_outlives: sup_region's value = {:?} universal={:?}",
|
"sup_region's value = {:?} universal={:?}",
|
||||||
self.region_value_str(sup_region),
|
self.region_value_str(sup_region),
|
||||||
self.universal_regions.is_universal_region(sup_region),
|
self.universal_regions.is_universal_region(sup_region),
|
||||||
);
|
);
|
||||||
debug!(
|
debug!(
|
||||||
"eval_outlives: sub_region's value = {:?} universal={:?}",
|
"sub_region's value = {:?} universal={:?}",
|
||||||
self.region_value_str(sub_region),
|
self.region_value_str(sub_region),
|
||||||
self.universal_regions.is_universal_region(sub_region),
|
self.universal_regions.is_universal_region(sub_region),
|
||||||
);
|
);
|
||||||
@ -1354,7 +1352,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||||||
// true if `'sup` outlives static.
|
// true if `'sup` outlives static.
|
||||||
if !self.universe_compatible(sub_region_scc, sup_region_scc) {
|
if !self.universe_compatible(sub_region_scc, sup_region_scc) {
|
||||||
debug!(
|
debug!(
|
||||||
"eval_outlives: sub universe `{sub_region_scc:?}` is not nameable \
|
"sub universe `{sub_region_scc:?}` is not nameable \
|
||||||
by super `{sup_region_scc:?}`, promoting to static",
|
by super `{sup_region_scc:?}`, promoting to static",
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1375,9 +1373,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if !universal_outlives {
|
if !universal_outlives {
|
||||||
debug!(
|
debug!("sub region contains a universal region not present in super");
|
||||||
"eval_outlives: returning false because sub region contains a universal region not present in super"
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1386,15 +1382,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||||||
|
|
||||||
if self.universal_regions.is_universal_region(sup_region) {
|
if self.universal_regions.is_universal_region(sup_region) {
|
||||||
// Micro-opt: universal regions contain all points.
|
// Micro-opt: universal regions contain all points.
|
||||||
debug!(
|
debug!("super is universal and hence contains all points");
|
||||||
"eval_outlives: returning true because super is universal and hence contains all points"
|
|
||||||
);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let result = self.scc_values.contains_points(sup_region_scc, sub_region_scc);
|
debug!("comparison between points in sup/sub");
|
||||||
debug!("returning {} because of comparison between points in sup/sub", result);
|
|
||||||
result
|
self.scc_values.contains_points(sup_region_scc, sub_region_scc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Once regions have been propagated, this method is used to see
|
/// Once regions have been propagated, this method is used to see
|
||||||
@ -1971,7 +1965,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Finds some region R such that `fr1: R` and `R` is live at `elem`.
|
/// Finds some region R such that `fr1: R` and `R` is live at `elem`.
|
||||||
#[instrument(skip(self), level = "trace")]
|
#[instrument(skip(self), level = "trace", ret)]
|
||||||
pub(crate) fn find_sub_region_live_at(&self, fr1: RegionVid, elem: Location) -> RegionVid {
|
pub(crate) fn find_sub_region_live_at(&self, fr1: RegionVid, elem: Location) -> RegionVid {
|
||||||
trace!(scc = ?self.constraint_sccs.scc(fr1));
|
trace!(scc = ?self.constraint_sccs.scc(fr1));
|
||||||
trace!(universe = ?self.scc_universes[self.constraint_sccs.scc(fr1)]);
|
trace!(universe = ?self.scc_universes[self.constraint_sccs.scc(fr1)]);
|
||||||
|
@ -60,7 +60,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||||||
/// Calling `universal_upper_bound` for such a region gives `fr_fn_body`,
|
/// Calling `universal_upper_bound` for such a region gives `fr_fn_body`,
|
||||||
/// which has no `external_name` in which case we use `'empty` as the
|
/// which has no `external_name` in which case we use `'empty` as the
|
||||||
/// region to pass to `infer_opaque_definition_from_instantiation`.
|
/// region to pass to `infer_opaque_definition_from_instantiation`.
|
||||||
#[instrument(level = "debug", skip(self, infcx))]
|
#[instrument(level = "debug", skip(self, infcx), ret)]
|
||||||
pub(crate) fn infer_opaque_types(
|
pub(crate) fn infer_opaque_types(
|
||||||
&self,
|
&self,
|
||||||
infcx: &InferCtxt<'_, 'tcx>,
|
infcx: &InferCtxt<'_, 'tcx>,
|
||||||
|
@ -768,10 +768,9 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
|
|||||||
mir_def_id: LocalDefId,
|
mir_def_id: LocalDefId,
|
||||||
indices: &mut UniversalRegionIndices<'tcx>,
|
indices: &mut UniversalRegionIndices<'tcx>,
|
||||||
) {
|
) {
|
||||||
debug!("replace_late_bound_regions_with_nll_infer_vars(mir_def_id={:?})", mir_def_id);
|
|
||||||
let typeck_root_def_id = self.tcx.typeck_root_def_id(mir_def_id.to_def_id());
|
let typeck_root_def_id = self.tcx.typeck_root_def_id(mir_def_id.to_def_id());
|
||||||
for_each_late_bound_region_defined_on(self.tcx, typeck_root_def_id, |r| {
|
for_each_late_bound_region_defined_on(self.tcx, typeck_root_def_id, |r| {
|
||||||
debug!("replace_late_bound_regions_with_nll_infer_vars: r={:?}", r);
|
debug!(?r);
|
||||||
if !indices.indices.contains_key(&r) {
|
if !indices.indices.contains_key(&r) {
|
||||||
let region_vid = self.next_nll_region_var(FR);
|
let region_vid = self.next_nll_region_var(FR);
|
||||||
debug!(?region_vid);
|
debug!(?region_vid);
|
||||||
|
@ -197,7 +197,7 @@ pub(super) fn op_to_const<'tcx>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(tcx), level = "debug")]
|
#[instrument(skip(tcx), level = "debug", ret)]
|
||||||
pub(crate) fn turn_into_const_value<'tcx>(
|
pub(crate) fn turn_into_const_value<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
constant: ConstAlloc<'tcx>,
|
constant: ConstAlloc<'tcx>,
|
||||||
@ -224,10 +224,7 @@ pub(crate) fn turn_into_const_value<'tcx>(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Turn this into a proper constant.
|
// Turn this into a proper constant.
|
||||||
let const_val = op_to_const(&ecx, &mplace.into());
|
op_to_const(&ecx, &mplace.into())
|
||||||
debug!(?const_val);
|
|
||||||
|
|
||||||
const_val
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(tcx), level = "debug")]
|
#[instrument(skip(tcx), level = "debug")]
|
||||||
|
@ -204,7 +204,7 @@ fn get_info_on_unsized_field<'tcx>(
|
|||||||
(unsized_inner_ty, num_elems)
|
(unsized_inner_ty, num_elems)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(ecx), level = "debug")]
|
#[instrument(skip(ecx), level = "debug", ret)]
|
||||||
fn create_pointee_place<'tcx>(
|
fn create_pointee_place<'tcx>(
|
||||||
ecx: &mut CompileTimeEvalContext<'tcx, 'tcx>,
|
ecx: &mut CompileTimeEvalContext<'tcx, 'tcx>,
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
@ -237,14 +237,11 @@ fn create_pointee_place<'tcx>(
|
|||||||
let ptr = ecx.allocate_ptr(size, align, MemoryKind::Stack).unwrap();
|
let ptr = ecx.allocate_ptr(size, align, MemoryKind::Stack).unwrap();
|
||||||
debug!(?ptr);
|
debug!(?ptr);
|
||||||
|
|
||||||
let place = MPlaceTy::from_aligned_ptr_with_meta(
|
MPlaceTy::from_aligned_ptr_with_meta(
|
||||||
ptr.into(),
|
ptr.into(),
|
||||||
layout,
|
layout,
|
||||||
MemPlaceMeta::Meta(Scalar::from_machine_usize(num_elems as u64, &tcx)),
|
MemPlaceMeta::Meta(Scalar::from_machine_usize(num_elems as u64, &tcx)),
|
||||||
);
|
)
|
||||||
debug!(?place);
|
|
||||||
|
|
||||||
place
|
|
||||||
} else {
|
} else {
|
||||||
create_mplace_from_layout(ecx, ty)
|
create_mplace_from_layout(ecx, ty)
|
||||||
}
|
}
|
||||||
@ -253,7 +250,7 @@ fn create_pointee_place<'tcx>(
|
|||||||
/// Converts a `ValTree` to a `ConstValue`, which is needed after mir
|
/// Converts a `ValTree` to a `ConstValue`, which is needed after mir
|
||||||
/// construction has finished.
|
/// construction has finished.
|
||||||
// FIXME Merge `valtree_to_const_value` and `valtree_into_mplace` into one function
|
// FIXME Merge `valtree_to_const_value` and `valtree_into_mplace` into one function
|
||||||
#[instrument(skip(tcx), level = "debug")]
|
#[instrument(skip(tcx), level = "debug", ret)]
|
||||||
pub fn valtree_to_const_value<'tcx>(
|
pub fn valtree_to_const_value<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
param_env_ty: ty::ParamEnvAnd<'tcx, Ty<'tcx>>,
|
param_env_ty: ty::ParamEnvAnd<'tcx, Ty<'tcx>>,
|
||||||
@ -294,7 +291,7 @@ pub fn valtree_to_const_value<'tcx>(
|
|||||||
dump_place(&ecx, place.into());
|
dump_place(&ecx, place.into());
|
||||||
intern_const_alloc_recursive(&mut ecx, InternKind::Constant, &place).unwrap();
|
intern_const_alloc_recursive(&mut ecx, InternKind::Constant, &place).unwrap();
|
||||||
|
|
||||||
let const_val = match ty.kind() {
|
match ty.kind() {
|
||||||
ty::Ref(_, _, _) => {
|
ty::Ref(_, _, _) => {
|
||||||
let ref_place = place.to_ref(&tcx);
|
let ref_place = place.to_ref(&tcx);
|
||||||
let imm =
|
let imm =
|
||||||
@ -303,10 +300,7 @@ pub fn valtree_to_const_value<'tcx>(
|
|||||||
op_to_const(&ecx, &imm.into())
|
op_to_const(&ecx, &imm.into())
|
||||||
}
|
}
|
||||||
_ => op_to_const(&ecx, &place.into()),
|
_ => op_to_const(&ecx, &place.into()),
|
||||||
};
|
}
|
||||||
debug!(?const_val);
|
|
||||||
|
|
||||||
const_val
|
|
||||||
}
|
}
|
||||||
ty::Never
|
ty::Never
|
||||||
| ty::Error(_)
|
| ty::Error(_)
|
||||||
|
@ -7,7 +7,7 @@ edition = "2021"
|
|||||||
crate-type = ["dylib"]
|
crate-type = ["dylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tracing = { version = "0.1.28" }
|
tracing = { version = "0.1.35" }
|
||||||
serde_json = "1.0.59"
|
serde_json = "1.0.59"
|
||||||
rustc_log = { path = "../rustc_log" }
|
rustc_log = { path = "../rustc_log" }
|
||||||
rustc_middle = { path = "../rustc_middle" }
|
rustc_middle = { path = "../rustc_middle" }
|
||||||
|
@ -391,7 +391,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
|
|||||||
/// Preconditions:
|
/// Preconditions:
|
||||||
///
|
///
|
||||||
/// - `for_vid` is a "root vid"
|
/// - `for_vid` is a "root vid"
|
||||||
#[instrument(skip(self), level = "trace")]
|
#[instrument(skip(self), level = "trace", ret)]
|
||||||
fn generalize(
|
fn generalize(
|
||||||
&self,
|
&self,
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
@ -435,15 +435,8 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
|
|||||||
cache: SsoHashMap::new(),
|
cache: SsoHashMap::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let ty = match generalize.relate(ty, ty) {
|
let ty = generalize.relate(ty, ty)?;
|
||||||
Ok(ty) => ty,
|
|
||||||
Err(e) => {
|
|
||||||
debug!(?e, "failure");
|
|
||||||
return Err(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let needs_wf = generalize.needs_wf;
|
let needs_wf = generalize.needs_wf;
|
||||||
trace!(?ty, ?needs_wf, "success");
|
|
||||||
Ok(Generalization { ty, needs_wf })
|
Ok(Generalization { ty, needs_wf })
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,6 +492,7 @@ struct Generalizer<'cx, 'tcx> {
|
|||||||
/// Result from a generalization operation. This includes
|
/// Result from a generalization operation. This includes
|
||||||
/// not only the generalized type, but also a bool flag
|
/// not only the generalized type, but also a bool flag
|
||||||
/// indicating whether further WF checks are needed.
|
/// indicating whether further WF checks are needed.
|
||||||
|
#[derive(Debug)]
|
||||||
struct Generalization<'tcx> {
|
struct Generalization<'tcx> {
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
|
|
||||||
@ -856,10 +850,9 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
|
|||||||
Ok(a.rebind(self.relate(a.skip_binder(), b.skip_binder())?))
|
Ok(a.rebind(self.relate(a.skip_binder(), b.skip_binder())?))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self), ret)]
|
||||||
fn tys(&mut self, t: Ty<'tcx>, _t: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
|
fn tys(&mut self, t: Ty<'tcx>, _t: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
|
||||||
debug_assert_eq!(t, _t);
|
debug_assert_eq!(t, _t);
|
||||||
debug!("ConstInferUnifier: t={:?}", t);
|
|
||||||
|
|
||||||
match t.kind() {
|
match t.kind() {
|
||||||
&ty::Infer(ty::TyVar(vid)) => {
|
&ty::Infer(ty::TyVar(vid)) => {
|
||||||
@ -883,12 +876,7 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
|
|||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.type_variables()
|
.type_variables()
|
||||||
.new_var(self.for_universe, origin);
|
.new_var(self.for_universe, origin);
|
||||||
let u = self.tcx().mk_ty_var(new_var_id);
|
Ok(self.tcx().mk_ty_var(new_var_id))
|
||||||
debug!(
|
|
||||||
"ConstInferUnifier: replacing original vid={:?} with new={:?}",
|
|
||||||
vid, u
|
|
||||||
);
|
|
||||||
Ok(u)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -939,7 +927,6 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
|
|||||||
_c: ty::Const<'tcx>,
|
_c: ty::Const<'tcx>,
|
||||||
) -> RelateResult<'tcx, ty::Const<'tcx>> {
|
) -> RelateResult<'tcx, ty::Const<'tcx>> {
|
||||||
debug_assert_eq!(c, _c);
|
debug_assert_eq!(c, _c);
|
||||||
debug!("ConstInferUnifier: c={:?}", c);
|
|
||||||
|
|
||||||
match c.kind() {
|
match c.kind() {
|
||||||
ty::ConstKind::Infer(InferConst::Var(vid)) => {
|
ty::ConstKind::Infer(InferConst::Var(vid)) => {
|
||||||
|
@ -69,7 +69,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||||||
/// For more details visit the relevant sections of the [rustc dev guide].
|
/// For more details visit the relevant sections of the [rustc dev guide].
|
||||||
///
|
///
|
||||||
/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/traits/hrtb.html
|
/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/traits/hrtb.html
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self), ret)]
|
||||||
pub fn replace_bound_vars_with_placeholders<T>(&self, binder: ty::Binder<'tcx, T>) -> T
|
pub fn replace_bound_vars_with_placeholders<T>(&self, binder: ty::Binder<'tcx, T>) -> T
|
||||||
where
|
where
|
||||||
T: TypeFoldable<'tcx> + Copy,
|
T: TypeFoldable<'tcx> + Copy,
|
||||||
@ -104,9 +104,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = self.tcx.replace_bound_vars_uncached(binder, delegate);
|
debug!(?next_universe);
|
||||||
debug!(?next_universe, ?result);
|
self.tcx.replace_bound_vars_uncached(binder, delegate)
|
||||||
result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [RegionConstraintCollector::leak_check][1].
|
/// See [RegionConstraintCollector::leak_check][1].
|
||||||
|
@ -333,9 +333,9 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||||||
///
|
///
|
||||||
/// Neither `a` nor `b` may be an inference variable (hence the
|
/// Neither `a` nor `b` may be an inference variable (hence the
|
||||||
/// term "concrete regions").
|
/// term "concrete regions").
|
||||||
#[instrument(level = "trace", skip(self))]
|
#[instrument(level = "trace", skip(self), ret)]
|
||||||
fn lub_concrete_regions(&self, a: Region<'tcx>, b: Region<'tcx>) -> Region<'tcx> {
|
fn lub_concrete_regions(&self, a: Region<'tcx>, b: Region<'tcx>) -> Region<'tcx> {
|
||||||
let r = match (*a, *b) {
|
match (*a, *b) {
|
||||||
(ReLateBound(..), _) | (_, ReLateBound(..)) | (ReErased, _) | (_, ReErased) => {
|
(ReLateBound(..), _) | (_, ReLateBound(..)) | (ReErased, _) | (_, ReErased) => {
|
||||||
bug!("cannot relate region: LUB({:?}, {:?})", a, b);
|
bug!("cannot relate region: LUB({:?}, {:?})", a, b);
|
||||||
}
|
}
|
||||||
@ -399,11 +399,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
|||||||
self.tcx().lifetimes.re_static
|
self.tcx().lifetimes.re_static
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
debug!("lub_concrete_regions({:?}, {:?}) = {:?}", a, b, r);
|
|
||||||
|
|
||||||
r
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// After expansion is complete, go and check upper bounds (i.e.,
|
/// After expansion is complete, go and check upper bounds (i.e.,
|
||||||
|
@ -542,7 +542,7 @@ where
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(self, info), level = "trace")]
|
#[instrument(skip(self, info), level = "trace", ret)]
|
||||||
fn relate_with_variance<T: Relate<'tcx>>(
|
fn relate_with_variance<T: Relate<'tcx>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
variance: ty::Variance,
|
variance: ty::Variance,
|
||||||
@ -560,8 +560,6 @@ where
|
|||||||
|
|
||||||
self.ambient_variance = old_ambient_variance;
|
self.ambient_variance = old_ambient_variance;
|
||||||
|
|
||||||
debug!(?r);
|
|
||||||
|
|
||||||
Ok(r)
|
Ok(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(self), level = "trace")]
|
#[instrument(skip(self), level = "trace", ret)]
|
||||||
pub fn opaque_type_origin(&self, def_id: LocalDefId, span: Span) -> Option<OpaqueTyOrigin> {
|
pub fn opaque_type_origin(&self, def_id: LocalDefId, span: Span) -> Option<OpaqueTyOrigin> {
|
||||||
let opaque_hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id);
|
let opaque_hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id);
|
||||||
let parent_def_id = match self.defining_use_anchor {
|
let parent_def_id = match self.defining_use_anchor {
|
||||||
@ -421,16 +421,14 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||||||
in_definition_scope.then_some(*origin)
|
in_definition_scope.then_some(*origin)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(self), level = "trace")]
|
#[instrument(skip(self), level = "trace", ret)]
|
||||||
fn opaque_ty_origin_unchecked(&self, def_id: LocalDefId, span: Span) -> OpaqueTyOrigin {
|
fn opaque_ty_origin_unchecked(&self, def_id: LocalDefId, span: Span) -> OpaqueTyOrigin {
|
||||||
let origin = match self.tcx.hir().expect_item(def_id).kind {
|
match self.tcx.hir().expect_item(def_id).kind {
|
||||||
hir::ItemKind::OpaqueTy(hir::OpaqueTy { origin, .. }) => origin,
|
hir::ItemKind::OpaqueTy(hir::OpaqueTy { origin, .. }) => origin,
|
||||||
ref itemkind => {
|
ref itemkind => {
|
||||||
span_bug!(span, "weird opaque type: {:?}, {:#?}", def_id, itemkind)
|
span_bug!(span, "weird opaque type: {:?}, {:#?}", def_id, itemkind)
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
trace!(?origin);
|
|
||||||
origin
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ impl<'tcx> OpaqueTypeStorage<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "debug")]
|
#[instrument(level = "debug", ret)]
|
||||||
pub fn take_opaque_types(&mut self) -> OpaqueTypeMap<'tcx> {
|
pub fn take_opaque_types(&mut self) -> OpaqueTypeMap<'tcx> {
|
||||||
std::mem::take(&mut self.opaque_types)
|
std::mem::take(&mut self.opaque_types)
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ pub mod verify;
|
|||||||
use rustc_middle::traits::query::OutlivesBound;
|
use rustc_middle::traits::query::OutlivesBound;
|
||||||
use rustc_middle::ty;
|
use rustc_middle::ty;
|
||||||
|
|
||||||
#[instrument(level = "debug", skip(param_env))]
|
#[instrument(level = "debug", skip(param_env), ret)]
|
||||||
pub fn explicit_outlives_bounds<'tcx>(
|
pub fn explicit_outlives_bounds<'tcx>(
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
) -> impl Iterator<Item = OutlivesBound<'tcx>> + 'tcx {
|
) -> impl Iterator<Item = OutlivesBound<'tcx>> + 'tcx {
|
||||||
|
@ -2267,7 +2267,7 @@ impl<'tcx> ConstantKind<'tcx> {
|
|||||||
Self::from_opt_const_arg_anon_const(tcx, ty::WithOptConstParam::unknown(def_id), param_env)
|
Self::from_opt_const_arg_anon_const(tcx, ty::WithOptConstParam::unknown(def_id), param_env)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(tcx), level = "debug")]
|
#[instrument(skip(tcx), level = "debug", ret)]
|
||||||
pub fn from_inline_const(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Self {
|
pub fn from_inline_const(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Self {
|
||||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
||||||
let body_id = match tcx.hir().get(hir_id) {
|
let body_id = match tcx.hir().get(hir_id) {
|
||||||
@ -2305,21 +2305,18 @@ impl<'tcx> ConstantKind<'tcx> {
|
|||||||
let substs =
|
let substs =
|
||||||
ty::InlineConstSubsts::new(tcx, ty::InlineConstSubstsParts { parent_substs, ty })
|
ty::InlineConstSubsts::new(tcx, ty::InlineConstSubstsParts { parent_substs, ty })
|
||||||
.substs;
|
.substs;
|
||||||
let uneval_const = tcx.mk_const(ty::ConstS {
|
debug_assert!(!substs.has_free_regions());
|
||||||
|
Self::Ty(tcx.mk_const(ty::ConstS {
|
||||||
kind: ty::ConstKind::Unevaluated(ty::Unevaluated {
|
kind: ty::ConstKind::Unevaluated(ty::Unevaluated {
|
||||||
def: ty::WithOptConstParam::unknown(def_id).to_global(),
|
def: ty::WithOptConstParam::unknown(def_id).to_global(),
|
||||||
substs,
|
substs,
|
||||||
promoted: None,
|
promoted: None,
|
||||||
}),
|
}),
|
||||||
ty,
|
ty,
|
||||||
});
|
}))
|
||||||
debug!(?uneval_const);
|
|
||||||
debug_assert!(!uneval_const.has_free_regions());
|
|
||||||
|
|
||||||
Self::Ty(uneval_const)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(tcx), level = "debug")]
|
#[instrument(skip(tcx), level = "debug", ret)]
|
||||||
fn from_opt_const_arg_anon_const(
|
fn from_opt_const_arg_anon_const(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
def: ty::WithOptConstParam<LocalDefId>,
|
def: ty::WithOptConstParam<LocalDefId>,
|
||||||
@ -2402,24 +2399,21 @@ impl<'tcx> ConstantKind<'tcx> {
|
|||||||
|
|
||||||
match tcx.const_eval_resolve(param_env, uneval, Some(span)) {
|
match tcx.const_eval_resolve(param_env, uneval, Some(span)) {
|
||||||
Ok(val) => {
|
Ok(val) => {
|
||||||
debug!("evaluated const value: {:?}", val);
|
debug!("evaluated const value");
|
||||||
Self::Val(val, ty)
|
Self::Val(val, ty)
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
debug!("error encountered during evaluation");
|
debug!("error encountered during evaluation");
|
||||||
// Error was handled in `const_eval_resolve`. Here we just create a
|
// Error was handled in `const_eval_resolve`. Here we just create a
|
||||||
// new unevaluated const and error hard later in codegen
|
// new unevaluated const and error hard later in codegen
|
||||||
let ty_const = tcx.mk_const(ty::ConstS {
|
Self::Ty(tcx.mk_const(ty::ConstS {
|
||||||
kind: ty::ConstKind::Unevaluated(ty::Unevaluated {
|
kind: ty::ConstKind::Unevaluated(ty::Unevaluated {
|
||||||
def: def.to_global(),
|
def: def.to_global(),
|
||||||
substs: InternalSubsts::identity_for_item(tcx, def.did.to_def_id()),
|
substs: InternalSubsts::identity_for_item(tcx, def.did.to_def_id()),
|
||||||
promoted: None,
|
promoted: None,
|
||||||
}),
|
}),
|
||||||
ty,
|
ty,
|
||||||
});
|
}))
|
||||||
debug!(?ty_const);
|
|
||||||
|
|
||||||
Self::Ty(ty_const)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,6 @@ impl<'tcx> Const<'tcx> {
|
|||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
def: ty::WithOptConstParam<LocalDefId>,
|
def: ty::WithOptConstParam<LocalDefId>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
debug!("Const::from_anon_const(def={:?})", def);
|
|
||||||
|
|
||||||
let body_id = match tcx.hir().get_by_def_id(def.did) {
|
let body_id = match tcx.hir().get_by_def_id(def.did) {
|
||||||
hir::Node::AnonConst(ac) => ac.body,
|
hir::Node::AnonConst(ac) => ac.body,
|
||||||
_ => span_bug!(
|
_ => span_bug!(
|
||||||
|
@ -353,7 +353,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for RegionFolder<'a, 'tcx> {
|
|||||||
t
|
t
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(self), level = "debug")]
|
#[instrument(skip(self), level = "debug", ret)]
|
||||||
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
|
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
|
||||||
match *r {
|
match *r {
|
||||||
ty::ReLateBound(debruijn, _) if debruijn < self.current_index => {
|
ty::ReLateBound(debruijn, _) if debruijn < self.current_index => {
|
||||||
|
@ -188,13 +188,11 @@ struct NormalizeAfterErasingRegionsFolder<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> NormalizeAfterErasingRegionsFolder<'tcx> {
|
impl<'tcx> NormalizeAfterErasingRegionsFolder<'tcx> {
|
||||||
#[instrument(skip(self), level = "debug")]
|
|
||||||
fn normalize_generic_arg_after_erasing_regions(
|
fn normalize_generic_arg_after_erasing_regions(
|
||||||
&self,
|
&self,
|
||||||
arg: ty::GenericArg<'tcx>,
|
arg: ty::GenericArg<'tcx>,
|
||||||
) -> ty::GenericArg<'tcx> {
|
) -> ty::GenericArg<'tcx> {
|
||||||
let arg = self.param_env.and(arg);
|
let arg = self.param_env.and(arg);
|
||||||
debug!(?arg);
|
|
||||||
|
|
||||||
self.tcx.try_normalize_generic_arg_after_erasing_regions(arg).unwrap_or_else(|_| bug!(
|
self.tcx.try_normalize_generic_arg_after_erasing_regions(arg).unwrap_or_else(|_| bug!(
|
||||||
"Failed to normalize {:?}, maybe try to call `try_normalize_erasing_regions` instead",
|
"Failed to normalize {:?}, maybe try to call `try_normalize_erasing_regions` instead",
|
||||||
|
@ -256,7 +256,6 @@ pub(super) fn trait_impls_of_provider(tcx: TyCtxt<'_>, trait_id: DefId) -> Trait
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Query provider for `incoherent_impls`.
|
// Query provider for `incoherent_impls`.
|
||||||
#[instrument(level = "debug", skip(tcx))]
|
|
||||||
pub(super) fn incoherent_impls_provider(tcx: TyCtxt<'_>, simp: SimplifiedType) -> &[DefId] {
|
pub(super) fn incoherent_impls_provider(tcx: TyCtxt<'_>, simp: SimplifiedType) -> &[DefId] {
|
||||||
let mut impls = Vec::new();
|
let mut impls = Vec::new();
|
||||||
|
|
||||||
|
@ -627,7 +627,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Expands the given impl trait type, stopping if the type is recursive.
|
/// Expands the given impl trait type, stopping if the type is recursive.
|
||||||
#[instrument(skip(self), level = "debug")]
|
#[instrument(skip(self), level = "debug", ret)]
|
||||||
pub fn try_expand_impl_trait_type(
|
pub fn try_expand_impl_trait_type(
|
||||||
self,
|
self,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
@ -644,7 +644,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let expanded_type = visitor.expand_opaque_ty(def_id, substs).unwrap();
|
let expanded_type = visitor.expand_opaque_ty(def_id, substs).unwrap();
|
||||||
trace!(?expanded_type);
|
|
||||||
if visitor.found_recursion { Err(expanded_type) } else { Ok(expanded_type) }
|
if visitor.found_recursion { Err(expanded_type) } else { Ok(expanded_type) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ pub trait TypeVisitable<'tcx>: fmt::Debug + Clone {
|
|||||||
self.has_vars_bound_at_or_above(ty::INNERMOST)
|
self.has_vars_bound_at_or_above(ty::INNERMOST)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "trace")]
|
#[instrument(level = "trace", ret)]
|
||||||
fn has_type_flags(&self, flags: TypeFlags) -> bool {
|
fn has_type_flags(&self, flags: TypeFlags) -> bool {
|
||||||
self.visit_with(&mut HasTypeFlagsVisitor { flags }).break_value() == Some(FoundFlags)
|
self.visit_with(&mut HasTypeFlagsVisitor { flags }).break_value() == Some(FoundFlags)
|
||||||
}
|
}
|
||||||
@ -560,7 +560,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
|
|||||||
type BreakTy = FoundFlags;
|
type BreakTy = FoundFlags;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[instrument(skip(self), level = "trace")]
|
#[instrument(skip(self), level = "trace", ret)]
|
||||||
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||||
let flags = t.flags();
|
let flags = t.flags();
|
||||||
trace!(t.flags=?t.flags());
|
trace!(t.flags=?t.flags());
|
||||||
@ -572,7 +572,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[instrument(skip(self), level = "trace")]
|
#[instrument(skip(self), level = "trace", ret)]
|
||||||
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
|
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||||
let flags = r.type_flags();
|
let flags = r.type_flags();
|
||||||
trace!(r.flags=?flags);
|
trace!(r.flags=?flags);
|
||||||
@ -584,7 +584,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[instrument(level = "trace")]
|
#[instrument(level = "trace", ret)]
|
||||||
fn visit_const(&mut self, c: ty::Const<'tcx>) -> ControlFlow<Self::BreakTy> {
|
fn visit_const(&mut self, c: ty::Const<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||||
let flags = FlagComputation::for_const(c);
|
let flags = FlagComputation::for_const(c);
|
||||||
trace!(r.flags=?flags);
|
trace!(r.flags=?flags);
|
||||||
@ -596,7 +596,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[instrument(level = "trace")]
|
#[instrument(level = "trace", ret)]
|
||||||
fn visit_unevaluated(&mut self, uv: ty::Unevaluated<'tcx>) -> ControlFlow<Self::BreakTy> {
|
fn visit_unevaluated(&mut self, uv: ty::Unevaluated<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||||
let flags = FlagComputation::for_unevaluated_const(uv);
|
let flags = FlagComputation::for_unevaluated_const(uv);
|
||||||
trace!(r.flags=?flags);
|
trace!(r.flags=?flags);
|
||||||
@ -608,7 +608,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[instrument(level = "trace")]
|
#[instrument(level = "trace", ret)]
|
||||||
fn visit_predicate(&mut self, predicate: ty::Predicate<'tcx>) -> ControlFlow<Self::BreakTy> {
|
fn visit_predicate(&mut self, predicate: ty::Predicate<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||||
debug!(
|
debug!(
|
||||||
"HasTypeFlagsVisitor: predicate={:?} predicate.flags={:?} self.flags={:?}",
|
"HasTypeFlagsVisitor: predicate={:?} predicate.flags={:?} self.flags={:?}",
|
||||||
|
@ -19,7 +19,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
|||||||
/// Converts an evaluated constant to a pattern (if possible).
|
/// Converts an evaluated constant to a pattern (if possible).
|
||||||
/// This means aggregate values (like structs and enums) are converted
|
/// This means aggregate values (like structs and enums) are converted
|
||||||
/// to a pattern that matches the value (as if you'd compared via structural equality).
|
/// to a pattern that matches the value (as if you'd compared via structural equality).
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self), ret)]
|
||||||
pub(super) fn const_to_pat(
|
pub(super) fn const_to_pat(
|
||||||
&self,
|
&self,
|
||||||
cv: mir::ConstantKind<'tcx>,
|
cv: mir::ConstantKind<'tcx>,
|
||||||
@ -27,13 +27,10 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
|||||||
span: Span,
|
span: Span,
|
||||||
mir_structural_match_violation: bool,
|
mir_structural_match_violation: bool,
|
||||||
) -> Pat<'tcx> {
|
) -> Pat<'tcx> {
|
||||||
let pat = self.tcx.infer_ctxt().enter(|infcx| {
|
self.tcx.infer_ctxt().enter(|infcx| {
|
||||||
let mut convert = ConstToPat::new(self, id, span, infcx);
|
let mut convert = ConstToPat::new(self, id, span, infcx);
|
||||||
convert.to_pat(cv, mir_structural_match_violation)
|
convert.to_pat(cv, mir_structural_match_violation)
|
||||||
});
|
})
|
||||||
|
|
||||||
debug!(?pat);
|
|
||||||
pat
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -791,7 +791,7 @@ fn lint_non_exhaustive_omitted_patterns<'p, 'tcx>(
|
|||||||
/// `is_under_guard` is used to inform if the pattern has a guard. If it
|
/// `is_under_guard` is used to inform if the pattern has a guard. If it
|
||||||
/// has one it must not be inserted into the matrix. This shouldn't be
|
/// has one it must not be inserted into the matrix. This shouldn't be
|
||||||
/// relied on for soundness.
|
/// relied on for soundness.
|
||||||
#[instrument(level = "debug", skip(cx, matrix, hir_id))]
|
#[instrument(level = "debug", skip(cx, matrix, hir_id), ret)]
|
||||||
fn is_useful<'p, 'tcx>(
|
fn is_useful<'p, 'tcx>(
|
||||||
cx: &MatchCheckCtxt<'p, 'tcx>,
|
cx: &MatchCheckCtxt<'p, 'tcx>,
|
||||||
matrix: &Matrix<'p, 'tcx>,
|
matrix: &Matrix<'p, 'tcx>,
|
||||||
@ -917,7 +917,6 @@ fn is_useful<'p, 'tcx>(
|
|||||||
v.head().set_reachable();
|
v.head().set_reachable();
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!(?ret);
|
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +419,6 @@ fn collect_items_rec<'tcx>(
|
|||||||
// We've been here already, no need to search again.
|
// We've been here already, no need to search again.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
debug!("BEGIN collect_items_rec({})", starting_point.node);
|
|
||||||
|
|
||||||
let mut neighbors = MonoItems { compute_inlining: true, tcx, items: Vec::new() };
|
let mut neighbors = MonoItems { compute_inlining: true, tcx, items: Vec::new() };
|
||||||
let recursion_depth_reset;
|
let recursion_depth_reset;
|
||||||
@ -545,8 +544,6 @@ fn collect_items_rec<'tcx>(
|
|||||||
if let Some((def_id, depth)) = recursion_depth_reset {
|
if let Some((def_id, depth)) = recursion_depth_reset {
|
||||||
recursion_depths.insert(def_id, depth);
|
recursion_depths.insert(def_id, depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("END collect_items_rec({})", starting_point.node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Format instance name that is already known to be too long for rustc.
|
/// Format instance name that is already known to be too long for rustc.
|
||||||
@ -1148,23 +1145,18 @@ fn find_vtable_types_for_unsizing<'tcx>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(tcx), level = "debug")]
|
#[instrument(skip(tcx), level = "debug", ret)]
|
||||||
fn create_fn_mono_item<'tcx>(
|
fn create_fn_mono_item<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
instance: Instance<'tcx>,
|
instance: Instance<'tcx>,
|
||||||
source: Span,
|
source: Span,
|
||||||
) -> Spanned<MonoItem<'tcx>> {
|
) -> Spanned<MonoItem<'tcx>> {
|
||||||
debug!("create_fn_mono_item(instance={})", instance);
|
|
||||||
|
|
||||||
let def_id = instance.def_id();
|
let def_id = instance.def_id();
|
||||||
if tcx.sess.opts.unstable_opts.profile_closures && def_id.is_local() && tcx.is_closure(def_id) {
|
if tcx.sess.opts.unstable_opts.profile_closures && def_id.is_local() && tcx.is_closure(def_id) {
|
||||||
crate::util::dump_closure_profile(tcx, instance);
|
crate::util::dump_closure_profile(tcx, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
let respanned = respan(source, MonoItem::Fn(instance.polymorphize(tcx)));
|
respan(source, MonoItem::Fn(instance.polymorphize(tcx)))
|
||||||
debug!(?respanned);
|
|
||||||
|
|
||||||
respanned
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a `MonoItem` for each method that is referenced by the vtable for
|
/// Creates a `MonoItem` for each method that is referenced by the vtable for
|
||||||
@ -1309,7 +1301,7 @@ impl<'v> RootCollector<'_, 'v> {
|
|||||||
#[instrument(skip(self), level = "debug")]
|
#[instrument(skip(self), level = "debug")]
|
||||||
fn push_if_root(&mut self, def_id: LocalDefId) {
|
fn push_if_root(&mut self, def_id: LocalDefId) {
|
||||||
if self.is_root(def_id) {
|
if self.is_root(def_id) {
|
||||||
debug!("RootCollector::push_if_root: found root def_id={:?}", def_id);
|
debug!("found root");
|
||||||
|
|
||||||
let instance = Instance::mono(self.tcx, def_id.to_def_id());
|
let instance = Instance::mono(self.tcx, def_id.to_def_id());
|
||||||
self.output.push(create_fn_mono_item(self.tcx, instance, DUMMY_SP));
|
self.output.push(create_fn_mono_item(self.tcx, instance, DUMMY_SP));
|
||||||
|
@ -33,7 +33,6 @@ pub fn provide(providers: &mut Providers) {
|
|||||||
///
|
///
|
||||||
/// Returns a bitset where bits representing unused parameters are set (`is_empty` indicates all
|
/// Returns a bitset where bits representing unused parameters are set (`is_empty` indicates all
|
||||||
/// parameters are used).
|
/// parameters are used).
|
||||||
#[instrument(level = "debug", skip(tcx))]
|
|
||||||
fn unused_generic_params<'tcx>(
|
fn unused_generic_params<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
instance: ty::InstanceDef<'tcx>,
|
instance: ty::InstanceDef<'tcx>,
|
||||||
|
@ -555,7 +555,7 @@ macro_rules! define_queries_struct {
|
|||||||
|
|
||||||
$($(#[$attr])*
|
$($(#[$attr])*
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[tracing::instrument(level = "trace", skip(self, tcx))]
|
#[tracing::instrument(level = "trace", skip(self, tcx), ret)]
|
||||||
fn $name(
|
fn $name(
|
||||||
&'tcx self,
|
&'tcx self,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
|
@ -1059,13 +1059,13 @@ impl FilePathMapping {
|
|||||||
|
|
||||||
return remap_path_prefix(&self.mapping, path);
|
return remap_path_prefix(&self.mapping, path);
|
||||||
|
|
||||||
#[instrument(level = "debug", skip(mapping))]
|
#[instrument(level = "debug", skip(mapping), ret)]
|
||||||
fn remap_path_prefix(mapping: &[(PathBuf, PathBuf)], path: PathBuf) -> (PathBuf, bool) {
|
fn remap_path_prefix(mapping: &[(PathBuf, PathBuf)], path: PathBuf) -> (PathBuf, bool) {
|
||||||
// NOTE: We are iterating over the mapping entries from last to first
|
// NOTE: We are iterating over the mapping entries from last to first
|
||||||
// because entries specified later on the command line should
|
// because entries specified later on the command line should
|
||||||
// take precedence.
|
// take precedence.
|
||||||
for &(ref from, ref to) in mapping.iter().rev() {
|
for &(ref from, ref to) in mapping.iter().rev() {
|
||||||
debug!("Trying to apply {:?} => {:?}", from, to);
|
debug!("Trying to apply {from:?} => {to:?}");
|
||||||
|
|
||||||
if let Ok(rest) = path.strip_prefix(from) {
|
if let Ok(rest) = path.strip_prefix(from) {
|
||||||
let remapped = if rest.as_os_str().is_empty() {
|
let remapped = if rest.as_os_str().is_empty() {
|
||||||
@ -1079,15 +1079,15 @@ impl FilePathMapping {
|
|||||||
} else {
|
} else {
|
||||||
to.join(rest)
|
to.join(rest)
|
||||||
};
|
};
|
||||||
debug!("Match - remapped {:?} => {:?}", path, remapped);
|
debug!("Match - remapped");
|
||||||
|
|
||||||
return (remapped, true);
|
return (remapped, true);
|
||||||
} else {
|
} else {
|
||||||
debug!("No match - prefix {:?} does not match {:?}", from, path);
|
debug!("No match - prefix {from:?} does not match");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("Path {:?} was not remapped", path);
|
debug!("not remapped");
|
||||||
(path, false)
|
(path, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ use rustc_middle::ty::{self, TyCtxt};
|
|||||||
/// obligations *could be* resolved if we wanted to.
|
/// obligations *could be* resolved if we wanted to.
|
||||||
///
|
///
|
||||||
/// This also expects that `trait_ref` is fully normalized.
|
/// This also expects that `trait_ref` is fully normalized.
|
||||||
#[instrument(level = "debug", skip(tcx))]
|
|
||||||
pub fn codegen_fulfill_obligation<'tcx>(
|
pub fn codegen_fulfill_obligation<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
(param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>),
|
(param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>),
|
||||||
@ -74,7 +73,6 @@ pub fn codegen_fulfill_obligation<'tcx>(
|
|||||||
// (ouz-a) This is required for `type-alias-impl-trait/assoc-projection-ice.rs` to pass
|
// (ouz-a) This is required for `type-alias-impl-trait/assoc-projection-ice.rs` to pass
|
||||||
let _ = infcx.inner.borrow_mut().opaque_type_storage.take_opaque_types();
|
let _ = infcx.inner.borrow_mut().opaque_type_storage.take_opaque_types();
|
||||||
|
|
||||||
debug!("Cache miss: {trait_ref:?} => {impl_source:?}");
|
|
||||||
Ok(&*tcx.arena.alloc(impl_source))
|
Ok(&*tcx.arena.alloc(impl_source))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use super::SelectionCandidate::{self, *};
|
|||||||
use super::{EvaluatedCandidate, SelectionCandidateSet, SelectionContext, TraitObligationStack};
|
use super::{EvaluatedCandidate, SelectionCandidateSet, SelectionContext, TraitObligationStack};
|
||||||
|
|
||||||
impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self), ret)]
|
||||||
pub(super) fn candidate_from_obligation<'o>(
|
pub(super) fn candidate_from_obligation<'o>(
|
||||||
&mut self,
|
&mut self,
|
||||||
stack: &TraitObligationStack<'o, 'tcx>,
|
stack: &TraitObligationStack<'o, 'tcx>,
|
||||||
@ -48,7 +48,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
if let Some(c) =
|
if let Some(c) =
|
||||||
self.check_candidate_cache(stack.obligation.param_env, cache_fresh_trait_pred)
|
self.check_candidate_cache(stack.obligation.param_env, cache_fresh_trait_pred)
|
||||||
{
|
{
|
||||||
debug!(candidate = ?c, "CACHE HIT");
|
debug!("CACHE HIT");
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
let (candidate, dep_node) =
|
let (candidate, dep_node) =
|
||||||
self.in_task(|this| this.candidate_from_obligation_no_cache(stack));
|
self.in_task(|this| this.candidate_from_obligation_no_cache(stack));
|
||||||
|
|
||||||
debug!(?candidate, "CACHE MISS");
|
debug!("CACHE MISS");
|
||||||
self.insert_candidate_cache(
|
self.insert_candidate_cache(
|
||||||
stack.obligation.param_env,
|
stack.obligation.param_env,
|
||||||
cache_fresh_trait_pred,
|
cache_fresh_trait_pred,
|
||||||
|
@ -295,7 +295,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
|
|
||||||
/// Attempts to satisfy the obligation. If successful, this will affect the surrounding
|
/// Attempts to satisfy the obligation. If successful, this will affect the surrounding
|
||||||
/// type environment by performing unification.
|
/// type environment by performing unification.
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self), ret)]
|
||||||
pub fn select(
|
pub fn select(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &TraitObligation<'tcx>,
|
||||||
@ -325,10 +325,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
Err(SelectionError::Overflow(OverflowError::Canonical))
|
Err(SelectionError::Overflow(OverflowError::Canonical))
|
||||||
}
|
}
|
||||||
Err(e) => Err(e),
|
Err(e) => Err(e),
|
||||||
Ok(candidate) => {
|
Ok(candidate) => Ok(Some(candidate)),
|
||||||
debug!(?candidate, "confirmed");
|
|
||||||
Ok(Some(candidate))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,6 +432,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
level = "debug",
|
level = "debug",
|
||||||
skip(self, previous_stack),
|
skip(self, previous_stack),
|
||||||
fields(previous_stack = ?previous_stack.head())
|
fields(previous_stack = ?previous_stack.head())
|
||||||
|
ret,
|
||||||
)]
|
)]
|
||||||
fn evaluate_predicate_recursively<'o>(
|
fn evaluate_predicate_recursively<'o>(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -450,7 +448,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
None => self.check_recursion_limit(&obligation, &obligation)?,
|
None => self.check_recursion_limit(&obligation, &obligation)?,
|
||||||
}
|
}
|
||||||
|
|
||||||
let result = ensure_sufficient_stack(|| {
|
ensure_sufficient_stack(|| {
|
||||||
let bound_predicate = obligation.predicate.kind();
|
let bound_predicate = obligation.predicate.kind();
|
||||||
match bound_predicate.skip_binder() {
|
match bound_predicate.skip_binder() {
|
||||||
ty::PredicateKind::Trait(t) => {
|
ty::PredicateKind::Trait(t) => {
|
||||||
@ -760,14 +758,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
bug!("TypeWellFormedFromEnv is only used for chalk")
|
bug!("TypeWellFormedFromEnv is only used for chalk")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
debug!("finished: {:?} from {:?}", result, obligation);
|
|
||||||
|
|
||||||
result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(self, previous_stack), level = "debug")]
|
#[instrument(skip(self, previous_stack), level = "debug", ret)]
|
||||||
fn evaluate_trait_predicate_recursively<'o>(
|
fn evaluate_trait_predicate_recursively<'o>(
|
||||||
&mut self,
|
&mut self,
|
||||||
previous_stack: TraitObligationStackList<'o, 'tcx>,
|
previous_stack: TraitObligationStackList<'o, 'tcx>,
|
||||||
@ -798,12 +792,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
// If a trait predicate is in the (local or global) evaluation cache,
|
// If a trait predicate is in the (local or global) evaluation cache,
|
||||||
// then we know it holds without cycles.
|
// then we know it holds without cycles.
|
||||||
if let Some(result) = self.check_evaluation_cache(param_env, fresh_trait_pred) {
|
if let Some(result) = self.check_evaluation_cache(param_env, fresh_trait_pred) {
|
||||||
debug!(?result, "CACHE HIT");
|
debug!("CACHE HIT");
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(result) = stack.cache().get_provisional(fresh_trait_pred) {
|
if let Some(result) = stack.cache().get_provisional(fresh_trait_pred) {
|
||||||
debug!(?result, "PROVISIONAL CACHE HIT");
|
debug!("PROVISIONAL CACHE HIT");
|
||||||
stack.update_reached_depth(result.reached_depth);
|
stack.update_reached_depth(result.reached_depth);
|
||||||
return Ok(result.result);
|
return Ok(result.result);
|
||||||
}
|
}
|
||||||
@ -826,11 +820,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
|
|
||||||
let reached_depth = stack.reached_depth.get();
|
let reached_depth = stack.reached_depth.get();
|
||||||
if reached_depth >= stack.depth {
|
if reached_depth >= stack.depth {
|
||||||
debug!(?result, "CACHE MISS");
|
debug!("CACHE MISS");
|
||||||
self.insert_evaluation_cache(param_env, fresh_trait_pred, dep_node, result);
|
self.insert_evaluation_cache(param_env, fresh_trait_pred, dep_node, result);
|
||||||
stack.cache().on_completion(stack.dfn);
|
stack.cache().on_completion(stack.dfn);
|
||||||
} else {
|
} else {
|
||||||
debug!(?result, "PROVISIONAL");
|
debug!("PROVISIONAL");
|
||||||
debug!(
|
debug!(
|
||||||
"caching provisionally because {:?} \
|
"caching provisionally because {:?} \
|
||||||
is a cycle participant (at depth {}, reached depth {})",
|
is a cycle participant (at depth {}, reached depth {})",
|
||||||
@ -1023,7 +1017,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
#[instrument(
|
#[instrument(
|
||||||
level = "debug",
|
level = "debug",
|
||||||
skip(self, stack),
|
skip(self, stack),
|
||||||
fields(depth = stack.obligation.recursion_depth)
|
fields(depth = stack.obligation.recursion_depth),
|
||||||
|
ret
|
||||||
)]
|
)]
|
||||||
fn evaluate_candidate<'o>(
|
fn evaluate_candidate<'o>(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -1056,7 +1051,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
result = result.max(EvaluatedToOkModuloRegions);
|
result = result.max(EvaluatedToOkModuloRegions);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!(?result);
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1405,7 +1399,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
/// a projection, look at the bounds of `T::Bar`, see if we can find a
|
/// a projection, look at the bounds of `T::Bar`, see if we can find a
|
||||||
/// `Baz` bound. We return indexes into the list returned by
|
/// `Baz` bound. We return indexes into the list returned by
|
||||||
/// `tcx.item_bounds` for any applicable bounds.
|
/// `tcx.item_bounds` for any applicable bounds.
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self), ret)]
|
||||||
fn match_projection_obligation_against_definition_bounds(
|
fn match_projection_obligation_against_definition_bounds(
|
||||||
&mut self,
|
&mut self,
|
||||||
obligation: &TraitObligation<'tcx>,
|
obligation: &TraitObligation<'tcx>,
|
||||||
@ -1435,7 +1429,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
// unnecessary ambiguity.
|
// unnecessary ambiguity.
|
||||||
let mut distinct_normalized_bounds = FxHashSet::default();
|
let mut distinct_normalized_bounds = FxHashSet::default();
|
||||||
|
|
||||||
let matching_bounds = bounds
|
bounds
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter_map(|(idx, bound)| {
|
.filter_map(|(idx, bound)| {
|
||||||
@ -1462,10 +1456,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
}
|
}
|
||||||
None
|
None
|
||||||
})
|
})
|
||||||
.collect();
|
.collect()
|
||||||
|
|
||||||
debug!(?matching_bounds);
|
|
||||||
matching_bounds
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Equates the trait in `obligation` with trait bound. If the two traits
|
/// Equates the trait in `obligation` with trait bound. If the two traits
|
||||||
@ -2153,7 +2144,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self), ret)]
|
||||||
fn match_impl(
|
fn match_impl(
|
||||||
&mut self,
|
&mut self,
|
||||||
impl_def_id: DefId,
|
impl_def_id: DefId,
|
||||||
@ -2194,17 +2185,16 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
.at(&cause, obligation.param_env)
|
.at(&cause, obligation.param_env)
|
||||||
.define_opaque_types(false)
|
.define_opaque_types(false)
|
||||||
.eq(placeholder_obligation_trait_ref, impl_trait_ref)
|
.eq(placeholder_obligation_trait_ref, impl_trait_ref)
|
||||||
.map_err(|e| debug!("match_impl: failed eq_trait_refs due to `{}`", e))?;
|
.map_err(|e| debug!("match_impl: failed eq_trait_refs due to `{e}`"))?;
|
||||||
nested_obligations.extend(obligations);
|
nested_obligations.extend(obligations);
|
||||||
|
|
||||||
if !self.intercrate
|
if !self.intercrate
|
||||||
&& self.tcx().impl_polarity(impl_def_id) == ty::ImplPolarity::Reservation
|
&& self.tcx().impl_polarity(impl_def_id) == ty::ImplPolarity::Reservation
|
||||||
{
|
{
|
||||||
debug!("match_impl: reservation impls only apply in intercrate mode");
|
debug!("reservation impls only apply in intercrate mode");
|
||||||
return Err(());
|
return Err(());
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!(?impl_substs, ?nested_obligations, "match_impl: success");
|
|
||||||
Ok(Normalized { value: impl_substs, obligations: nested_obligations })
|
Ok(Normalized { value: impl_substs, obligations: nested_obligations })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,7 +841,7 @@ pub fn object_region_bounds<'tcx>(
|
|||||||
///
|
///
|
||||||
/// Requires that trait definitions have been processed so that we can
|
/// Requires that trait definitions have been processed so that we can
|
||||||
/// elaborate predicates and walk supertraits.
|
/// elaborate predicates and walk supertraits.
|
||||||
#[instrument(skip(tcx, predicates), level = "debug")]
|
#[instrument(skip(tcx, predicates), level = "debug", ret)]
|
||||||
pub(crate) fn required_region_bounds<'tcx>(
|
pub(crate) fn required_region_bounds<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
erased_self_ty: Ty<'tcx>,
|
erased_self_ty: Ty<'tcx>,
|
||||||
|
@ -104,7 +104,6 @@ fn adt_sized_constraint(tcx: TyCtxt<'_>, def_id: DefId) -> ty::AdtSizedConstrain
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// See `ParamEnv` struct definition for details.
|
/// See `ParamEnv` struct definition for details.
|
||||||
#[instrument(level = "debug", skip(tcx))]
|
|
||||||
fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
|
fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
|
||||||
// The param_env of an impl Trait type is its defining function's param_env
|
// The param_env of an impl Trait type is its defining function's param_env
|
||||||
if let Some(parent) = ty::is_impl_trait_defn(tcx, def_id) {
|
if let Some(parent) = ty::is_impl_trait_defn(tcx, def_id) {
|
||||||
@ -410,7 +409,6 @@ fn asyncness(tcx: TyCtxt<'_>, def_id: DefId) -> hir::IsAsync {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Don't call this directly: use ``tcx.conservative_is_privately_uninhabited`` instead.
|
/// Don't call this directly: use ``tcx.conservative_is_privately_uninhabited`` instead.
|
||||||
#[instrument(level = "debug", skip(tcx))]
|
|
||||||
pub fn conservative_is_privately_uninhabited_raw<'tcx>(
|
pub fn conservative_is_privately_uninhabited_raw<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
param_env_and: ty::ParamEnvAnd<'tcx, Ty<'tcx>>,
|
param_env_and: ty::ParamEnvAnd<'tcx, Ty<'tcx>>,
|
||||||
|
@ -144,7 +144,7 @@ enum ConvertedBindingKind<'a, 'tcx> {
|
|||||||
/// instantiated with some generic arguments providing `'a` explicitly,
|
/// instantiated with some generic arguments providing `'a` explicitly,
|
||||||
/// we taint those arguments with `ExplicitLateBound::Yes` so that we
|
/// we taint those arguments with `ExplicitLateBound::Yes` so that we
|
||||||
/// can provide an appropriate diagnostic later.
|
/// can provide an appropriate diagnostic later.
|
||||||
#[derive(Copy, Clone, PartialEq)]
|
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||||
pub enum ExplicitLateBound {
|
pub enum ExplicitLateBound {
|
||||||
Yes,
|
Yes,
|
||||||
No,
|
No,
|
||||||
@ -167,7 +167,7 @@ pub(crate) enum GenericArgPosition {
|
|||||||
|
|
||||||
/// A marker denoting that the generic arguments that were
|
/// A marker denoting that the generic arguments that were
|
||||||
/// provided did not match the respective generic parameters.
|
/// provided did not match the respective generic parameters.
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default, Debug)]
|
||||||
pub struct GenericArgCountMismatch {
|
pub struct GenericArgCountMismatch {
|
||||||
/// Indicates whether a fatal error was reported (`Some`), or just a lint (`None`).
|
/// Indicates whether a fatal error was reported (`Some`), or just a lint (`None`).
|
||||||
pub reported: Option<ErrorGuaranteed>,
|
pub reported: Option<ErrorGuaranteed>,
|
||||||
@ -177,7 +177,7 @@ pub struct GenericArgCountMismatch {
|
|||||||
|
|
||||||
/// Decorates the result of a generic argument count mismatch
|
/// Decorates the result of a generic argument count mismatch
|
||||||
/// check with whether explicit late bounds were provided.
|
/// check with whether explicit late bounds were provided.
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct GenericArgCountResult {
|
pub struct GenericArgCountResult {
|
||||||
pub explicit_late_bound: ExplicitLateBound,
|
pub explicit_late_bound: ExplicitLateBound,
|
||||||
pub correct: Result<(), GenericArgCountMismatch>,
|
pub correct: Result<(), GenericArgCountMismatch>,
|
||||||
@ -201,7 +201,7 @@ pub trait CreateSubstsForGenericArgsCtxt<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self), ret)]
|
||||||
pub fn ast_region_to_region(
|
pub fn ast_region_to_region(
|
||||||
&self,
|
&self,
|
||||||
lifetime: &hir::Lifetime,
|
lifetime: &hir::Lifetime,
|
||||||
@ -210,7 +210,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||||||
let tcx = self.tcx();
|
let tcx = self.tcx();
|
||||||
let lifetime_name = |def_id| tcx.hir().name(tcx.hir().local_def_id_to_hir_id(def_id));
|
let lifetime_name = |def_id| tcx.hir().name(tcx.hir().local_def_id_to_hir_id(def_id));
|
||||||
|
|
||||||
let r = match tcx.named_region(lifetime.hir_id) {
|
match tcx.named_region(lifetime.hir_id) {
|
||||||
Some(rl::Region::Static) => tcx.lifetimes.re_static,
|
Some(rl::Region::Static) => tcx.lifetimes.re_static,
|
||||||
|
|
||||||
Some(rl::Region::LateBound(debruijn, index, def_id)) => {
|
Some(rl::Region::LateBound(debruijn, index, def_id)) => {
|
||||||
@ -255,9 +255,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||||||
tcx.lifetimes.re_static
|
tcx.lifetimes.re_static
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
debug!("ast_region_to_region(lifetime={:?}) yields {:?}", lifetime, r);
|
|
||||||
r
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Given a path `path` that refers to an item `I` with the declared generics `decl_generics`,
|
/// Given a path `path` that refers to an item `I` with the declared generics `decl_generics`,
|
||||||
@ -317,7 +315,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||||||
/// `[Vec<u8>, u8]` and `generic_args` are the arguments for the associated
|
/// `[Vec<u8>, u8]` and `generic_args` are the arguments for the associated
|
||||||
/// type itself: `['a]`. The returned `SubstsRef` concatenates these two
|
/// type itself: `['a]`. The returned `SubstsRef` concatenates these two
|
||||||
/// lists: `[Vec<u8>, u8, 'a]`.
|
/// lists: `[Vec<u8>, u8, 'a]`.
|
||||||
#[instrument(level = "debug", skip(self, span))]
|
#[instrument(level = "debug", skip(self, span), ret)]
|
||||||
fn create_substs_for_ast_path<'a>(
|
fn create_substs_for_ast_path<'a>(
|
||||||
&self,
|
&self,
|
||||||
span: Span,
|
span: Span,
|
||||||
@ -537,11 +535,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||||||
&mut substs_ctx,
|
&mut substs_ctx,
|
||||||
);
|
);
|
||||||
|
|
||||||
debug!(
|
|
||||||
"create_substs_for_ast_path(generic_params={:?}, self_ty={:?}) -> {:?}",
|
|
||||||
generics, self_ty, substs
|
|
||||||
);
|
|
||||||
|
|
||||||
(substs, arg_count)
|
(substs, arg_count)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2596,7 +2589,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||||||
|
|
||||||
/// Turns a `hir::Ty` into a `Ty`. For diagnostics' purposes we keep track of whether trait
|
/// Turns a `hir::Ty` into a `Ty`. For diagnostics' purposes we keep track of whether trait
|
||||||
/// objects are borrowed like `&dyn Trait` to avoid emitting redundant errors.
|
/// objects are borrowed like `&dyn Trait` to avoid emitting redundant errors.
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self), ret)]
|
||||||
fn ast_ty_to_ty_inner(&self, ast_ty: &hir::Ty<'_>, borrowed: bool, in_path: bool) -> Ty<'tcx> {
|
fn ast_ty_to_ty_inner(&self, ast_ty: &hir::Ty<'_>, borrowed: bool, in_path: bool) -> Ty<'tcx> {
|
||||||
let tcx = self.tcx();
|
let tcx = self.tcx();
|
||||||
|
|
||||||
@ -2700,8 +2693,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||||||
hir::TyKind::Err => tcx.ty_error(),
|
hir::TyKind::Err => tcx.ty_error(),
|
||||||
};
|
};
|
||||||
|
|
||||||
debug!(?result_ty);
|
|
||||||
|
|
||||||
self.record_ty(ast_ty.hir_id, result_ty, ast_ty.span);
|
self.record_ty(ast_ty.hir_id, result_ty, ast_ty.span);
|
||||||
result_ty
|
result_ty
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ use rustc_trait_selection::traits::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
#[instrument(skip(self), level = "debug")]
|
#[instrument(skip(self), level = "debug", ret)]
|
||||||
pub fn check_match(
|
pub fn check_match(
|
||||||
&self,
|
&self,
|
||||||
expr: &'tcx hir::Expr<'tcx>,
|
expr: &'tcx hir::Expr<'tcx>,
|
||||||
@ -212,9 +212,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
// We won't diverge unless the scrutinee or all arms diverge.
|
// We won't diverge unless the scrutinee or all arms diverge.
|
||||||
self.diverges.set(scrut_diverges | all_arms_diverge);
|
self.diverges.set(scrut_diverges | all_arms_diverge);
|
||||||
|
|
||||||
let match_ty = coercion.complete(self);
|
coercion.complete(self)
|
||||||
debug!(?match_ty);
|
|
||||||
match_ty
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// When the previously checked expression (the scrutinee) diverges,
|
/// When the previously checked expression (the scrutinee) diverges,
|
||||||
|
@ -58,7 +58,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
self.check_closure(expr, expected_kind, decl, body, gen, expected_sig)
|
self.check_closure(expr, expected_kind, decl, body, gen, expected_sig)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(self, expr, body, decl), level = "debug")]
|
#[instrument(skip(self, expr, body, decl), level = "debug", ret)]
|
||||||
fn check_closure(
|
fn check_closure(
|
||||||
&self,
|
&self,
|
||||||
expr: &hir::Expr<'_>,
|
expr: &hir::Expr<'_>,
|
||||||
@ -158,11 +158,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let closure_type = self.tcx.mk_closure(expr_def_id.to_def_id(), closure_substs.substs);
|
self.tcx.mk_closure(expr_def_id.to_def_id(), closure_substs.substs)
|
||||||
|
|
||||||
debug!(?expr.hir_id, ?closure_type);
|
|
||||||
|
|
||||||
closure_type
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Given the expected type, figures out what it can about this closure we
|
/// Given the expected type, figures out what it can about this closure we
|
||||||
@ -262,7 +258,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
/// The `cause_span` should be the span that caused us to
|
/// The `cause_span` should be the span that caused us to
|
||||||
/// have this expected signature, or `None` if we can't readily
|
/// have this expected signature, or `None` if we can't readily
|
||||||
/// know that.
|
/// know that.
|
||||||
#[instrument(level = "debug", skip(self, cause_span))]
|
#[instrument(level = "debug", skip(self, cause_span), ret)]
|
||||||
fn deduce_sig_from_projection(
|
fn deduce_sig_from_projection(
|
||||||
&self,
|
&self,
|
||||||
cause_span: Option<Span>,
|
cause_span: Option<Span>,
|
||||||
@ -317,7 +313,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
hir::Unsafety::Normal,
|
hir::Unsafety::Normal,
|
||||||
Abi::Rust,
|
Abi::Rust,
|
||||||
));
|
));
|
||||||
debug!(?sig);
|
|
||||||
|
|
||||||
Some(ExpectedSig { cause_span, sig })
|
Some(ExpectedSig { cause_span, sig })
|
||||||
}
|
}
|
||||||
@ -576,7 +571,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
/// types that the user gave into a signature.
|
/// types that the user gave into a signature.
|
||||||
///
|
///
|
||||||
/// Also, record this closure signature for later.
|
/// Also, record this closure signature for later.
|
||||||
#[instrument(skip(self, decl, body), level = "debug")]
|
#[instrument(skip(self, decl, body), level = "debug", ret)]
|
||||||
fn supplied_sig_of_closure(
|
fn supplied_sig_of_closure(
|
||||||
&self,
|
&self,
|
||||||
hir_id: hir::HirId,
|
hir_id: hir::HirId,
|
||||||
@ -629,8 +624,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
bound_vars,
|
bound_vars,
|
||||||
);
|
);
|
||||||
|
|
||||||
debug!(?result);
|
|
||||||
|
|
||||||
let c_result = self.inh.infcx.canonicalize_response(result);
|
let c_result = self.inh.infcx.canonicalize_response(result);
|
||||||
self.typeck_results.borrow_mut().user_provided_sigs.insert(expr_def_id, c_result);
|
self.typeck_results.borrow_mut().user_provided_sigs.insert(expr_def_id, c_result);
|
||||||
|
|
||||||
@ -643,7 +636,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
/// user specified. The "desugared" return type is an `impl
|
/// user specified. The "desugared" return type is an `impl
|
||||||
/// Future<Output = T>`, so we do this by searching through the
|
/// Future<Output = T>`, so we do this by searching through the
|
||||||
/// obligations to extract the `T`.
|
/// obligations to extract the `T`.
|
||||||
#[instrument(skip(self), level = "debug")]
|
#[instrument(skip(self), level = "debug", ret)]
|
||||||
fn deduce_future_output_from_obligations(
|
fn deduce_future_output_from_obligations(
|
||||||
&self,
|
&self,
|
||||||
expr_def_id: DefId,
|
expr_def_id: DefId,
|
||||||
@ -704,7 +697,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
);
|
);
|
||||||
self.register_predicates(obligations);
|
self.register_predicates(obligations);
|
||||||
|
|
||||||
debug!("deduce_future_output_from_obligations: output_ty={:?}", output_ty);
|
|
||||||
Some(output_ty)
|
Some(output_ty)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
self.resolve_vars_with_obligations_and_mutate_fulfillment(ty, |_| {})
|
self.resolve_vars_with_obligations_and_mutate_fulfillment(ty, |_| {})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(self, mutate_fulfillment_errors), level = "debug")]
|
#[instrument(skip(self, mutate_fulfillment_errors), level = "debug", ret)]
|
||||||
pub(in super::super) fn resolve_vars_with_obligations_and_mutate_fulfillment(
|
pub(in super::super) fn resolve_vars_with_obligations_and_mutate_fulfillment(
|
||||||
&self,
|
&self,
|
||||||
mut ty: Ty<'tcx>,
|
mut ty: Ty<'tcx>,
|
||||||
@ -107,10 +107,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
// indirect dependencies that don't seem worth tracking
|
// indirect dependencies that don't seem worth tracking
|
||||||
// precisely.
|
// precisely.
|
||||||
self.select_obligations_where_possible(false, mutate_fulfillment_errors);
|
self.select_obligations_where_possible(false, mutate_fulfillment_errors);
|
||||||
ty = self.resolve_vars_if_possible(ty);
|
self.resolve_vars_if_possible(ty)
|
||||||
|
|
||||||
debug!(?ty);
|
|
||||||
ty
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(in super::super) fn record_deferred_call_resolution(
|
pub(in super::super) fn record_deferred_call_resolution(
|
||||||
|
@ -168,7 +168,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
/// * `call_expr`: the complete method call: (`foo.bar::<T1,...Tn>(...)`)
|
/// * `call_expr`: the complete method call: (`foo.bar::<T1,...Tn>(...)`)
|
||||||
/// * `self_expr`: the self expression (`foo`)
|
/// * `self_expr`: the self expression (`foo`)
|
||||||
/// * `args`: the expressions of the arguments (`a, b + 1, ...`)
|
/// * `args`: the expressions of the arguments (`a, b + 1, ...`)
|
||||||
#[instrument(level = "debug", skip(self, call_expr, self_expr))]
|
#[instrument(level = "debug", skip(self))]
|
||||||
pub fn lookup_method(
|
pub fn lookup_method(
|
||||||
&self,
|
&self,
|
||||||
self_ty: Ty<'tcx>,
|
self_ty: Ty<'tcx>,
|
||||||
@ -178,11 +178,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
self_expr: &'tcx hir::Expr<'tcx>,
|
self_expr: &'tcx hir::Expr<'tcx>,
|
||||||
args: &'tcx [hir::Expr<'tcx>],
|
args: &'tcx [hir::Expr<'tcx>],
|
||||||
) -> Result<MethodCallee<'tcx>, MethodError<'tcx>> {
|
) -> Result<MethodCallee<'tcx>, MethodError<'tcx>> {
|
||||||
debug!(
|
|
||||||
"lookup(method_name={}, self_ty={:?}, call_expr={:?}, self_expr={:?})",
|
|
||||||
segment.ident, self_ty, call_expr, self_expr
|
|
||||||
);
|
|
||||||
|
|
||||||
let pick =
|
let pick =
|
||||||
self.lookup_probe(span, segment.ident, self_ty, call_expr, ProbeScope::TraitsInScope)?;
|
self.lookup_probe(span, segment.ident, self_ty, call_expr, ProbeScope::TraitsInScope)?;
|
||||||
|
|
||||||
@ -383,7 +378,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
/// In particular, it doesn't really do any probing: it simply constructs
|
/// In particular, it doesn't really do any probing: it simply constructs
|
||||||
/// an obligation for a particular trait with the given self type and checks
|
/// an obligation for a particular trait with the given self type and checks
|
||||||
/// whether that trait is implemented.
|
/// whether that trait is implemented.
|
||||||
#[instrument(level = "debug", skip(self, span, opt_input_types))]
|
#[instrument(level = "debug", skip(self, span))]
|
||||||
pub(super) fn lookup_method_in_trait(
|
pub(super) fn lookup_method_in_trait(
|
||||||
&self,
|
&self,
|
||||||
span: Span,
|
span: Span,
|
||||||
@ -392,11 +387,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
self_ty: Ty<'tcx>,
|
self_ty: Ty<'tcx>,
|
||||||
opt_input_types: Option<&[Ty<'tcx>]>,
|
opt_input_types: Option<&[Ty<'tcx>]>,
|
||||||
) -> Option<InferOk<'tcx, MethodCallee<'tcx>>> {
|
) -> Option<InferOk<'tcx, MethodCallee<'tcx>>> {
|
||||||
debug!(
|
|
||||||
"lookup_in_trait_adjusted(self_ty={:?}, m_name={}, trait_def_id={:?}, opt_input_types={:?})",
|
|
||||||
self_ty, m_name, trait_def_id, opt_input_types
|
|
||||||
);
|
|
||||||
|
|
||||||
let (obligation, substs) =
|
let (obligation, substs) =
|
||||||
self.obligation_for_method(span, trait_def_id, self_ty, opt_input_types);
|
self.obligation_for_method(span, trait_def_id, self_ty, opt_input_types);
|
||||||
self.construct_obligation_for_trait(
|
self.construct_obligation_for_trait(
|
||||||
@ -576,7 +566,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
/// * `self_ty`: the type to search within (`Foo`)
|
/// * `self_ty`: the type to search within (`Foo`)
|
||||||
/// * `self_ty_span` the span for the type being searched within (span of `Foo`)
|
/// * `self_ty_span` the span for the type being searched within (span of `Foo`)
|
||||||
/// * `expr_id`: the [`hir::HirId`] of the expression composing the entire call
|
/// * `expr_id`: the [`hir::HirId`] of the expression composing the entire call
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self), ret)]
|
||||||
pub fn resolve_fully_qualified_call(
|
pub fn resolve_fully_qualified_call(
|
||||||
&self,
|
&self,
|
||||||
span: Span,
|
span: Span,
|
||||||
@ -585,11 +575,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
self_ty_span: Span,
|
self_ty_span: Span,
|
||||||
expr_id: hir::HirId,
|
expr_id: hir::HirId,
|
||||||
) -> Result<(DefKind, DefId), MethodError<'tcx>> {
|
) -> Result<(DefKind, DefId), MethodError<'tcx>> {
|
||||||
debug!(
|
|
||||||
"resolve_fully_qualified_call: method_name={:?} self_ty={:?} expr_id={:?}",
|
|
||||||
method_name, self_ty, expr_id,
|
|
||||||
);
|
|
||||||
|
|
||||||
let tcx = self.tcx;
|
let tcx = self.tcx;
|
||||||
|
|
||||||
// Check if we have an enum variant.
|
// Check if we have an enum variant.
|
||||||
@ -633,21 +618,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
&pick,
|
&pick,
|
||||||
);
|
);
|
||||||
|
|
||||||
debug!("resolve_fully_qualified_call: pick={:?}", pick);
|
debug!(?pick);
|
||||||
{
|
{
|
||||||
let mut typeck_results = self.typeck_results.borrow_mut();
|
let mut typeck_results = self.typeck_results.borrow_mut();
|
||||||
let used_trait_imports = Lrc::get_mut(&mut typeck_results.used_trait_imports).unwrap();
|
let used_trait_imports = Lrc::get_mut(&mut typeck_results.used_trait_imports).unwrap();
|
||||||
for import_id in pick.import_ids {
|
for import_id in pick.import_ids {
|
||||||
debug!("resolve_fully_qualified_call: used_trait_import: {:?}", import_id);
|
debug!(used_trait_import=?import_id);
|
||||||
used_trait_imports.insert(import_id);
|
used_trait_imports.insert(import_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let def_kind = pick.item.kind.as_def_kind();
|
let def_kind = pick.item.kind.as_def_kind();
|
||||||
debug!(
|
|
||||||
"resolve_fully_qualified_call: def_kind={:?}, def_id={:?}",
|
|
||||||
def_kind, pick.item.def_id
|
|
||||||
);
|
|
||||||
tcx.check_stability(pick.item.def_id, Some(expr_id), span, Some(method_name.span));
|
tcx.check_stability(pick.item.def_id, Some(expr_id), span, Some(method_name.span));
|
||||||
Ok((def_kind, pick.item.def_id))
|
Ok((def_kind, pick.item.def_id))
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
/// would result in an error (basically, the same criteria we
|
/// would result in an error (basically, the same criteria we
|
||||||
/// would use to decide if a method is a plausible fit for
|
/// would use to decide if a method is a plausible fit for
|
||||||
/// ambiguity purposes).
|
/// ambiguity purposes).
|
||||||
#[instrument(level = "debug", skip(self, scope_expr_id))]
|
#[instrument(level = "debug", skip(self))]
|
||||||
pub fn probe_for_return_type(
|
pub fn probe_for_return_type(
|
||||||
&self,
|
&self,
|
||||||
span: Span,
|
span: Span,
|
||||||
@ -262,10 +262,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
self_ty: Ty<'tcx>,
|
self_ty: Ty<'tcx>,
|
||||||
scope_expr_id: hir::HirId,
|
scope_expr_id: hir::HirId,
|
||||||
) -> Vec<ty::AssocItem> {
|
) -> Vec<ty::AssocItem> {
|
||||||
debug!(
|
|
||||||
"probe(self_ty={:?}, return_type={}, scope_expr_id={})",
|
|
||||||
self_ty, return_type, scope_expr_id
|
|
||||||
);
|
|
||||||
let method_names = self
|
let method_names = self
|
||||||
.probe_op(
|
.probe_op(
|
||||||
span,
|
span,
|
||||||
@ -299,7 +295,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "debug", skip(self, scope_expr_id))]
|
#[instrument(level = "debug", skip(self))]
|
||||||
pub fn probe_for_name(
|
pub fn probe_for_name(
|
||||||
&self,
|
&self,
|
||||||
span: Span,
|
span: Span,
|
||||||
@ -310,10 +306,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
scope_expr_id: hir::HirId,
|
scope_expr_id: hir::HirId,
|
||||||
scope: ProbeScope,
|
scope: ProbeScope,
|
||||||
) -> PickResult<'tcx> {
|
) -> PickResult<'tcx> {
|
||||||
debug!(
|
|
||||||
"probe(self_ty={:?}, item_name={}, scope_expr_id={})",
|
|
||||||
self_ty, item_name, scope_expr_id
|
|
||||||
);
|
|
||||||
self.probe_op(
|
self.probe_op(
|
||||||
span,
|
span,
|
||||||
mode,
|
mode,
|
||||||
|
@ -341,7 +341,6 @@ fn diagnostic_only_typeck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &ty::T
|
|||||||
typeck_with_fallback(tcx, def_id, fallback)
|
typeck_with_fallback(tcx, def_id, fallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(tcx, fallback))]
|
|
||||||
fn typeck_with_fallback<'tcx>(
|
fn typeck_with_fallback<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
def_id: LocalDefId,
|
def_id: LocalDefId,
|
||||||
|
@ -19,7 +19,6 @@ use crate::errors::UnconstrainedOpaqueType;
|
|||||||
/// Computes the relevant generic parameter for a potential generic const argument.
|
/// Computes the relevant generic parameter for a potential generic const argument.
|
||||||
///
|
///
|
||||||
/// This should be called using the query `tcx.opt_const_param_of`.
|
/// This should be called using the query `tcx.opt_const_param_of`.
|
||||||
#[instrument(level = "debug", skip(tcx))]
|
|
||||||
pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<DefId> {
|
pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<DefId> {
|
||||||
use hir::*;
|
use hir::*;
|
||||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
||||||
|
@ -750,7 +750,7 @@ fn resolve_associated_trait_item<'a>(
|
|||||||
///
|
///
|
||||||
/// This is just a wrapper around [`TyCtxt::impl_item_implementor_ids()`] and
|
/// This is just a wrapper around [`TyCtxt::impl_item_implementor_ids()`] and
|
||||||
/// [`TyCtxt::associated_item()`] (with some helpful logging added).
|
/// [`TyCtxt::associated_item()`] (with some helpful logging added).
|
||||||
#[instrument(level = "debug", skip(tcx))]
|
#[instrument(level = "debug", skip(tcx), ret)]
|
||||||
fn trait_assoc_to_impl_assoc_item<'tcx>(
|
fn trait_assoc_to_impl_assoc_item<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
impl_id: DefId,
|
impl_id: DefId,
|
||||||
@ -760,9 +760,7 @@ fn trait_assoc_to_impl_assoc_item<'tcx>(
|
|||||||
debug!(?trait_to_impl_assoc_map);
|
debug!(?trait_to_impl_assoc_map);
|
||||||
let impl_assoc_id = *trait_to_impl_assoc_map.get(&trait_assoc_id)?;
|
let impl_assoc_id = *trait_to_impl_assoc_map.get(&trait_assoc_id)?;
|
||||||
debug!(?impl_assoc_id);
|
debug!(?impl_assoc_id);
|
||||||
let impl_assoc = tcx.associated_item(impl_assoc_id);
|
Some(tcx.associated_item(impl_assoc_id))
|
||||||
debug!(?impl_assoc);
|
|
||||||
Some(impl_assoc)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Given a type, return all trait impls in scope in `module` for that type.
|
/// Given a type, return all trait impls in scope in `module` for that type.
|
||||||
|
Loading…
Reference in New Issue
Block a user