ast: don't use pprust in Debug
This commit is contained in:
parent
1721c9685b
commit
d131abefc3
1 changed files with 6 additions and 41 deletions
|
@ -70,7 +70,7 @@ impl fmt::Display for Lifetime {
|
||||||
/// along with a bunch of supporting information.
|
/// along with a bunch of supporting information.
|
||||||
///
|
///
|
||||||
/// E.g., `std::cmp::PartialEq`.
|
/// E.g., `std::cmp::PartialEq`.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Path {
|
pub struct Path {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
/// The segments in the path: the things separated by `::`.
|
/// The segments in the path: the things separated by `::`.
|
||||||
|
@ -86,12 +86,6 @@ impl PartialEq<Symbol> for Path {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for Path {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
||||||
write!(f, "path({})", pprust::path_to_string(self))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Display for Path {
|
impl fmt::Display for Path {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "{}", pprust::path_to_string(self))
|
write!(f, "{}", pprust::path_to_string(self))
|
||||||
|
@ -507,19 +501,13 @@ pub struct Block {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Pat {
|
pub struct Pat {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub kind: PatKind,
|
pub kind: PatKind,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for Pat {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
||||||
write!(f, "pat({}: {})", self.id, pprust::pat_to_string(self))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Pat {
|
impl Pat {
|
||||||
/// Attempt reparsing the pattern as a type.
|
/// Attempt reparsing the pattern as a type.
|
||||||
/// This is intended for use by diagnostics.
|
/// This is intended for use by diagnostics.
|
||||||
|
@ -831,7 +819,7 @@ impl UnOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A statement
|
/// A statement
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Stmt {
|
pub struct Stmt {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub kind: StmtKind,
|
pub kind: StmtKind,
|
||||||
|
@ -865,18 +853,7 @@ impl Stmt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for Stmt {
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
||||||
write!(
|
|
||||||
f,
|
|
||||||
"stmt({}: {})",
|
|
||||||
self.id.to_string(),
|
|
||||||
pprust::stmt_to_string(self)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
|
||||||
pub enum StmtKind {
|
pub enum StmtKind {
|
||||||
/// A local (let) binding.
|
/// A local (let) binding.
|
||||||
Local(P<Local>),
|
Local(P<Local>),
|
||||||
|
@ -973,7 +950,7 @@ pub struct AnonConst {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An expression.
|
/// An expression.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Expr {
|
pub struct Expr {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub kind: ExprKind,
|
pub kind: ExprKind,
|
||||||
|
@ -1100,12 +1077,6 @@ impl Expr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for Expr {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
||||||
write!(f, "expr({}: {})", self.id, pprust::expr_to_string(self))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Limit types of a range (inclusive or exclusive)
|
/// Limit types of a range (inclusive or exclusive)
|
||||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum RangeLimits {
|
pub enum RangeLimits {
|
||||||
|
@ -1660,19 +1631,13 @@ pub enum AssocTyConstraintKind {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Ty {
|
pub struct Ty {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub kind: TyKind,
|
pub kind: TyKind,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for Ty {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
||||||
write!(f, "type({})", pprust::ty_to_string(self))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct BareFnTy {
|
pub struct BareFnTy {
|
||||||
pub unsafety: Unsafety,
|
pub unsafety: Unsafety,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue