提交 7bb0923e 编写于 作者: A Ariel Ben-Yehuda

fix Debug impls

上级 c10b23e2
......@@ -18,6 +18,7 @@
use util::nodemap::{FxHashMap, FxHashSet};
use ty;
use std::fmt;
use std::mem;
use std::rc::Rc;
use syntax::codemap;
......@@ -96,7 +97,11 @@
/// placate the same deriving in `ty::FreeRegion`, but we may want to
/// actually attach a more meaningful ordering to scopes than the one
/// generated via deriving here.
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Debug, Copy, RustcEncodable, RustcDecodable)]
///
/// Scope is a bit-packed to save space - if `code` is SCOPE_DATA_REMAINDER_MAX
/// or less, it is a `ScopeData::Remainder`, otherwise it is a type specified
/// by the bitpacking.
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Copy, RustcEncodable, RustcDecodable)]
pub struct Scope {
pub(crate) id: hir::ItemLocalId,
pub(crate) code: u32
......@@ -152,7 +157,7 @@ pub struct BlockRemainder {
}
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, RustcEncodable,
RustcDecodable, Debug, Copy)]
RustcDecodable, Copy)]
pub struct FirstStatementIndex { pub idx: u32 }
impl Idx for FirstStatementIndex {
......@@ -166,6 +171,12 @@ fn index(self) -> usize {
}
}
impl fmt::Debug for FirstStatementIndex {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(&self.index(), formatter)
}
}
impl From<ScopeData> for Scope {
#[inline]
fn from(scope_data: ScopeData) -> Self {
......@@ -180,6 +191,12 @@ fn from(scope_data: ScopeData) -> Self {
}
}
impl fmt::Debug for Scope {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(&self.data(), formatter)
}
}
#[allow(non_snake_case)]
impl Scope {
#[inline]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册