From facdf2ebb1dce9400a8c8ef0d85d7d278654effb Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Fri, 31 Jul 2015 00:04:06 -0700 Subject: Add an intital HIR and lowering step --- src/librustdoc/html/format.rs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/librustdoc/html/format.rs') 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); +pub struct VisSpace(pub Option); /// 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 { + pub fn get(&self) -> Option { 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(()) } } } -- cgit 1.4.1-3-g733a5