Skip to content
Merged
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
4 changes: 2 additions & 2 deletions compiler/rustc_const_eval/src/interpret/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
span = ?stmt.source_info.span,
tracing_separate_thread = Empty,
)
.or_if_tracing_disabled(|| info!(stmt = ?stmt.kind));
.or_if_tracing_disabled(|| info!("{:?}", stmt.kind));

use rustc_middle::mir::StatementKind::*;

Expand Down Expand Up @@ -490,7 +490,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
span = ?terminator.source_info.span,
tracing_separate_thread = Empty,
)
.or_if_tracing_disabled(|| info!(terminator = ?terminator.kind));
.or_if_tracing_disabled(|| info!("{:?}", terminator.kind));

use rustc_middle::mir::TerminatorKind::*;
match terminator.kind {
Expand Down
14 changes: 12 additions & 2 deletions compiler/rustc_middle/src/mir/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -802,10 +802,10 @@ impl<'de, 'tcx> MirWriter<'de, 'tcx> {
}
}

impl Debug for Statement<'_> {
impl Debug for StatementKind<'_> {
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
use self::StatementKind::*;
match self.kind {
match *self {
Assign(box (ref place, ref rv)) => write!(fmt, "{place:?} = {rv:?}"),
FakeRead(box (ref cause, ref place)) => {
write!(fmt, "FakeRead({cause:?}, {place:?})")
Expand Down Expand Up @@ -844,6 +844,11 @@ impl Debug for Statement<'_> {
}
}
}
impl Debug for Statement<'_> {
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
self.kind.fmt(fmt)
}
}

impl Debug for StmtDebugInfo<'_> {
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
Expand Down Expand Up @@ -915,6 +920,11 @@ impl<'tcx> Debug for TerminatorKind<'tcx> {
}
}
}
impl Debug for Terminator<'_> {
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
self.kind.fmt(fmt)
}
}

impl<'tcx> TerminatorKind<'tcx> {
/// Writes the "head" part of the terminator; that is, its name and the data it uses to pick the
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ pub enum FakeBorrowKind {
/// Not all of these are allowed at every [`MirPhase`]. Check the documentation there to see which
/// ones you do not have to worry about. The MIR validator will generally enforce such restrictions,
/// causing an ICE if they are violated.
#[derive(Clone, Debug, PartialEq, TyEncodable, TyDecodable, Hash, HashStable)]
#[derive(Clone, PartialEq, TyEncodable, TyDecodable, Hash, HashStable)]
#[derive(TypeFoldable, TypeVisitable)]
pub enum StatementKind<'tcx> {
/// Assign statements roughly correspond to an assignment in Rust proper (`x = ...`) except
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/terminator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ impl<O> AssertKind<O> {
}
}

#[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable)]
#[derive(Clone, TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable)]
pub struct Terminator<'tcx> {
pub source_info: SourceInfo,
pub kind: TerminatorKind<'tcx>,
Expand Down
Loading