diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2015-07-31 00:04:06 -0700 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2015-09-03 10:02:36 +1200 |
| commit | facdf2ebb1dce9400a8c8ef0d85d7d278654effb (patch) | |
| tree | 3ba46bd98df35b4b5d1bc5f1ba491d14adb6f373 /src/librustdoc/html/format.rs | |
| parent | cfd76b364cd01695517467299618ef63f1c0cc07 (diff) | |
| download | rust-facdf2ebb1dce9400a8c8ef0d85d7d278654effb.tar.gz rust-facdf2ebb1dce9400a8c8ef0d85d7d278654effb.zip | |
Add an intital HIR and lowering step
Diffstat (limited to 'src/librustdoc/html/format.rs')
| -rw-r--r-- | src/librustdoc/html/format.rs | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index bad36ecd054..947ae3abd8d 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -21,6 +21,7 @@ use std::iter::repeat; use rustc::middle::def_id::{DefId, LOCAL_CRATE}; use syntax::abi::Abi; use syntax::ast; +use rustc_front::hir; use clean; use html::item_type::ItemType; @@ -30,15 +31,15 @@ use html::render::{cache, CURRENT_LOCATION_KEY}; /// Helper to render an optional visibility with a space after it (if the /// visibility is preset) #[derive(Copy, Clone)] -pub struct VisSpace(pub Option<ast::Visibility>); +pub struct VisSpace(pub Option<hir::Visibility>); /// Similarly to VisSpace, this structure is used to render a function style with a /// space after it. #[derive(Copy, Clone)] -pub struct UnsafetySpace(pub ast::Unsafety); +pub struct UnsafetySpace(pub hir::Unsafety); /// Similarly to VisSpace, this structure is used to render a function constness /// with a space after it. #[derive(Copy, Clone)] -pub struct ConstnessSpace(pub ast::Constness); +pub struct ConstnessSpace(pub hir::Constness); /// Wrapper struct for properly emitting a method declaration. pub struct Method<'a>(pub &'a clean::SelfTy, pub &'a clean::FnDecl); /// Similar to VisSpace, but used for mutability @@ -56,19 +57,19 @@ pub struct CommaSep<'a, T: 'a>(pub &'a [T]); pub struct AbiSpace(pub Abi); impl VisSpace { - pub fn get(&self) -> Option<ast::Visibility> { + pub fn get(&self) -> Option<hir::Visibility> { let VisSpace(v) = *self; v } } impl UnsafetySpace { - pub fn get(&self) -> ast::Unsafety { + pub fn get(&self) -> hir::Unsafety { let UnsafetySpace(v) = *self; v } } impl ConstnessSpace { - pub fn get(&self) -> ast::Constness { + pub fn get(&self) -> hir::Constness { let ConstnessSpace(v) = *self; v } } @@ -201,8 +202,8 @@ impl fmt::Display for clean::TyParamBound { } clean::TraitBound(ref ty, modifier) => { let modifier_str = match modifier { - ast::TraitBoundModifier::None => "", - ast::TraitBoundModifier::Maybe => "?", + hir::TraitBoundModifier::None => "", + hir::TraitBoundModifier::Maybe => "?", }; write!(f, "{}{}", modifier_str, *ty) } @@ -618,8 +619,8 @@ impl<'a> fmt::Display for Method<'a> { impl fmt::Display for VisSpace { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.get() { - Some(ast::Public) => write!(f, "pub "), - Some(ast::Inherited) | None => Ok(()) + Some(hir::Public) => write!(f, "pub "), + Some(hir::Inherited) | None => Ok(()) } } } @@ -627,8 +628,8 @@ impl fmt::Display for VisSpace { impl fmt::Display for UnsafetySpace { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.get() { - ast::Unsafety::Unsafe => write!(f, "unsafe "), - ast::Unsafety::Normal => Ok(()) + hir::Unsafety::Unsafe => write!(f, "unsafe "), + hir::Unsafety::Normal => Ok(()) } } } @@ -636,8 +637,8 @@ impl fmt::Display for UnsafetySpace { impl fmt::Display for ConstnessSpace { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.get() { - ast::Constness::Const => write!(f, "const "), - ast::Constness::NotConst => Ok(()) + hir::Constness::Const => write!(f, "const "), + hir::Constness::NotConst => Ok(()) } } } |
