summaryrefslogtreecommitdiff
path: root/src/syntax/span.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/syntax/span.rs')
-rw-r--r--src/syntax/span.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/syntax/span.rs b/src/syntax/span.rs
index 7a051d99..8973ef89 100644
--- a/src/syntax/span.rs
+++ b/src/syntax/span.rs
@@ -116,7 +116,7 @@ impl Debug for Span {
}
/// A value with the span it corresponds to in the source code.
-#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Serialize)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Serialize)]
pub struct Spanned<T> {
/// The value.
pub v: T,
@@ -147,6 +147,14 @@ impl<T> Spanned<T> {
}
}
+impl<T: Debug> Debug for Spanned<T> {
+ fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+ self.span.fmt(f)?;
+ f.write_str(": ")?;
+ self.v.fmt(f)
+ }
+}
+
/// A vector of spanned things.
pub type SpanVec<T> = Vec<Spanned<T>>;