Skip to content

Commit a97eec4

Browse files
committed
downgrade some more logging
1 parent 273ab1f commit a97eec4

File tree

3 files changed

+44
-43
lines changed

3 files changed

+44
-43
lines changed

compiler/rustc_const_eval/src/const_eval/eval_queries.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn eval_body_using_ecx<'mir, 'tcx>(
3232
cid: GlobalId<'tcx>,
3333
body: &'mir mir::Body<'tcx>,
3434
) -> InterpResult<'tcx, MPlaceTy<'tcx>> {
35-
debug!("eval_body_using_ecx: {:?}, {:?}", cid, ecx.param_env);
35+
trace!("eval_body_using_ecx: {:?}, {:?}", cid, ecx.param_env);
3636
let tcx = *ecx.tcx;
3737
assert!(
3838
cid.promoted.is_some()
@@ -81,7 +81,7 @@ fn eval_body_using_ecx<'mir, 'tcx>(
8181
intern_const_alloc_recursive(ecx, intern_kind, &ret)?;
8282
// we leave alignment checks off, since this `ecx` will not be used for further evaluation anyway
8383

84-
debug!("eval_body_using_ecx done: {:?}", *ret);
84+
trace!("eval_body_using_ecx done: {:?}", *ret);
8585
Ok(ret)
8686
}
8787

@@ -98,7 +98,7 @@ pub(super) fn mk_eval_cx<'mir, 'tcx>(
9898
param_env: ty::ParamEnv<'tcx>,
9999
can_access_statics: bool,
100100
) -> CompileTimeEvalContext<'mir, 'tcx> {
101-
debug!("mk_eval_cx: {:?}", param_env);
101+
trace!("mk_eval_cx: {:?}", param_env);
102102
InterpCx::new(
103103
tcx,
104104
root_span,
@@ -109,7 +109,7 @@ pub(super) fn mk_eval_cx<'mir, 'tcx>(
109109

110110
/// This function converts an interpreter value into a constant that is meant for use in the
111111
/// type system.
112-
#[instrument(skip(ecx), level = "debug")]
112+
#[instrument(skip(ecx), level = "trace")]
113113
pub(super) fn op_to_const<'tcx>(
114114
ecx: &CompileTimeEvalContext<'_, 'tcx>,
115115
op: &OpTy<'tcx>,
@@ -144,11 +144,11 @@ pub(super) fn op_to_const<'tcx>(
144144
op.as_mplace_or_imm()
145145
};
146146

147-
debug!(?immediate);
147+
trace!(?immediate);
148148

149149
// We know `offset` is relative to the allocation, so we can use `into_parts`.
150150
let to_const_value = |mplace: &MPlaceTy<'_>| {
151-
debug!("to_const_value(mplace: {:?})", mplace);
151+
trace!("to_const_value(mplace: {:?})", mplace);
152152
match mplace.ptr.into_parts() {
153153
(Some(alloc_id), offset) => {
154154
let alloc = ecx.tcx.global_alloc(alloc_id).unwrap_memory();
@@ -173,7 +173,7 @@ pub(super) fn op_to_const<'tcx>(
173173
_ if imm.layout.is_zst() => ConstValue::ZeroSized,
174174
Immediate::Scalar(x) => ConstValue::Scalar(x),
175175
Immediate::ScalarPair(a, b) => {
176-
debug!("ScalarPair(a: {:?}, b: {:?})", a, b);
176+
trace!("ScalarPair(a: {:?}, b: {:?})", a, b);
177177
// We know `offset` is relative to the allocation, so we can use `into_parts`.
178178
let (data, start) = match a.to_pointer(ecx).unwrap().into_parts() {
179179
(Some(alloc_id), offset) => {
@@ -196,7 +196,7 @@ pub(super) fn op_to_const<'tcx>(
196196
}
197197
}
198198

199-
#[instrument(skip(tcx), level = "debug", ret)]
199+
#[instrument(skip(tcx), level = "trace", ret)]
200200
pub(crate) fn turn_into_const_value<'tcx>(
201201
tcx: TyCtxt<'tcx>,
202202
constant: ConstAlloc<'tcx>,
@@ -226,7 +226,7 @@ pub(crate) fn turn_into_const_value<'tcx>(
226226
op_to_const(&ecx, &mplace.into())
227227
}
228228

229-
#[instrument(skip(tcx), level = "debug")]
229+
#[instrument(skip(tcx), level = "trace")]
230230
pub fn eval_to_const_value_raw_provider<'tcx>(
231231
tcx: TyCtxt<'tcx>,
232232
key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>,
@@ -261,7 +261,7 @@ pub fn eval_to_const_value_raw_provider<'tcx>(
261261
tcx.eval_to_allocation_raw(key).map(|val| turn_into_const_value(tcx, val, key))
262262
}
263263

264-
#[instrument(skip(tcx), level = "debug")]
264+
#[instrument(skip(tcx), level = "trace")]
265265
pub fn eval_to_allocation_raw_provider<'tcx>(
266266
tcx: TyCtxt<'tcx>,
267267
key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>,

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+26-25
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ fn check_well_formed(tcx: TyCtxt<'_>, def_id: hir::OwnerId) {
149149
/// We do this check as a pre-pass before checking fn bodies because if these constraints are
150150
/// not included it frequently leads to confusing errors in fn bodies. So it's better to check
151151
/// the types first.
152-
#[instrument(skip(tcx), level = "debug")]
152+
#[instrument(skip(tcx), level = "trace")]
153153
fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) {
154154
let def_id = item.owner_id.def_id;
155155

156-
debug!(
156+
trace!(
157157
?item.owner_id,
158158
item.name = ? tcx.def_path_str(def_id)
159159
);
@@ -249,7 +249,7 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) {
249249
fn check_foreign_item(tcx: TyCtxt<'_>, item: &hir::ForeignItem<'_>) {
250250
let def_id = item.owner_id.def_id;
251251

252-
debug!(
252+
trace!(
253253
?item.owner_id,
254254
item.name = ? tcx.def_path_str(def_id)
255255
);
@@ -405,7 +405,7 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, associated_items: &[hir::TraitItemRe
405405

406406
for (gat_def_id, required_bounds) in required_bounds_by_item {
407407
let gat_item_hir = tcx.hir().expect_trait_item(gat_def_id.def_id);
408-
debug!(?required_bounds);
408+
trace!(?required_bounds);
409409
let param_env = tcx.param_env(gat_def_id);
410410

411411
let mut unsatisfied_bounds: Vec<_> = required_bounds
@@ -546,8 +546,8 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
546546
for (ty, ty_idx) in &types {
547547
// In our example, requires that `Self: 'a`
548548
if ty_known_to_outlive(tcx, item_def_id.def_id, param_env, &wf_tys, *ty, *region_a) {
549-
debug!(?ty_idx, ?region_a_idx);
550-
debug!("required clause: {ty} must outlive {region_a}");
549+
trace!(?ty_idx, ?region_a_idx);
550+
trace!("required clause: {ty} must outlive {region_a}");
551551
// Translate into the generic parameters of the GAT. In
552552
// our example, the type was `Self`, which will also be
553553
// `Self` in the GAT.
@@ -592,8 +592,8 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
592592
*region_a,
593593
*region_b,
594594
) {
595-
debug!(?region_a_idx, ?region_b_idx);
596-
debug!("required clause: {region_a} must outlive {region_b}");
595+
trace!(?region_a_idx, ?region_b_idx);
596+
trace!("required clause: {region_a} must outlive {region_b}");
597597
// Translate into the generic parameters of the GAT.
598598
let region_a_param = gat_generics.param_at(*region_a_idx, tcx);
599599
let region_a_param = ty::Region::new_early_bound(
@@ -690,7 +690,7 @@ fn resolve_regions_with_wf_tys<'tcx>(
690690
add_constraints(&infcx, region_bound_pairs);
691691

692692
let errors = infcx.resolve_regions(&outlives_environment);
693-
debug!(?errors, "errors");
693+
trace!(?errors, "errors");
694694

695695
// If we were able to prove that the type outlives the region without
696696
// an error, it must be because of the implied or explicit bounds...
@@ -950,7 +950,7 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
950950
}
951951
}
952952

953-
#[instrument(level = "debug", skip(tcx, span, sig_if_method))]
953+
#[instrument(level = "trace", skip(tcx, span, sig_if_method))]
954954
fn check_associated_item(
955955
tcx: TyCtxt<'_>,
956956
item_id: LocalDefId,
@@ -1100,7 +1100,7 @@ fn check_type_defn<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item<'tcx>, all_sized: b
11001100

11011101
#[instrument(skip(tcx, item))]
11021102
fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item<'_>) {
1103-
debug!(?item.owner_id);
1103+
trace!(?item.owner_id);
11041104

11051105
let def_id = item.owner_id.def_id;
11061106
let trait_def = tcx.trait_def(def_id);
@@ -1135,7 +1135,7 @@ fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item<'_>) {
11351135
fn check_associated_type_bounds(wfcx: &WfCheckingCtxt<'_, '_>, item: ty::AssocItem, span: Span) {
11361136
let bounds = wfcx.tcx().explicit_item_bounds(item.def_id);
11371137

1138-
debug!("check_associated_type_bounds: bounds={:?}", bounds);
1138+
trace!("check_associated_type_bounds: bounds={:?}", bounds);
11391139
let wf_obligations = bounds.subst_identity_iter_copied().flat_map(|(bound, bound_span)| {
11401140
let normalized_bound = wfcx.normalize(span, None, bound);
11411141
traits::wf::predicate_obligations(
@@ -1164,7 +1164,7 @@ fn check_item_fn(
11641164
}
11651165

11661166
fn check_item_type(tcx: TyCtxt<'_>, item_id: LocalDefId, ty_span: Span, allow_foreign_ty: bool) {
1167-
debug!("check_item_type: {:?}", item_id);
1167+
trace!("check_item_type: {:?}", item_id);
11681168

11691169
enter_wf_checking_ctxt(tcx, ty_span, item_id, |wfcx| {
11701170
let ty = tcx.type_of(item_id).subst_identity();
@@ -1205,7 +1205,7 @@ fn check_item_type(tcx: TyCtxt<'_>, item_id: LocalDefId, ty_span: Span, allow_fo
12051205
});
12061206
}
12071207

1208-
#[instrument(level = "debug", skip(tcx, ast_self_ty, ast_trait_ref))]
1208+
#[instrument(level = "trace", skip(tcx, ast_self_ty, ast_trait_ref))]
12091209
fn check_impl<'tcx>(
12101210
tcx: TyCtxt<'tcx>,
12111211
item: &'tcx hir::Item<'tcx>,
@@ -1248,7 +1248,7 @@ fn check_impl<'tcx>(
12481248
obligation.cause.span = ast_self_ty.span;
12491249
}
12501250
}
1251-
debug!(?obligations);
1251+
trace!(?obligations);
12521252
wfcx.register_obligations(obligations);
12531253
}
12541254
None => {
@@ -1271,7 +1271,7 @@ fn check_impl<'tcx>(
12711271
}
12721272

12731273
/// Checks where-clauses and inline bounds that are declared on `def_id`.
1274-
#[instrument(level = "debug", skip(wfcx))]
1274+
#[instrument(level = "trace", skip(wfcx))]
12751275
fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id: LocalDefId) {
12761276
let infcx = wfcx.infcx;
12771277
let tcx = wfcx.tcx();
@@ -1443,7 +1443,7 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id
14431443

14441444
let predicates = wfcx.normalize(span, None, predicates);
14451445

1446-
debug!(?predicates.predicates);
1446+
trace!(?predicates.predicates);
14471447
assert_eq!(predicates.predicates.len(), predicates.spans.len());
14481448
let wf_obligations = predicates.into_iter().flat_map(|(p, sp)| {
14491449
traits::wf::predicate_obligations(
@@ -1458,7 +1458,7 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id
14581458
wfcx.register_obligations(obligations);
14591459
}
14601460

1461-
#[instrument(level = "debug", skip(wfcx, span, hir_decl))]
1461+
#[instrument(level = "trace", skip(wfcx, span, hir_decl))]
14621462
fn check_fn_or_method<'tcx>(
14631463
wfcx: &WfCheckingCtxt<'_, 'tcx>,
14641464
span: Span,
@@ -1621,7 +1621,7 @@ const HELP_FOR_SELF_TYPE: &str = "consider changing to `self`, `&self`, `&mut se
16211621
`self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one \
16221622
of the previous types except `Self`)";
16231623

1624-
#[instrument(level = "debug", skip(wfcx))]
1624+
#[instrument(level = "trace", skip(wfcx))]
16251625
fn check_method_receiver<'tcx>(
16261626
wfcx: &WfCheckingCtxt<'_, 'tcx>,
16271627
fn_sig: &hir::FnSig<'_>,
@@ -1640,7 +1640,7 @@ fn check_method_receiver<'tcx>(
16401640
let sig = tcx.liberate_late_bound_regions(method.def_id, sig);
16411641
let sig = wfcx.normalize(span, None, sig);
16421642

1643-
debug!("check_method_receiver: sig={:?}", sig);
1643+
trace!("check_method_receiver: sig={:?}", sig);
16441644

16451645
let self_ty = wfcx.normalize(span, None, self_ty);
16461646

@@ -1733,9 +1733,10 @@ fn receiver_is_valid<'tcx>(
17331733
// Keep dereferencing `receiver_ty` until we get to `self_ty`.
17341734
loop {
17351735
if let Some((potential_self_ty, _)) = autoderef.next() {
1736-
debug!(
1736+
trace!(
17371737
"receiver_is_valid: potential self type `{:?}` to match `{:?}`",
1738-
potential_self_ty, self_ty
1738+
potential_self_ty,
1739+
self_ty
17391740
);
17401741

17411742
if can_eq_self(potential_self_ty) {
@@ -1764,7 +1765,7 @@ fn receiver_is_valid<'tcx>(
17641765
}
17651766
}
17661767
} else {
1767-
debug!("receiver_is_valid: type `{:?}` does not deref to `{:?}`", receiver_ty, self_ty);
1768+
trace!("receiver_is_valid: type `{:?}` does not deref to `{:?}`", receiver_ty, self_ty);
17681769
// If the receiver already has errors reported due to it, consider it valid to avoid
17691770
// unnecessary errors (#58712).
17701771
return receiver_ty.references_error();
@@ -1795,7 +1796,7 @@ fn receiver_is_implemented<'tcx>(
17951796
if wfcx.infcx.predicate_must_hold_modulo_regions(&obligation) {
17961797
true
17971798
} else {
1798-
debug!(
1799+
trace!(
17991800
"receiver_is_implemented: type `{:?}` does not implement `Receiver` trait",
18001801
receiver_ty
18011802
);
@@ -1897,7 +1898,7 @@ fn report_bivariance(
18971898
impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
18981899
/// Feature gates RFC 2056 -- trivial bounds, checking for global bounds that
18991900
/// aren't true.
1900-
#[instrument(level = "debug", skip(self))]
1901+
#[instrument(level = "trace", skip(self))]
19011902
fn check_false_global_bounds(&mut self) {
19021903
let tcx = self.ocx.infcx.tcx;
19031904
let mut span = self.span;

compiler/rustc_query_system/src/dep_graph/serialized.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,20 @@ impl<K: DepKind> SerializedDepGraph<K> {
9292
impl<'a, K: DepKind + Decodable<MemDecoder<'a>>> Decodable<MemDecoder<'a>>
9393
for SerializedDepGraph<K>
9494
{
95-
#[instrument(level = "debug", skip(d))]
95+
#[instrument(level = "trace", skip(d))]
9696
fn decode(d: &mut MemDecoder<'a>) -> SerializedDepGraph<K> {
9797
// The last 16 bytes are the node count and edge count.
98-
debug!("position: {:?}", d.position());
98+
trace!("position: {:?}", d.position());
9999
let (node_count, edge_count) =
100100
d.with_position(d.len() - 2 * IntEncodedWithFixedSize::ENCODED_SIZE, |d| {
101-
debug!("position: {:?}", d.position());
101+
trace!("position: {:?}", d.position());
102102
let node_count = IntEncodedWithFixedSize::decode(d).0 as usize;
103103
let edge_count = IntEncodedWithFixedSize::decode(d).0 as usize;
104104
(node_count, edge_count)
105105
});
106-
debug!("position: {:?}", d.position());
106+
trace!("position: {:?}", d.position());
107107

108-
debug!(?node_count, ?edge_count);
108+
trace!(?node_count, ?edge_count);
109109

110110
let mut nodes = IndexVec::with_capacity(node_count);
111111
let mut fingerprints = IndexVec::with_capacity(node_count);
@@ -207,11 +207,11 @@ impl<K: DepKind> EncoderState<K> {
207207
let node_count = total_node_count.try_into().unwrap();
208208
let edge_count = total_edge_count.try_into().unwrap();
209209

210-
debug!(?node_count, ?edge_count);
211-
debug!("position: {:?}", encoder.position());
210+
trace!(?node_count, ?edge_count);
211+
trace!("position: {:?}", encoder.position());
212212
IntEncodedWithFixedSize(node_count).encode(&mut encoder);
213213
IntEncodedWithFixedSize(edge_count).encode(&mut encoder);
214-
debug!("position: {:?}", encoder.position());
214+
trace!("position: {:?}", encoder.position());
215215
// Drop the encoder so that nothing is written after the counts.
216216
let result = encoder.finish();
217217
if let Ok(position) = result {

0 commit comments

Comments
 (0)