Skip to content

Commit 740f9c5

Browse files
committed
Debug on statements/expressions
1 parent e5ebf20 commit 740f9c5

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

src/libsyntax/ast.rs

+4-24
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub struct LifetimeDef {
7272
/// along with a bunch of supporting information.
7373
///
7474
/// E.g. `std::cmp::PartialEq`
75-
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)]
75+
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
7676
pub struct Path {
7777
pub span: Span,
7878
/// The segments in the path: the things separated by `::`.
@@ -85,13 +85,6 @@ impl<'a> PartialEq<&'a str> for Path {
8585
self.segments.len() == 1 && self.segments[0].identifier.name == *string
8686
}
8787
}
88-
89-
impl fmt::Debug for Path {
90-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
91-
write!(f, "path({})", pprust::path_to_string(self))
92-
}
93-
}
94-
9588
impl fmt::Display for Path {
9689
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
9790
write!(f, "{}", pprust::path_to_string(self))
@@ -812,7 +805,7 @@ impl UnOp {
812805
}
813806

814807
/// A statement
815-
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)]
808+
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
816809
pub struct Stmt {
817810
pub id: NodeId,
818811
pub node: StmtKind,
@@ -839,14 +832,7 @@ impl Stmt {
839832
}
840833
}
841834

842-
impl fmt::Debug for Stmt {
843-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
844-
write!(f, "stmt({}: {})", self.id.to_string(), pprust::stmt_to_string(self))
845-
}
846-
}
847-
848-
849-
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)]
835+
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
850836
pub enum StmtKind {
851837
/// A local (let) binding.
852838
Local(P<Local>),
@@ -929,7 +915,7 @@ pub enum UnsafeSource {
929915
}
930916

931917
/// An expression
932-
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash,)]
918+
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
933919
pub struct Expr {
934920
pub id: NodeId,
935921
pub node: ExprKind,
@@ -1045,12 +1031,6 @@ impl Expr {
10451031
}
10461032
}
10471033

1048-
impl fmt::Debug for Expr {
1049-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1050-
write!(f, "expr({}: {})", self.id, pprust::expr_to_string(self))
1051-
}
1052-
}
1053-
10541034
/// Limit types of a range (inclusive or exclusive)
10551035
#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
10561036
pub enum RangeLimits {

0 commit comments

Comments
 (0)