Skip to content

Commit

Permalink
Rollup merge of #30420 - petrochenkov:owned2, r=nrc
Browse files Browse the repository at this point in the history
Part of rust-lang/rust#30095 not causing mysterious segfaults.

r? @nrc
  • Loading branch information
Manishearth committed Dec 18, 2015
2 parents e74b6c0 + 8957d67 commit 1a0b05f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 28 deletions.
11 changes: 8 additions & 3 deletions clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl<T, U> Clean<U> for ty::Binder<T> where T: Clean<U> {
}
}

impl<T: Clean<U>, U> Clean<Vec<U>> for syntax::owned_slice::OwnedSlice<T> {
impl<T: Clean<U>, U> Clean<Vec<U>> for P<[T]> {
fn clean(&self, cx: &DocContext) -> Vec<U> {
self.iter().map(|x| x.clean(cx)).collect()
}
Expand Down Expand Up @@ -1584,8 +1584,13 @@ impl Clean<Type> for hir::Ty {
resolve_type(cx, p.clean(cx), self.id)
}
TyPath(Some(ref qself), ref p) => {
let mut trait_path = p.clone();
trait_path.segments.pop();
let mut segments: Vec<_> = p.segments.clone().into();
segments.pop();
let trait_path = hir::Path {
span: p.span,
global: p.global,
segments: segments.into(),
};
Type::QPath {
name: p.segments.last().unwrap().identifier.name.clean(cx),
self_type: box qself.ty.clean(cx),
Expand Down
42 changes: 21 additions & 21 deletions doctree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use rustc_front::hir;

pub struct Module {
pub name: Option<Name>,
pub attrs: Vec<ast::Attribute>,
pub attrs: hir::HirVec<ast::Attribute>,
pub where_outer: Span,
pub where_inner: Span,
pub extern_crates: Vec<ExternCrate>,
Expand Down Expand Up @@ -58,7 +58,7 @@ impl Module {
depr: None,
where_outer: syntax::codemap::DUMMY_SP,
where_inner: syntax::codemap::DUMMY_SP,
attrs : Vec::new(),
attrs : hir::HirVec::new(),
extern_crates: Vec::new(),
imports : Vec::new(),
structs : Vec::new(),
Expand Down Expand Up @@ -103,26 +103,26 @@ pub struct Struct {
pub struct_type: StructType,
pub name: Name,
pub generics: hir::Generics,
pub attrs: Vec<ast::Attribute>,
pub fields: Vec<hir::StructField>,
pub attrs: hir::HirVec<ast::Attribute>,
pub fields: hir::HirVec<hir::StructField>,
pub whence: Span,
}

pub struct Enum {
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
pub depr: Option<attr::Deprecation>,
pub variants: Vec<Variant>,
pub variants: hir::HirVec<Variant>,
pub generics: hir::Generics,
pub attrs: Vec<ast::Attribute>,
pub attrs: hir::HirVec<ast::Attribute>,
pub id: NodeId,
pub whence: Span,
pub name: Name,
}

pub struct Variant {
pub name: Name,
pub attrs: Vec<ast::Attribute>,
pub attrs: hir::HirVec<ast::Attribute>,
pub def: hir::VariantData,
pub stab: Option<attr::Stability>,
pub depr: Option<attr::Deprecation>,
Expand All @@ -131,7 +131,7 @@ pub struct Variant {

pub struct Function {
pub decl: hir::FnDecl,
pub attrs: Vec<ast::Attribute>,
pub attrs: hir::HirVec<ast::Attribute>,
pub id: NodeId,
pub name: Name,
pub vis: hir::Visibility,
Expand All @@ -149,7 +149,7 @@ pub struct Typedef {
pub gen: hir::Generics,
pub name: Name,
pub id: ast::NodeId,
pub attrs: Vec<ast::Attribute>,
pub attrs: hir::HirVec<ast::Attribute>,
pub whence: Span,
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
Expand All @@ -162,7 +162,7 @@ pub struct Static {
pub mutability: hir::Mutability,
pub expr: P<hir::Expr>,
pub name: Name,
pub attrs: Vec<ast::Attribute>,
pub attrs: hir::HirVec<ast::Attribute>,
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
pub depr: Option<attr::Deprecation>,
Expand All @@ -174,7 +174,7 @@ pub struct Constant {
pub type_: P<hir::Ty>,
pub expr: P<hir::Expr>,
pub name: Name,
pub attrs: Vec<ast::Attribute>,
pub attrs: hir::HirVec<ast::Attribute>,
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
pub depr: Option<attr::Deprecation>,
Expand All @@ -185,10 +185,10 @@ pub struct Constant {
pub struct Trait {
pub unsafety: hir::Unsafety,
pub name: Name,
pub items: Vec<hir::TraitItem>,
pub items: hir::HirVec<hir::TraitItem>,
pub generics: hir::Generics,
pub bounds: Vec<hir::TyParamBound>,
pub attrs: Vec<ast::Attribute>,
pub bounds: hir::HirVec<hir::TyParamBound>,
pub attrs: hir::HirVec<ast::Attribute>,
pub id: ast::NodeId,
pub whence: Span,
pub vis: hir::Visibility,
Expand All @@ -202,8 +202,8 @@ pub struct Impl {
pub generics: hir::Generics,
pub trait_: Option<hir::TraitRef>,
pub for_: P<hir::Ty>,
pub items: Vec<hir::ImplItem>,
pub attrs: Vec<ast::Attribute>,
pub items: hir::HirVec<hir::ImplItem>,
pub attrs: hir::HirVec<ast::Attribute>,
pub whence: Span,
pub vis: hir::Visibility,
pub stab: Option<attr::Stability>,
Expand All @@ -215,16 +215,16 @@ pub struct DefaultImpl {
pub unsafety: hir::Unsafety,
pub trait_: hir::TraitRef,
pub id: ast::NodeId,
pub attrs: Vec<ast::Attribute>,
pub attrs: hir::HirVec<ast::Attribute>,
pub whence: Span,
}

pub struct Macro {
pub name: Name,
pub id: ast::NodeId,
pub attrs: Vec<ast::Attribute>,
pub attrs: hir::HirVec<ast::Attribute>,
pub whence: Span,
pub matchers: Vec<Span>,
pub matchers: hir::HirVec<Span>,
pub stab: Option<attr::Stability>,
pub depr: Option<attr::Deprecation>,
pub imported_from: Option<Name>,
Expand All @@ -234,14 +234,14 @@ pub struct ExternCrate {
pub name: Name,
pub path: Option<String>,
pub vis: hir::Visibility,
pub attrs: Vec<ast::Attribute>,
pub attrs: hir::HirVec<ast::Attribute>,
pub whence: Span,
}

pub struct Import {
pub id: NodeId,
pub vis: hir::Visibility,
pub attrs: Vec<ast::Attribute>,
pub attrs: hir::HirVec<ast::Attribute>,
pub node: hir::ViewPath_,
pub whence: Span,
}
Expand Down
8 changes: 4 additions & 4 deletions visit_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use doctree::*;

pub struct RustdocVisitor<'a, 'tcx: 'a> {
pub module: Module,
pub attrs: Vec<ast::Attribute>,
pub attrs: hir::HirVec<ast::Attribute>,
pub cx: &'a core::DocContext<'a, 'tcx>,
pub analysis: Option<&'a core::CrateAnalysis>,
view_item_stack: HashSet<ast::NodeId>,
Expand All @@ -53,7 +53,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
stack.insert(ast::CRATE_NODE_ID);
RustdocVisitor {
module: Module::new(None),
attrs: Vec::new(),
attrs: hir::HirVec::new(),
cx: cx,
analysis: analysis,
view_item_stack: stack,
Expand Down Expand Up @@ -157,7 +157,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
}
}

pub fn visit_mod_contents(&mut self, span: Span, attrs: Vec<ast::Attribute> ,
pub fn visit_mod_contents(&mut self, span: Span, attrs: hir::HirVec<ast::Attribute>,
vis: hir::Visibility, id: ast::NodeId,
m: &hir::Mod,
name: Option<ast::Name>) -> Module {
Expand Down Expand Up @@ -192,7 +192,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
let mine = paths.into_iter().filter(|path| {
!self.resolve_id(path.node.id(), None, false, om,
please_inline)
}).collect::<Vec<hir::PathListItem>>();
}).collect::<hir::HirVec<hir::PathListItem>>();

if mine.is_empty() {
None
Expand Down

0 comments on commit 1a0b05f

Please sign in to comment.