Skip to content

Commit e5f8405

Browse files
committed
revert last commit; instead use max_level_trace and downgrade logging
there is a *lot* of logging in some very hot paths of the compiler. downgrade a lot of it. this uses the very stupid heuristic of "did the logging add more than 10 milliseconds to cargo's compile time"?
1 parent c7a8cdf commit e5f8405

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1002
-842
lines changed

compiler/rustc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ features = ['unprefixed_malloc_on_supported_platforms']
2222
[features]
2323
jemalloc = ['jemalloc-sys']
2424
llvm = ['rustc_driver_impl/llvm']
25-
max_level_info = ['rustc_driver_impl/max_level_info']
25+
max_level_debug = ['rustc_driver_impl/max_level_debug']
2626
rustc_use_parallel_compiler = ['rustc_driver_impl/rustc_use_parallel_compiler']

compiler/rustc_borrowck/src/borrow_set.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'tcx> {
199199
) {
200200
if let &mir::Rvalue::Ref(region, kind, borrowed_place) = rvalue {
201201
if borrowed_place.ignore_borrow(self.tcx, self.body, &self.locals_state_at_exit) {
202-
debug!("ignoring_borrow of {:?}", borrowed_place);
202+
trace!("ignoring_borrow of {:?}", borrowed_place);
203203
return;
204204
}
205205

@@ -296,13 +296,15 @@ impl<'a, 'tcx> GatherBorrows<'a, 'tcx> {
296296
kind: mir::BorrowKind,
297297
borrow_index: BorrowIndex,
298298
) {
299-
debug!(
299+
trace!(
300300
"Borrows::insert_as_pending_if_two_phase({:?}, {:?}, {:?})",
301-
start_location, assigned_place, borrow_index,
301+
start_location,
302+
assigned_place,
303+
borrow_index,
302304
);
303305

304306
if !allow_two_phase_borrow(kind) {
305-
debug!(" -> {:?}", start_location);
307+
trace!(" -> {:?}", start_location);
306308
return;
307309
}
308310

compiler/rustc_borrowck/src/constraint_generation.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl<'cx, 'tcx> ConstraintGeneration<'cx, 'tcx> {
167167
where
168168
T: TypeVisitable<TyCtxt<'tcx>>,
169169
{
170-
debug!("add_regular_live_constraint(live_ty={:?}, location={:?})", live_ty, location);
170+
trace!("add_regular_live_constraint(live_ty={:?}, location={:?})", live_ty, location);
171171

172172
self.infcx.tcx.for_each_free_region(&live_ty, |live_region| {
173173
let vid = live_region.as_var();
@@ -190,9 +190,10 @@ impl<'cx, 'tcx> ConstraintGeneration<'cx, 'tcx> {
190190
match place.as_ref() {
191191
PlaceRef { local, projection: &[] }
192192
| PlaceRef { local, projection: &[ProjectionElem::Deref] } => {
193-
debug!(
193+
trace!(
194194
"Recording `killed` facts for borrows of local={:?} at location={:?}",
195-
local, location
195+
local,
196+
location
196197
);
197198

198199
record_killed_borrows_for_local(
@@ -206,10 +207,11 @@ impl<'cx, 'tcx> ConstraintGeneration<'cx, 'tcx> {
206207

207208
PlaceRef { local, projection: &[.., _] } => {
208209
// Kill conflicting borrows of the innermost local.
209-
debug!(
210+
trace!(
210211
"Recording `killed` facts for borrows of \
211212
innermost projected local={:?} at location={:?}",
212-
local, location
213+
local,
214+
location
213215
);
214216

215217
if let Some(borrow_indices) = self.borrow_set.local_map.get(&local) {

compiler/rustc_borrowck/src/constraints/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub(crate) struct OutlivesConstraintSet<'tcx> {
2424

2525
impl<'tcx> OutlivesConstraintSet<'tcx> {
2626
pub(crate) fn push(&mut self, constraint: OutlivesConstraint<'tcx>) {
27-
debug!("OutlivesConstraintSet::push({:?})", constraint);
27+
trace!("OutlivesConstraintSet::push({:?})", constraint);
2828
if constraint.sup == constraint.sub {
2929
// 'a: 'a is pretty uninteresting
3030
return;

compiler/rustc_borrowck/src/dataflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl<'tcx> OutOfScopePrecomputer<'_, 'tcx> {
183183
let kill_location = Location { block: bb, statement_index: kill_stmt };
184184
// If region does not contain a point at the location, then add to list and skip
185185
// successor locations.
186-
debug!("borrow {:?} gets killed at {:?}", borrow_index, kill_location);
186+
trace!("borrow {:?} gets killed at {:?}", borrow_index, kill_location);
187187
self.borrows_out_of_scope_at_location
188188
.entry(kill_location)
189189
.or_default()
@@ -285,7 +285,7 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {
285285

286286
/// Kill any borrows that conflict with `place`.
287287
fn kill_borrows_on_place(&self, trans: &mut impl GenKill<BorrowIndex>, place: Place<'tcx>) {
288-
debug!("kill_borrows_on_place: place={:?}", place);
288+
trace!("kill_borrows_on_place: place={:?}", place);
289289

290290
let other_borrows_of_local = self
291291
.borrow_set

compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ trait TypeOpInfo<'tcx> {
171171
) {
172172
let tcx = mbcx.infcx.tcx;
173173
let base_universe = self.base_universe();
174-
debug!(?base_universe);
174+
trace!(?base_universe);
175175

176176
let Some(adjusted_universe) =
177177
placeholder.universe.as_u32().checked_sub(base_universe.as_u32())
@@ -200,7 +200,7 @@ trait TypeOpInfo<'tcx> {
200200
None
201201
};
202202

203-
debug!(?placeholder_region);
203+
trace!(?placeholder_region);
204204

205205
let span = cause.span;
206206
let nice_error = self.nice_error(mbcx, cause, placeholder_region, error_region);
@@ -418,7 +418,7 @@ fn try_extract_error_from_region_constraints<'tcx>(
418418
}
419419
})?;
420420

421-
debug!(?sub_region, "cause = {:#?}", cause);
421+
trace!(?sub_region, "cause = {:#?}", cause);
422422
let error = match (error_region, *sub_region) {
423423
(Some(error_region), ty::ReVar(vid)) => RegionResolutionError::SubSupConflict(
424424
vid,

0 commit comments

Comments
 (0)