Skip to content

[experiment] Enable debug-logging by default #111924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ features = ['unprefixed_malloc_on_supported_platforms']
[features]
jemalloc = ['jemalloc-sys']
llvm = ['rustc_driver_impl/llvm']
max_level_info = ['rustc_driver_impl/max_level_info']
max_level_debug = ['rustc_driver_impl/max_level_debug']
rustc_use_parallel_compiler = ['rustc_driver_impl/rustc_use_parallel_compiler']
10 changes: 6 additions & 4 deletions compiler/rustc_borrowck/src/borrow_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ impl<'a, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'tcx> {
) {
if let &mir::Rvalue::Ref(region, kind, borrowed_place) = rvalue {
if borrowed_place.ignore_borrow(self.tcx, self.body, &self.locals_state_at_exit) {
debug!("ignoring_borrow of {:?}", borrowed_place);
trace!("ignoring_borrow of {:?}", borrowed_place);
return;
}

Expand Down Expand Up @@ -296,13 +296,15 @@ impl<'a, 'tcx> GatherBorrows<'a, 'tcx> {
kind: mir::BorrowKind,
borrow_index: BorrowIndex,
) {
debug!(
trace!(
"Borrows::insert_as_pending_if_two_phase({:?}, {:?}, {:?})",
start_location, assigned_place, borrow_index,
start_location,
assigned_place,
borrow_index,
);

if !allow_two_phase_borrow(kind) {
debug!(" -> {:?}", start_location);
trace!(" -> {:?}", start_location);
return;
}

Expand Down
12 changes: 7 additions & 5 deletions compiler/rustc_borrowck/src/constraint_generation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl<'cx, 'tcx> ConstraintGeneration<'cx, 'tcx> {
where
T: TypeVisitable<TyCtxt<'tcx>>,
{
debug!("add_regular_live_constraint(live_ty={:?}, location={:?})", live_ty, location);
trace!("add_regular_live_constraint(live_ty={:?}, location={:?})", live_ty, location);

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

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

PlaceRef { local, projection: &[.., _] } => {
// Kill conflicting borrows of the innermost local.
debug!(
trace!(
"Recording `killed` facts for borrows of \
innermost projected local={:?} at location={:?}",
local, location
local,
location
);

if let Some(borrow_indices) = self.borrow_set.local_map.get(&local) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/constraints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub(crate) struct OutlivesConstraintSet<'tcx> {

impl<'tcx> OutlivesConstraintSet<'tcx> {
pub(crate) fn push(&mut self, constraint: OutlivesConstraint<'tcx>) {
debug!("OutlivesConstraintSet::push({:?})", constraint);
trace!("OutlivesConstraintSet::push({:?})", constraint);
if constraint.sup == constraint.sub {
// 'a: 'a is pretty uninteresting
return;
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl<'tcx> OutOfScopePrecomputer<'_, 'tcx> {
let kill_location = Location { block: bb, statement_index: kill_stmt };
// If region does not contain a point at the location, then add to list and skip
// successor locations.
debug!("borrow {:?} gets killed at {:?}", borrow_index, kill_location);
trace!("borrow {:?} gets killed at {:?}", borrow_index, kill_location);
self.borrows_out_of_scope_at_location
.entry(kill_location)
.or_default()
Expand Down Expand Up @@ -285,7 +285,7 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {

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

let other_borrows_of_local = self
.borrow_set
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ trait TypeOpInfo<'tcx> {
error_region: Option<ty::Region<'tcx>>,
) -> Option<DiagnosticBuilder<'tcx, ErrorGuaranteed>>;

#[instrument(level = "debug", skip(self, mbcx))]
#[instrument(level = "trace", skip(self, mbcx))]
fn report_error(
&self,
mbcx: &mut MirBorrowckCtxt<'_, 'tcx>,
Expand All @@ -171,7 +171,7 @@ trait TypeOpInfo<'tcx> {
) {
let tcx = mbcx.infcx.tcx;
let base_universe = self.base_universe();
debug!(?base_universe);
trace!(?base_universe);

let Some(adjusted_universe) =
placeholder.universe.as_u32().checked_sub(base_universe.as_u32())
Expand Down Expand Up @@ -200,7 +200,7 @@ trait TypeOpInfo<'tcx> {
None
};

debug!(?placeholder_region);
trace!(?placeholder_region);

let span = cause.span;
let nice_error = self.nice_error(mbcx, cause, placeholder_region, error_region);
Expand Down Expand Up @@ -374,7 +374,7 @@ impl<'tcx> TypeOpInfo<'tcx> for crate::type_check::InstantiateOpaqueType<'tcx> {
}
}

#[instrument(skip(ocx), level = "debug")]
#[instrument(skip(ocx), level = "trace")]
fn try_extract_error_from_fulfill_cx<'tcx>(
ocx: &ObligationCtxt<'_, 'tcx>,
placeholder_region: ty::Region<'tcx>,
Expand All @@ -395,7 +395,7 @@ fn try_extract_error_from_fulfill_cx<'tcx>(
)
}

#[instrument(level = "debug", skip(infcx, region_var_origin, universe_of_region))]
#[instrument(level = "trace", skip(infcx, region_var_origin, universe_of_region))]
fn try_extract_error_from_region_constraints<'tcx>(
infcx: &InferCtxt<'tcx>,
placeholder_region: ty::Region<'tcx>,
Expand All @@ -418,7 +418,7 @@ fn try_extract_error_from_region_constraints<'tcx>(
}
})?;

debug!(?sub_region, "cause = {:#?}", cause);
trace!(?sub_region, "cause = {:#?}", cause);
let error = match (error_region, *sub_region) {
(Some(error_region), ty::ReVar(vid)) => RegionResolutionError::SubSupConflict(
vid,
Expand Down
Loading