Make hir::Visibility
non-copyable and add ty::Visibility
This commit is contained in:
parent
ffbbf24186
commit
bb66d91c98
21 changed files with 200 additions and 165 deletions
|
@ -37,10 +37,10 @@ use std::u32;
|
||||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||||
pub enum FnKind<'a> {
|
pub enum FnKind<'a> {
|
||||||
/// fn foo() or extern "Abi" fn foo()
|
/// fn foo() or extern "Abi" fn foo()
|
||||||
ItemFn(Name, &'a Generics, Unsafety, Constness, Abi, Visibility, &'a [Attribute]),
|
ItemFn(Name, &'a Generics, Unsafety, Constness, Abi, &'a Visibility, &'a [Attribute]),
|
||||||
|
|
||||||
/// fn foo(&self)
|
/// fn foo(&self)
|
||||||
Method(Name, &'a MethodSig, Option<Visibility>, &'a [Attribute]),
|
Method(Name, &'a MethodSig, Option<&'a Visibility>, &'a [Attribute]),
|
||||||
|
|
||||||
/// |x, y| {}
|
/// |x, y| {}
|
||||||
Closure(&'a [Attribute]),
|
Closure(&'a [Attribute]),
|
||||||
|
@ -324,7 +324,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
|
||||||
unsafety,
|
unsafety,
|
||||||
constness,
|
constness,
|
||||||
abi,
|
abi,
|
||||||
item.vis,
|
&item.vis,
|
||||||
&item.attrs),
|
&item.attrs),
|
||||||
declaration,
|
declaration,
|
||||||
body,
|
body,
|
||||||
|
@ -672,7 +672,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
|
||||||
ImplItemKind::Method(ref sig, ref body) => {
|
ImplItemKind::Method(ref sig, ref body) => {
|
||||||
visitor.visit_fn(FnKind::Method(impl_item.name,
|
visitor.visit_fn(FnKind::Method(impl_item.name,
|
||||||
sig,
|
sig,
|
||||||
Some(impl_item.vis),
|
Some(&impl_item.vis),
|
||||||
&impl_item.attrs),
|
&impl_item.attrs),
|
||||||
&sig.decl,
|
&sig.decl,
|
||||||
body,
|
body,
|
||||||
|
|
|
@ -113,7 +113,7 @@ struct ItemFnParts<'a> {
|
||||||
unsafety: ast::Unsafety,
|
unsafety: ast::Unsafety,
|
||||||
constness: ast::Constness,
|
constness: ast::Constness,
|
||||||
abi: abi::Abi,
|
abi: abi::Abi,
|
||||||
vis: ast::Visibility,
|
vis: &'a ast::Visibility,
|
||||||
generics: &'a ast::Generics,
|
generics: &'a ast::Generics,
|
||||||
body: &'a Block,
|
body: &'a Block,
|
||||||
id: NodeId,
|
id: NodeId,
|
||||||
|
@ -208,7 +208,7 @@ impl<'a> FnLikeNode<'a> {
|
||||||
M: FnOnce(NodeId,
|
M: FnOnce(NodeId,
|
||||||
Name,
|
Name,
|
||||||
&'a ast::MethodSig,
|
&'a ast::MethodSig,
|
||||||
Option<ast::Visibility>,
|
Option<&'a ast::Visibility>,
|
||||||
&'a ast::Block,
|
&'a ast::Block,
|
||||||
Span,
|
Span,
|
||||||
&'a [Attribute])
|
&'a [Attribute])
|
||||||
|
@ -226,7 +226,7 @@ impl<'a> FnLikeNode<'a> {
|
||||||
body: &block,
|
body: &block,
|
||||||
generics: generics,
|
generics: generics,
|
||||||
abi: abi,
|
abi: abi,
|
||||||
vis: i.vis,
|
vis: &i.vis,
|
||||||
constness: constness,
|
constness: constness,
|
||||||
span: i.span,
|
span: i.span,
|
||||||
attrs: &i.attrs,
|
attrs: &i.attrs,
|
||||||
|
@ -242,7 +242,7 @@ impl<'a> FnLikeNode<'a> {
|
||||||
map::NodeImplItem(ii) => {
|
map::NodeImplItem(ii) => {
|
||||||
match ii.node {
|
match ii.node {
|
||||||
ast::ImplItemKind::Method(ref sig, ref body) => {
|
ast::ImplItemKind::Method(ref sig, ref body) => {
|
||||||
method(ii.id, ii.name, sig, Some(ii.vis), body, ii.span, &ii.attrs)
|
method(ii.id, ii.name, sig, Some(&ii.vis), body, ii.span, &ii.attrs)
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
bug!("impl method FnLikeNode that is not fn-like")
|
bug!("impl method FnLikeNode that is not fn-like")
|
||||||
|
|
|
@ -430,7 +430,7 @@ impl<'ast> Map<'ast> {
|
||||||
|
|
||||||
/// Returns the NodeId of `id`'s nearest module parent, or `id` itself if no
|
/// Returns the NodeId of `id`'s nearest module parent, or `id` itself if no
|
||||||
/// module parent is in this map.
|
/// module parent is in this map.
|
||||||
fn get_module_parent(&self, id: NodeId) -> NodeId {
|
pub fn get_module_parent(&self, id: NodeId) -> NodeId {
|
||||||
match self.walk_parent_nodes(id, |node| match *node {
|
match self.walk_parent_nodes(id, |node| match *node {
|
||||||
NodeItem(&Item { node: Item_::ItemMod(_), .. }) => true,
|
NodeItem(&Item { node: Item_::ItemMod(_), .. }) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
|
|
|
@ -1431,7 +1431,7 @@ pub struct PolyTraitRef {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
||||||
pub enum Visibility {
|
pub enum Visibility {
|
||||||
Public,
|
Public,
|
||||||
Inherited,
|
Inherited,
|
||||||
|
|
|
@ -294,7 +294,7 @@ pub fn fun_to_string(decl: &hir::FnDecl,
|
||||||
Some(name),
|
Some(name),
|
||||||
generics,
|
generics,
|
||||||
opt_explicit_self,
|
opt_explicit_self,
|
||||||
hir::Inherited)?;
|
&hir::Inherited)?;
|
||||||
s.end()?; // Close the head box
|
s.end()?; // Close the head box
|
||||||
s.end() // Close the outer box
|
s.end() // Close the outer box
|
||||||
})
|
})
|
||||||
|
@ -322,8 +322,8 @@ pub fn arg_to_string(arg: &hir::Arg) -> String {
|
||||||
to_string(|s| s.print_arg(arg, false))
|
to_string(|s| s.print_arg(arg, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn visibility_qualified(vis: hir::Visibility, s: &str) -> String {
|
pub fn visibility_qualified(vis: &hir::Visibility, s: &str) -> String {
|
||||||
match vis {
|
match *vis {
|
||||||
hir::Public => format!("pub {}", s),
|
hir::Public => format!("pub {}", s),
|
||||||
hir::Inherited => s.to_string(),
|
hir::Inherited => s.to_string(),
|
||||||
}
|
}
|
||||||
|
@ -573,13 +573,13 @@ impl<'a> State<'a> {
|
||||||
Some(item.name),
|
Some(item.name),
|
||||||
generics,
|
generics,
|
||||||
None,
|
None,
|
||||||
item.vis)?;
|
&item.vis)?;
|
||||||
self.end()?; // end head-ibox
|
self.end()?; // end head-ibox
|
||||||
word(&mut self.s, ";")?;
|
word(&mut self.s, ";")?;
|
||||||
self.end() // end the outer fn box
|
self.end() // end the outer fn box
|
||||||
}
|
}
|
||||||
hir::ForeignItemStatic(ref t, m) => {
|
hir::ForeignItemStatic(ref t, m) => {
|
||||||
self.head(&visibility_qualified(item.vis, "static"))?;
|
self.head(&visibility_qualified(&item.vis, "static"))?;
|
||||||
if m {
|
if m {
|
||||||
self.word_space("mut")?;
|
self.word_space("mut")?;
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ impl<'a> State<'a> {
|
||||||
name: ast::Name,
|
name: ast::Name,
|
||||||
ty: &hir::Ty,
|
ty: &hir::Ty,
|
||||||
default: Option<&hir::Expr>,
|
default: Option<&hir::Expr>,
|
||||||
vis: hir::Visibility)
|
vis: &hir::Visibility)
|
||||||
-> io::Result<()> {
|
-> io::Result<()> {
|
||||||
word(&mut self.s, &visibility_qualified(vis, ""))?;
|
word(&mut self.s, &visibility_qualified(vis, ""))?;
|
||||||
self.word_space("const")?;
|
self.word_space("const")?;
|
||||||
|
@ -648,7 +648,7 @@ impl<'a> State<'a> {
|
||||||
self.ann.pre(self, NodeItem(item))?;
|
self.ann.pre(self, NodeItem(item))?;
|
||||||
match item.node {
|
match item.node {
|
||||||
hir::ItemExternCrate(ref optional_path) => {
|
hir::ItemExternCrate(ref optional_path) => {
|
||||||
self.head(&visibility_qualified(item.vis, "extern crate"))?;
|
self.head(&visibility_qualified(&item.vis, "extern crate"))?;
|
||||||
if let Some(p) = *optional_path {
|
if let Some(p) = *optional_path {
|
||||||
let val = p.as_str();
|
let val = p.as_str();
|
||||||
if val.contains("-") {
|
if val.contains("-") {
|
||||||
|
@ -666,14 +666,14 @@ impl<'a> State<'a> {
|
||||||
self.end()?; // end outer head-block
|
self.end()?; // end outer head-block
|
||||||
}
|
}
|
||||||
hir::ItemUse(ref vp) => {
|
hir::ItemUse(ref vp) => {
|
||||||
self.head(&visibility_qualified(item.vis, "use"))?;
|
self.head(&visibility_qualified(&item.vis, "use"))?;
|
||||||
self.print_view_path(&vp)?;
|
self.print_view_path(&vp)?;
|
||||||
word(&mut self.s, ";")?;
|
word(&mut self.s, ";")?;
|
||||||
self.end()?; // end inner head-block
|
self.end()?; // end inner head-block
|
||||||
self.end()?; // end outer head-block
|
self.end()?; // end outer head-block
|
||||||
}
|
}
|
||||||
hir::ItemStatic(ref ty, m, ref expr) => {
|
hir::ItemStatic(ref ty, m, ref expr) => {
|
||||||
self.head(&visibility_qualified(item.vis, "static"))?;
|
self.head(&visibility_qualified(&item.vis, "static"))?;
|
||||||
if m == hir::MutMutable {
|
if m == hir::MutMutable {
|
||||||
self.word_space("mut")?;
|
self.word_space("mut")?;
|
||||||
}
|
}
|
||||||
|
@ -689,7 +689,7 @@ impl<'a> State<'a> {
|
||||||
self.end()?; // end the outer cbox
|
self.end()?; // end the outer cbox
|
||||||
}
|
}
|
||||||
hir::ItemConst(ref ty, ref expr) => {
|
hir::ItemConst(ref ty, ref expr) => {
|
||||||
self.head(&visibility_qualified(item.vis, "const"))?;
|
self.head(&visibility_qualified(&item.vis, "const"))?;
|
||||||
self.print_name(item.name)?;
|
self.print_name(item.name)?;
|
||||||
self.word_space(":")?;
|
self.word_space(":")?;
|
||||||
self.print_type(&ty)?;
|
self.print_type(&ty)?;
|
||||||
|
@ -710,12 +710,12 @@ impl<'a> State<'a> {
|
||||||
Some(item.name),
|
Some(item.name),
|
||||||
typarams,
|
typarams,
|
||||||
None,
|
None,
|
||||||
item.vis)?;
|
&item.vis)?;
|
||||||
word(&mut self.s, " ")?;
|
word(&mut self.s, " ")?;
|
||||||
self.print_block_with_attrs(&body, &item.attrs)?;
|
self.print_block_with_attrs(&body, &item.attrs)?;
|
||||||
}
|
}
|
||||||
hir::ItemMod(ref _mod) => {
|
hir::ItemMod(ref _mod) => {
|
||||||
self.head(&visibility_qualified(item.vis, "mod"))?;
|
self.head(&visibility_qualified(&item.vis, "mod"))?;
|
||||||
self.print_name(item.name)?;
|
self.print_name(item.name)?;
|
||||||
self.nbsp()?;
|
self.nbsp()?;
|
||||||
self.bopen()?;
|
self.bopen()?;
|
||||||
|
@ -732,7 +732,7 @@ impl<'a> State<'a> {
|
||||||
hir::ItemTy(ref ty, ref params) => {
|
hir::ItemTy(ref ty, ref params) => {
|
||||||
self.ibox(indent_unit)?;
|
self.ibox(indent_unit)?;
|
||||||
self.ibox(0)?;
|
self.ibox(0)?;
|
||||||
self.word_nbsp(&visibility_qualified(item.vis, "type"))?;
|
self.word_nbsp(&visibility_qualified(&item.vis, "type"))?;
|
||||||
self.print_name(item.name)?;
|
self.print_name(item.name)?;
|
||||||
self.print_generics(params)?;
|
self.print_generics(params)?;
|
||||||
self.end()?; // end the inner ibox
|
self.end()?; // end the inner ibox
|
||||||
|
@ -745,16 +745,16 @@ impl<'a> State<'a> {
|
||||||
self.end()?; // end the outer ibox
|
self.end()?; // end the outer ibox
|
||||||
}
|
}
|
||||||
hir::ItemEnum(ref enum_definition, ref params) => {
|
hir::ItemEnum(ref enum_definition, ref params) => {
|
||||||
self.print_enum_def(enum_definition, params, item.name, item.span, item.vis)?;
|
self.print_enum_def(enum_definition, params, item.name, item.span, &item.vis)?;
|
||||||
}
|
}
|
||||||
hir::ItemStruct(ref struct_def, ref generics) => {
|
hir::ItemStruct(ref struct_def, ref generics) => {
|
||||||
self.head(&visibility_qualified(item.vis, "struct"))?;
|
self.head(&visibility_qualified(&item.vis, "struct"))?;
|
||||||
self.print_struct(struct_def, generics, item.name, item.span, true)?;
|
self.print_struct(struct_def, generics, item.name, item.span, true)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
hir::ItemDefaultImpl(unsafety, ref trait_ref) => {
|
hir::ItemDefaultImpl(unsafety, ref trait_ref) => {
|
||||||
self.head("")?;
|
self.head("")?;
|
||||||
self.print_visibility(item.vis)?;
|
self.print_visibility(&item.vis)?;
|
||||||
self.print_unsafety(unsafety)?;
|
self.print_unsafety(unsafety)?;
|
||||||
self.word_nbsp("impl")?;
|
self.word_nbsp("impl")?;
|
||||||
self.print_trait_ref(trait_ref)?;
|
self.print_trait_ref(trait_ref)?;
|
||||||
|
@ -771,7 +771,7 @@ impl<'a> State<'a> {
|
||||||
ref ty,
|
ref ty,
|
||||||
ref impl_items) => {
|
ref impl_items) => {
|
||||||
self.head("")?;
|
self.head("")?;
|
||||||
self.print_visibility(item.vis)?;
|
self.print_visibility(&item.vis)?;
|
||||||
self.print_unsafety(unsafety)?;
|
self.print_unsafety(unsafety)?;
|
||||||
self.word_nbsp("impl")?;
|
self.word_nbsp("impl")?;
|
||||||
|
|
||||||
|
@ -809,7 +809,7 @@ impl<'a> State<'a> {
|
||||||
}
|
}
|
||||||
hir::ItemTrait(unsafety, ref generics, ref bounds, ref trait_items) => {
|
hir::ItemTrait(unsafety, ref generics, ref bounds, ref trait_items) => {
|
||||||
self.head("")?;
|
self.head("")?;
|
||||||
self.print_visibility(item.vis)?;
|
self.print_visibility(&item.vis)?;
|
||||||
self.print_unsafety(unsafety)?;
|
self.print_unsafety(unsafety)?;
|
||||||
self.word_nbsp("trait")?;
|
self.word_nbsp("trait")?;
|
||||||
self.print_name(item.name)?;
|
self.print_name(item.name)?;
|
||||||
|
@ -867,7 +867,7 @@ impl<'a> State<'a> {
|
||||||
generics: &hir::Generics,
|
generics: &hir::Generics,
|
||||||
name: ast::Name,
|
name: ast::Name,
|
||||||
span: codemap::Span,
|
span: codemap::Span,
|
||||||
visibility: hir::Visibility)
|
visibility: &hir::Visibility)
|
||||||
-> io::Result<()> {
|
-> io::Result<()> {
|
||||||
self.head(&visibility_qualified(visibility, "enum"))?;
|
self.head(&visibility_qualified(visibility, "enum"))?;
|
||||||
self.print_name(name)?;
|
self.print_name(name)?;
|
||||||
|
@ -895,8 +895,8 @@ impl<'a> State<'a> {
|
||||||
self.bclose(span)
|
self.bclose(span)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn print_visibility(&mut self, vis: hir::Visibility) -> io::Result<()> {
|
pub fn print_visibility(&mut self, vis: &hir::Visibility) -> io::Result<()> {
|
||||||
match vis {
|
match *vis {
|
||||||
hir::Public => self.word_nbsp("pub"),
|
hir::Public => self.word_nbsp("pub"),
|
||||||
hir::Inherited => Ok(()),
|
hir::Inherited => Ok(()),
|
||||||
}
|
}
|
||||||
|
@ -915,7 +915,7 @@ impl<'a> State<'a> {
|
||||||
if struct_def.is_tuple() {
|
if struct_def.is_tuple() {
|
||||||
self.popen()?;
|
self.popen()?;
|
||||||
self.commasep(Inconsistent, struct_def.fields(), |s, field| {
|
self.commasep(Inconsistent, struct_def.fields(), |s, field| {
|
||||||
s.print_visibility(field.vis)?;
|
s.print_visibility(&field.vis)?;
|
||||||
s.maybe_print_comment(field.span.lo)?;
|
s.maybe_print_comment(field.span.lo)?;
|
||||||
s.print_type(&field.ty)
|
s.print_type(&field.ty)
|
||||||
})?;
|
})?;
|
||||||
|
@ -937,7 +937,7 @@ impl<'a> State<'a> {
|
||||||
self.hardbreak_if_not_bol()?;
|
self.hardbreak_if_not_bol()?;
|
||||||
self.maybe_print_comment(field.span.lo)?;
|
self.maybe_print_comment(field.span.lo)?;
|
||||||
self.print_outer_attributes(&field.attrs)?;
|
self.print_outer_attributes(&field.attrs)?;
|
||||||
self.print_visibility(field.vis)?;
|
self.print_visibility(&field.vis)?;
|
||||||
self.print_name(field.name)?;
|
self.print_name(field.name)?;
|
||||||
self.word_nbsp(":")?;
|
self.word_nbsp(":")?;
|
||||||
self.print_type(&field.ty)?;
|
self.print_type(&field.ty)?;
|
||||||
|
@ -964,7 +964,7 @@ impl<'a> State<'a> {
|
||||||
pub fn print_method_sig(&mut self,
|
pub fn print_method_sig(&mut self,
|
||||||
name: ast::Name,
|
name: ast::Name,
|
||||||
m: &hir::MethodSig,
|
m: &hir::MethodSig,
|
||||||
vis: hir::Visibility)
|
vis: &hir::Visibility)
|
||||||
-> io::Result<()> {
|
-> io::Result<()> {
|
||||||
self.print_fn(&m.decl,
|
self.print_fn(&m.decl,
|
||||||
m.unsafety,
|
m.unsafety,
|
||||||
|
@ -986,13 +986,13 @@ impl<'a> State<'a> {
|
||||||
self.print_associated_const(ti.name,
|
self.print_associated_const(ti.name,
|
||||||
&ty,
|
&ty,
|
||||||
default.as_ref().map(|expr| &**expr),
|
default.as_ref().map(|expr| &**expr),
|
||||||
hir::Inherited)?;
|
&hir::Inherited)?;
|
||||||
}
|
}
|
||||||
hir::MethodTraitItem(ref sig, ref body) => {
|
hir::MethodTraitItem(ref sig, ref body) => {
|
||||||
if body.is_some() {
|
if body.is_some() {
|
||||||
self.head("")?;
|
self.head("")?;
|
||||||
}
|
}
|
||||||
self.print_method_sig(ti.name, sig, hir::Inherited)?;
|
self.print_method_sig(ti.name, sig, &hir::Inherited)?;
|
||||||
if let Some(ref body) = *body {
|
if let Some(ref body) = *body {
|
||||||
self.nbsp()?;
|
self.nbsp()?;
|
||||||
self.print_block_with_attrs(body, &ti.attrs)?;
|
self.print_block_with_attrs(body, &ti.attrs)?;
|
||||||
|
@ -1021,11 +1021,11 @@ impl<'a> State<'a> {
|
||||||
|
|
||||||
match ii.node {
|
match ii.node {
|
||||||
hir::ImplItemKind::Const(ref ty, ref expr) => {
|
hir::ImplItemKind::Const(ref ty, ref expr) => {
|
||||||
self.print_associated_const(ii.name, &ty, Some(&expr), ii.vis)?;
|
self.print_associated_const(ii.name, &ty, Some(&expr), &ii.vis)?;
|
||||||
}
|
}
|
||||||
hir::ImplItemKind::Method(ref sig, ref body) => {
|
hir::ImplItemKind::Method(ref sig, ref body) => {
|
||||||
self.head("")?;
|
self.head("")?;
|
||||||
self.print_method_sig(ii.name, sig, ii.vis)?;
|
self.print_method_sig(ii.name, sig, &ii.vis)?;
|
||||||
self.nbsp()?;
|
self.nbsp()?;
|
||||||
self.print_block_with_attrs(body, &ii.attrs)?;
|
self.print_block_with_attrs(body, &ii.attrs)?;
|
||||||
}
|
}
|
||||||
|
@ -1910,7 +1910,7 @@ impl<'a> State<'a> {
|
||||||
name: Option<ast::Name>,
|
name: Option<ast::Name>,
|
||||||
generics: &hir::Generics,
|
generics: &hir::Generics,
|
||||||
opt_explicit_self: Option<&hir::ExplicitSelf_>,
|
opt_explicit_self: Option<&hir::ExplicitSelf_>,
|
||||||
vis: hir::Visibility)
|
vis: &hir::Visibility)
|
||||||
-> io::Result<()> {
|
-> io::Result<()> {
|
||||||
self.print_fn_header_info(unsafety, constness, abi, vis)?;
|
self.print_fn_header_info(unsafety, constness, abi, vis)?;
|
||||||
|
|
||||||
|
@ -2267,7 +2267,7 @@ impl<'a> State<'a> {
|
||||||
name,
|
name,
|
||||||
&generics,
|
&generics,
|
||||||
opt_explicit_self,
|
opt_explicit_self,
|
||||||
hir::Inherited)?;
|
&hir::Inherited)?;
|
||||||
self.end()
|
self.end()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2347,7 +2347,7 @@ impl<'a> State<'a> {
|
||||||
unsafety: hir::Unsafety,
|
unsafety: hir::Unsafety,
|
||||||
constness: hir::Constness,
|
constness: hir::Constness,
|
||||||
abi: Abi,
|
abi: Abi,
|
||||||
vis: hir::Visibility)
|
vis: &hir::Visibility)
|
||||||
-> io::Result<()> {
|
-> io::Result<()> {
|
||||||
word(&mut self.s, &visibility_qualified(vis, ""))?;
|
word(&mut self.s, &visibility_qualified(vis, ""))?;
|
||||||
self.print_unsafety(unsafety)?;
|
self.print_unsafety(unsafety)?;
|
||||||
|
|
|
@ -116,7 +116,7 @@ pub const LOCAL_CRATE: ast::CrateNum = 0;
|
||||||
pub struct ChildItem {
|
pub struct ChildItem {
|
||||||
pub def: DefLike,
|
pub def: DefLike,
|
||||||
pub name: ast::Name,
|
pub name: ast::Name,
|
||||||
pub vis: hir::Visibility
|
pub vis: ty::Visibility,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum FoundAst<'ast> {
|
pub enum FoundAst<'ast> {
|
||||||
|
@ -157,7 +157,7 @@ pub trait CrateStore<'tcx> : Any {
|
||||||
// item info
|
// item info
|
||||||
fn stability(&self, def: DefId) -> Option<attr::Stability>;
|
fn stability(&self, def: DefId) -> Option<attr::Stability>;
|
||||||
fn deprecation(&self, def: DefId) -> Option<attr::Deprecation>;
|
fn deprecation(&self, def: DefId) -> Option<attr::Deprecation>;
|
||||||
fn visibility(&self, def: DefId) -> hir::Visibility;
|
fn visibility(&self, def: DefId) -> ty::Visibility;
|
||||||
fn closure_kind(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
|
fn closure_kind(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
|
||||||
-> ty::ClosureKind;
|
-> ty::ClosureKind;
|
||||||
fn closure_ty(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
|
fn closure_ty(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
|
||||||
|
@ -334,7 +334,7 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
|
||||||
// item info
|
// item info
|
||||||
fn stability(&self, def: DefId) -> Option<attr::Stability> { bug!("stability") }
|
fn stability(&self, def: DefId) -> Option<attr::Stability> { bug!("stability") }
|
||||||
fn deprecation(&self, def: DefId) -> Option<attr::Deprecation> { bug!("deprecation") }
|
fn deprecation(&self, def: DefId) -> Option<attr::Deprecation> { bug!("deprecation") }
|
||||||
fn visibility(&self, def: DefId) -> hir::Visibility { bug!("visibility") }
|
fn visibility(&self, def: DefId) -> ty::Visibility { bug!("visibility") }
|
||||||
fn closure_kind(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
|
fn closure_kind(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
|
||||||
-> ty::ClosureKind { bug!("closure_kind") }
|
-> ty::ClosureKind { bug!("closure_kind") }
|
||||||
fn closure_ty(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
|
fn closure_ty(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
|
||||||
|
|
|
@ -232,7 +232,7 @@ impl<'tcx> ImplOrTraitItem<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn vis(&self) -> hir::Visibility {
|
pub fn vis(&self) -> Visibility {
|
||||||
match *self {
|
match *self {
|
||||||
ConstTraitItem(ref associated_const) => associated_const.vis,
|
ConstTraitItem(ref associated_const) => associated_const.vis,
|
||||||
MethodTraitItem(ref method) => method.vis,
|
MethodTraitItem(ref method) => method.vis,
|
||||||
|
@ -273,6 +273,25 @@ impl ImplOrTraitItemId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, Eq, Copy)]
|
||||||
|
pub enum Visibility {
|
||||||
|
/// Visible everywhere (including in other crates).
|
||||||
|
Public,
|
||||||
|
/// Visible only in the given crate-local module.
|
||||||
|
Restricted(NodeId),
|
||||||
|
/// Not visible anywhere in the local crate. This is the visibility of private external items.
|
||||||
|
PrivateExternal,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Visibility {
|
||||||
|
pub fn from_hir(visibility: &hir::Visibility, id: NodeId, tcx: &TyCtxt) -> Self {
|
||||||
|
match *visibility {
|
||||||
|
hir::Public => Visibility::Public,
|
||||||
|
hir::Inherited => Visibility::Restricted(tcx.map.get_module_parent(id)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Method<'tcx> {
|
pub struct Method<'tcx> {
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
|
@ -280,7 +299,7 @@ pub struct Method<'tcx> {
|
||||||
pub predicates: GenericPredicates<'tcx>,
|
pub predicates: GenericPredicates<'tcx>,
|
||||||
pub fty: BareFnTy<'tcx>,
|
pub fty: BareFnTy<'tcx>,
|
||||||
pub explicit_self: ExplicitSelfCategory,
|
pub explicit_self: ExplicitSelfCategory,
|
||||||
pub vis: hir::Visibility,
|
pub vis: Visibility,
|
||||||
pub defaultness: hir::Defaultness,
|
pub defaultness: hir::Defaultness,
|
||||||
pub def_id: DefId,
|
pub def_id: DefId,
|
||||||
pub container: ImplOrTraitItemContainer,
|
pub container: ImplOrTraitItemContainer,
|
||||||
|
@ -292,7 +311,7 @@ impl<'tcx> Method<'tcx> {
|
||||||
predicates: GenericPredicates<'tcx>,
|
predicates: GenericPredicates<'tcx>,
|
||||||
fty: BareFnTy<'tcx>,
|
fty: BareFnTy<'tcx>,
|
||||||
explicit_self: ExplicitSelfCategory,
|
explicit_self: ExplicitSelfCategory,
|
||||||
vis: hir::Visibility,
|
vis: Visibility,
|
||||||
defaultness: hir::Defaultness,
|
defaultness: hir::Defaultness,
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
container: ImplOrTraitItemContainer)
|
container: ImplOrTraitItemContainer)
|
||||||
|
@ -336,7 +355,7 @@ impl<'tcx> Hash for Method<'tcx> {
|
||||||
pub struct AssociatedConst<'tcx> {
|
pub struct AssociatedConst<'tcx> {
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
pub ty: Ty<'tcx>,
|
pub ty: Ty<'tcx>,
|
||||||
pub vis: hir::Visibility,
|
pub vis: Visibility,
|
||||||
pub defaultness: hir::Defaultness,
|
pub defaultness: hir::Defaultness,
|
||||||
pub def_id: DefId,
|
pub def_id: DefId,
|
||||||
pub container: ImplOrTraitItemContainer,
|
pub container: ImplOrTraitItemContainer,
|
||||||
|
@ -347,7 +366,7 @@ pub struct AssociatedConst<'tcx> {
|
||||||
pub struct AssociatedType<'tcx> {
|
pub struct AssociatedType<'tcx> {
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
pub ty: Option<Ty<'tcx>>,
|
pub ty: Option<Ty<'tcx>>,
|
||||||
pub vis: hir::Visibility,
|
pub vis: Visibility,
|
||||||
pub defaultness: hir::Defaultness,
|
pub defaultness: hir::Defaultness,
|
||||||
pub def_id: DefId,
|
pub def_id: DefId,
|
||||||
pub container: ImplOrTraitItemContainer,
|
pub container: ImplOrTraitItemContainer,
|
||||||
|
@ -1419,7 +1438,7 @@ pub struct FieldDefData<'tcx, 'container: 'tcx> {
|
||||||
/// are not real items, and don't have entries in tcache etc.
|
/// are not real items, and don't have entries in tcache etc.
|
||||||
pub did: DefId,
|
pub did: DefId,
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
pub vis: hir::Visibility,
|
pub vis: Visibility,
|
||||||
/// TyIVar is used here to allow for variance (see the doc at
|
/// TyIVar is used here to allow for variance (see the doc at
|
||||||
/// AdtDefData).
|
/// AdtDefData).
|
||||||
///
|
///
|
||||||
|
@ -1704,7 +1723,7 @@ impl<'tcx, 'container> VariantDefData<'tcx, 'container> {
|
||||||
impl<'tcx, 'container> FieldDefData<'tcx, 'container> {
|
impl<'tcx, 'container> FieldDefData<'tcx, 'container> {
|
||||||
pub fn new(did: DefId,
|
pub fn new(did: DefId,
|
||||||
name: Name,
|
name: Name,
|
||||||
vis: hir::Visibility) -> Self {
|
vis: Visibility) -> Self {
|
||||||
FieldDefData {
|
FieldDefData {
|
||||||
did: did,
|
did: did,
|
||||||
name: name,
|
name: name,
|
||||||
|
|
|
@ -48,7 +48,7 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
|
||||||
decoder::get_deprecation(&cdata, def.index)
|
decoder::get_deprecation(&cdata, def.index)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visibility(&self, def: DefId) -> hir::Visibility {
|
fn visibility(&self, def: DefId) -> ty::Visibility {
|
||||||
let cdata = self.get_crate_data(def.krate);
|
let cdata = self.get_crate_data(def.krate);
|
||||||
decoder::get_visibility(&cdata, def.index)
|
decoder::get_visibility(&cdata, def.index)
|
||||||
}
|
}
|
||||||
|
@ -536,7 +536,6 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
|
||||||
let mut visible_parent_map = self.visible_parent_map.borrow_mut();
|
let mut visible_parent_map = self.visible_parent_map.borrow_mut();
|
||||||
if !visible_parent_map.is_empty() { return visible_parent_map; }
|
if !visible_parent_map.is_empty() { return visible_parent_map; }
|
||||||
|
|
||||||
use rustc::hir;
|
|
||||||
use rustc::middle::cstore::{CrateStore, ChildItem};
|
use rustc::middle::cstore::{CrateStore, ChildItem};
|
||||||
use std::collections::vec_deque::VecDeque;
|
use std::collections::vec_deque::VecDeque;
|
||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
|
@ -552,7 +551,7 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
|
||||||
let mut bfs_queue = &mut VecDeque::new();
|
let mut bfs_queue = &mut VecDeque::new();
|
||||||
let mut add_child = |bfs_queue: &mut VecDeque<_>, child: ChildItem, parent: DefId| {
|
let mut add_child = |bfs_queue: &mut VecDeque<_>, child: ChildItem, parent: DefId| {
|
||||||
let child = match child.def {
|
let child = match child.def {
|
||||||
DefLike::DlDef(def) if child.vis == hir::Public => def.def_id(),
|
DefLike::DlDef(def) if child.vis == ty::Visibility::Public => def.def_id(),
|
||||||
_ => return,
|
_ => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -140,13 +140,13 @@ fn item_family(item: rbml::Doc) -> Family {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn item_visibility(item: rbml::Doc) -> hir::Visibility {
|
fn item_visibility(item: rbml::Doc) -> ty::Visibility {
|
||||||
match reader::maybe_get_doc(item, tag_items_data_item_visibility) {
|
match reader::maybe_get_doc(item, tag_items_data_item_visibility) {
|
||||||
None => hir::Public,
|
None => ty::Visibility::Public,
|
||||||
Some(visibility_doc) => {
|
Some(visibility_doc) => {
|
||||||
match reader::doc_as_u8(visibility_doc) as char {
|
match reader::doc_as_u8(visibility_doc) as char {
|
||||||
'y' => hir::Public,
|
'y' => ty::Visibility::Public,
|
||||||
'i' => hir::Inherited,
|
'i' => ty::Visibility::PrivateExternal,
|
||||||
_ => bug!("unknown visibility character")
|
_ => bug!("unknown visibility character")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -541,7 +541,7 @@ pub fn get_deprecation(cdata: Cmd, id: DefIndex) -> Option<attr::Deprecation> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_visibility(cdata: Cmd, id: DefIndex) -> hir::Visibility {
|
pub fn get_visibility(cdata: Cmd, id: DefIndex) -> ty::Visibility {
|
||||||
item_visibility(cdata.lookup_item(id))
|
item_visibility(cdata.lookup_item(id))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,7 +639,7 @@ fn each_child_of_item_or_crate<F, G>(intr: Rc<IdentInterner>,
|
||||||
item_doc: rbml::Doc,
|
item_doc: rbml::Doc,
|
||||||
mut get_crate_data: G,
|
mut get_crate_data: G,
|
||||||
mut callback: F) where
|
mut callback: F) where
|
||||||
F: FnMut(DefLike, ast::Name, hir::Visibility),
|
F: FnMut(DefLike, ast::Name, ty::Visibility),
|
||||||
G: FnMut(ast::CrateNum) -> Rc<crate_metadata>,
|
G: FnMut(ast::CrateNum) -> Rc<crate_metadata>,
|
||||||
{
|
{
|
||||||
// Iterate over all children.
|
// Iterate over all children.
|
||||||
|
@ -723,7 +723,7 @@ fn each_child_of_item_or_crate<F, G>(intr: Rc<IdentInterner>,
|
||||||
let def_like = item_to_def_like(crate_data, child_item_doc, child_def_id);
|
let def_like = item_to_def_like(crate_data, child_item_doc, child_def_id);
|
||||||
// These items have a public visibility because they're part of
|
// These items have a public visibility because they're part of
|
||||||
// a public re-export.
|
// a public re-export.
|
||||||
callback(def_like, token::intern(name), hir::Public);
|
callback(def_like, token::intern(name), ty::Visibility::Public);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -734,7 +734,7 @@ pub fn each_child_of_item<F, G>(intr: Rc<IdentInterner>,
|
||||||
id: DefIndex,
|
id: DefIndex,
|
||||||
get_crate_data: G,
|
get_crate_data: G,
|
||||||
callback: F) where
|
callback: F) where
|
||||||
F: FnMut(DefLike, ast::Name, hir::Visibility),
|
F: FnMut(DefLike, ast::Name, ty::Visibility),
|
||||||
G: FnMut(ast::CrateNum) -> Rc<crate_metadata>,
|
G: FnMut(ast::CrateNum) -> Rc<crate_metadata>,
|
||||||
{
|
{
|
||||||
// Find the item.
|
// Find the item.
|
||||||
|
@ -755,7 +755,7 @@ pub fn each_top_level_item_of_crate<F, G>(intr: Rc<IdentInterner>,
|
||||||
cdata: Cmd,
|
cdata: Cmd,
|
||||||
get_crate_data: G,
|
get_crate_data: G,
|
||||||
callback: F) where
|
callback: F) where
|
||||||
F: FnMut(DefLike, ast::Name, hir::Visibility),
|
F: FnMut(DefLike, ast::Name, ty::Visibility),
|
||||||
G: FnMut(ast::CrateNum) -> Rc<crate_metadata>,
|
G: FnMut(ast::CrateNum) -> Rc<crate_metadata>,
|
||||||
{
|
{
|
||||||
let root_doc = rbml::Doc::new(cdata.data());
|
let root_doc = rbml::Doc::new(cdata.data());
|
||||||
|
@ -1138,11 +1138,11 @@ pub fn get_struct_field_attrs(cdata: Cmd) -> FnvHashMap<DefId, Vec<ast::Attribut
|
||||||
}).collect()
|
}).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn struct_field_family_to_visibility(family: Family) -> hir::Visibility {
|
fn struct_field_family_to_visibility(family: Family) -> ty::Visibility {
|
||||||
match family {
|
match family {
|
||||||
PublicField => hir::Public,
|
PublicField => ty::Visibility::Public,
|
||||||
InheritedField => hir::Inherited,
|
InheritedField => ty::Visibility::PrivateExternal,
|
||||||
_ => bug!()
|
_ => bug!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -249,7 +249,7 @@ fn encode_struct_fields(rbml_w: &mut Encoder,
|
||||||
fn encode_enum_variant_info<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
|
fn encode_enum_variant_info<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
|
||||||
rbml_w: &mut Encoder,
|
rbml_w: &mut Encoder,
|
||||||
did: DefId,
|
did: DefId,
|
||||||
vis: hir::Visibility,
|
vis: &hir::Visibility,
|
||||||
index: &mut CrateIndex<'tcx>) {
|
index: &mut CrateIndex<'tcx>) {
|
||||||
debug!("encode_enum_variant_info(did={:?})", did);
|
debug!("encode_enum_variant_info(did={:?})", did);
|
||||||
let repr_hints = ecx.tcx.lookup_repr_hints(did);
|
let repr_hints = ecx.tcx.lookup_repr_hints(did);
|
||||||
|
@ -355,7 +355,7 @@ fn encode_info_for_mod(ecx: &EncodeContext,
|
||||||
attrs: &[ast::Attribute],
|
attrs: &[ast::Attribute],
|
||||||
id: NodeId,
|
id: NodeId,
|
||||||
name: Name,
|
name: Name,
|
||||||
vis: hir::Visibility) {
|
vis: &hir::Visibility) {
|
||||||
rbml_w.start_tag(tag_items_data_item);
|
rbml_w.start_tag(tag_items_data_item);
|
||||||
encode_def_id_and_key(ecx, rbml_w, ecx.tcx.map.local_def_id(id));
|
encode_def_id_and_key(ecx, rbml_w, ecx.tcx.map.local_def_id(id));
|
||||||
encode_family(rbml_w, 'm');
|
encode_family(rbml_w, 'm');
|
||||||
|
@ -383,7 +383,7 @@ fn encode_info_for_mod(ecx: &EncodeContext,
|
||||||
encode_deprecation(rbml_w, depr);
|
encode_deprecation(rbml_w, depr);
|
||||||
|
|
||||||
// Encode the reexports of this module, if this module is public.
|
// Encode the reexports of this module, if this module is public.
|
||||||
if vis == hir::Public {
|
if *vis == hir::Public {
|
||||||
debug!("(encoding info for module) encoding reexports for {}", id);
|
debug!("(encoding info for module) encoding reexports for {}", id);
|
||||||
encode_reexports(ecx, rbml_w, id);
|
encode_reexports(ecx, rbml_w, id);
|
||||||
}
|
}
|
||||||
|
@ -393,21 +393,31 @@ fn encode_info_for_mod(ecx: &EncodeContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn encode_struct_field_family(rbml_w: &mut Encoder,
|
fn encode_struct_field_family(rbml_w: &mut Encoder,
|
||||||
visibility: hir::Visibility) {
|
visibility: ty::Visibility) {
|
||||||
encode_family(rbml_w, match visibility {
|
encode_family(rbml_w, if visibility.is_public() { 'g' } else { 'N' });
|
||||||
hir::Public => 'g',
|
|
||||||
hir::Inherited => 'N'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn encode_visibility(rbml_w: &mut Encoder, visibility: hir::Visibility) {
|
fn encode_visibility<T: HasVisibility>(rbml_w: &mut Encoder, visibility: T) {
|
||||||
let ch = match visibility {
|
let ch = if visibility.is_public() { 'y' } else { 'i' };
|
||||||
hir::Public => 'y',
|
|
||||||
hir::Inherited => 'i',
|
|
||||||
};
|
|
||||||
rbml_w.wr_tagged_u8(tag_items_data_item_visibility, ch as u8);
|
rbml_w.wr_tagged_u8(tag_items_data_item_visibility, ch as u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trait HasVisibility: Sized {
|
||||||
|
fn is_public(self) -> bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> HasVisibility for &'a hir::Visibility {
|
||||||
|
fn is_public(self) -> bool {
|
||||||
|
*self == hir::Public
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HasVisibility for ty::Visibility {
|
||||||
|
fn is_public(self) -> bool {
|
||||||
|
self == ty::Visibility::Public
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn encode_constness(rbml_w: &mut Encoder, constness: hir::Constness) {
|
fn encode_constness(rbml_w: &mut Encoder, constness: hir::Constness) {
|
||||||
rbml_w.start_tag(tag_items_data_item_constness);
|
rbml_w.start_tag(tag_items_data_item_constness);
|
||||||
let ch = match constness {
|
let ch = match constness {
|
||||||
|
@ -861,7 +871,7 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
|
||||||
debug!("encoding info for item at {}",
|
debug!("encoding info for item at {}",
|
||||||
tcx.sess.codemap().span_to_string(item.span));
|
tcx.sess.codemap().span_to_string(item.span));
|
||||||
|
|
||||||
let vis = item.vis;
|
let vis = &item.vis;
|
||||||
let def_id = ecx.tcx.map.local_def_id(item.id);
|
let def_id = ecx.tcx.map.local_def_id(item.id);
|
||||||
let stab = stability::lookup_stability(tcx, ecx.tcx.map.local_def_id(item.id));
|
let stab = stability::lookup_stability(tcx, ecx.tcx.map.local_def_id(item.id));
|
||||||
let depr = stability::lookup_deprecation(tcx, ecx.tcx.map.local_def_id(item.id));
|
let depr = stability::lookup_deprecation(tcx, ecx.tcx.map.local_def_id(item.id));
|
||||||
|
@ -932,7 +942,7 @@ fn encode_info_for_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
|
||||||
&item.attrs,
|
&item.attrs,
|
||||||
item.id,
|
item.id,
|
||||||
item.name,
|
item.name,
|
||||||
item.vis);
|
&item.vis);
|
||||||
}
|
}
|
||||||
hir::ItemForeignMod(ref fm) => {
|
hir::ItemForeignMod(ref fm) => {
|
||||||
index.record(def_id, rbml_w);
|
index.record(def_id, rbml_w);
|
||||||
|
@ -1336,7 +1346,7 @@ fn encode_info_for_foreign_item<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
|
||||||
index.record(def_id, rbml_w);
|
index.record(def_id, rbml_w);
|
||||||
rbml_w.start_tag(tag_items_data_item);
|
rbml_w.start_tag(tag_items_data_item);
|
||||||
encode_def_id_and_key(ecx, rbml_w, def_id);
|
encode_def_id_and_key(ecx, rbml_w, def_id);
|
||||||
encode_visibility(rbml_w, nitem.vis);
|
encode_visibility(rbml_w, &nitem.vis);
|
||||||
match nitem.node {
|
match nitem.node {
|
||||||
hir::ForeignItemFn(ref fndecl, _) => {
|
hir::ForeignItemFn(ref fndecl, _) => {
|
||||||
encode_family(rbml_w, FN_FAMILY);
|
encode_family(rbml_w, FN_FAMILY);
|
||||||
|
@ -1443,7 +1453,7 @@ fn encode_info_for_items<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
|
||||||
&[],
|
&[],
|
||||||
CRATE_NODE_ID,
|
CRATE_NODE_ID,
|
||||||
syntax::parse::token::intern(&ecx.link_meta.crate_name),
|
syntax::parse::token::intern(&ecx.link_meta.crate_name),
|
||||||
hir::Public);
|
&hir::Public);
|
||||||
|
|
||||||
krate.visit_all_items(&mut EncodeVisitor {
|
krate.visit_all_items(&mut EncodeVisitor {
|
||||||
index: &mut index,
|
index: &mut index,
|
||||||
|
|
|
@ -383,11 +383,11 @@ struct PrivacyVisitor<'a, 'tcx: 'a> {
|
||||||
|
|
||||||
impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
|
impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
|
||||||
fn item_is_visible(&self, did: DefId) -> bool {
|
fn item_is_visible(&self, did: DefId) -> bool {
|
||||||
let visibility = match self.tcx.map.as_local_node_id(did) {
|
let is_public = match self.tcx.map.as_local_node_id(did) {
|
||||||
Some(node_id) => self.tcx.map.expect_item(node_id).vis,
|
Some(node_id) => self.tcx.map.expect_item(node_id).vis == hir::Public,
|
||||||
None => self.tcx.sess.cstore.visibility(did),
|
None => self.tcx.sess.cstore.visibility(did) == ty::Visibility::Public,
|
||||||
};
|
};
|
||||||
visibility == hir::Public || self.private_accessible(did)
|
is_public || self.private_accessible(did)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// True if `did` is private-accessible
|
/// True if `did` is private-accessible
|
||||||
|
@ -401,7 +401,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
|
||||||
// Checks that a field is in scope.
|
// Checks that a field is in scope.
|
||||||
fn check_field(&mut self, span: Span, def: ty::AdtDef<'tcx>, field: ty::FieldDef<'tcx>) {
|
fn check_field(&mut self, span: Span, def: ty::AdtDef<'tcx>, field: ty::FieldDef<'tcx>) {
|
||||||
if def.adt_kind() == ty::AdtKind::Struct &&
|
if def.adt_kind() == ty::AdtKind::Struct &&
|
||||||
field.vis != hir::Public && !self.private_accessible(def.did) {
|
field.vis != ty::Visibility::Public && !self.private_accessible(def.did) {
|
||||||
span_err!(self.tcx.sess, span, E0451, "field `{}` of struct `{}` is private",
|
span_err!(self.tcx.sess, span, E0451, "field `{}` of struct `{}` is private",
|
||||||
field.name, self.tcx.item_path_str(def.did));
|
field.name, self.tcx.item_path_str(def.did));
|
||||||
}
|
}
|
||||||
|
@ -464,7 +464,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
|
||||||
_ => expr_ty
|
_ => expr_ty
|
||||||
}.ty_adt_def().unwrap();
|
}.ty_adt_def().unwrap();
|
||||||
let any_priv = def.struct_variant().fields.iter().any(|f| {
|
let any_priv = def.struct_variant().fields.iter().any(|f| {
|
||||||
f.vis != hir::Public && !self.private_accessible(def.did)
|
f.vis != ty::Visibility::Public && !self.private_accessible(def.did)
|
||||||
});
|
});
|
||||||
if any_priv {
|
if any_priv {
|
||||||
span_err!(self.tcx.sess, expr.span, E0450,
|
span_err!(self.tcx.sess, expr.span, E0450,
|
||||||
|
@ -548,8 +548,8 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> {
|
||||||
/// Such qualifiers can be set by syntax extensions even if the parser doesn't allow them,
|
/// Such qualifiers can be set by syntax extensions even if the parser doesn't allow them,
|
||||||
/// so we check things like variant fields too.
|
/// so we check things like variant fields too.
|
||||||
fn check_sane_privacy(&self, item: &hir::Item) {
|
fn check_sane_privacy(&self, item: &hir::Item) {
|
||||||
let check_inherited = |sp, vis, note: &str| {
|
let check_inherited = |sp, vis: &hir::Visibility, note: &str| {
|
||||||
if vis != hir::Inherited {
|
if *vis != hir::Inherited {
|
||||||
let mut err = struct_span_err!(self.tcx.sess, sp, E0449,
|
let mut err = struct_span_err!(self.tcx.sess, sp, E0449,
|
||||||
"unnecessary visibility qualifier");
|
"unnecessary visibility qualifier");
|
||||||
if !note.is_empty() {
|
if !note.is_empty() {
|
||||||
|
@ -561,29 +561,29 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> {
|
||||||
|
|
||||||
match item.node {
|
match item.node {
|
||||||
hir::ItemImpl(_, _, _, Some(..), _, ref impl_items) => {
|
hir::ItemImpl(_, _, _, Some(..), _, ref impl_items) => {
|
||||||
check_inherited(item.span, item.vis,
|
check_inherited(item.span, &item.vis,
|
||||||
"visibility qualifiers have no effect on trait impls");
|
"visibility qualifiers have no effect on trait impls");
|
||||||
for impl_item in impl_items {
|
for impl_item in impl_items {
|
||||||
check_inherited(impl_item.span, impl_item.vis,
|
check_inherited(impl_item.span, &impl_item.vis,
|
||||||
"visibility qualifiers have no effect on trait impl items");
|
"visibility qualifiers have no effect on trait impl items");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hir::ItemImpl(_, _, _, None, _, _) => {
|
hir::ItemImpl(_, _, _, None, _, _) => {
|
||||||
check_inherited(item.span, item.vis,
|
check_inherited(item.span, &item.vis,
|
||||||
"place qualifiers on individual methods instead");
|
"place qualifiers on individual methods instead");
|
||||||
}
|
}
|
||||||
hir::ItemDefaultImpl(..) => {
|
hir::ItemDefaultImpl(..) => {
|
||||||
check_inherited(item.span, item.vis,
|
check_inherited(item.span, &item.vis,
|
||||||
"visibility qualifiers have no effect on trait impls");
|
"visibility qualifiers have no effect on trait impls");
|
||||||
}
|
}
|
||||||
hir::ItemForeignMod(..) => {
|
hir::ItemForeignMod(..) => {
|
||||||
check_inherited(item.span, item.vis,
|
check_inherited(item.span, &item.vis,
|
||||||
"place qualifiers on individual functions instead");
|
"place qualifiers on individual functions instead");
|
||||||
}
|
}
|
||||||
hir::ItemEnum(ref def, _) => {
|
hir::ItemEnum(ref def, _) => {
|
||||||
for variant in &def.variants {
|
for variant in &def.variants {
|
||||||
for field in variant.node.data.fields() {
|
for field in variant.node.data.fields() {
|
||||||
check_inherited(field.span, field.vis,
|
check_inherited(field.span, &field.vis,
|
||||||
"visibility qualifiers have no effect on variant fields");
|
"visibility qualifiers have no effect on variant fields");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -659,8 +659,8 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn item_is_public(&self, id: &ast::NodeId, vis: hir::Visibility) -> bool {
|
fn item_is_public(&self, id: &ast::NodeId, vis: &hir::Visibility) -> bool {
|
||||||
self.access_levels.is_reachable(*id) || vis == hir::Public
|
self.access_levels.is_reachable(*id) || *vis == hir::Public
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -789,7 +789,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx>
|
||||||
match impl_item.node {
|
match impl_item.node {
|
||||||
hir::ImplItemKind::Const(..) |
|
hir::ImplItemKind::Const(..) |
|
||||||
hir::ImplItemKind::Method(..)
|
hir::ImplItemKind::Method(..)
|
||||||
if self.item_is_public(&impl_item.id, impl_item.vis) =>
|
if self.item_is_public(&impl_item.id, &impl_item.vis) =>
|
||||||
{
|
{
|
||||||
intravisit::walk_impl_item(self, impl_item)
|
intravisit::walk_impl_item(self, impl_item)
|
||||||
}
|
}
|
||||||
|
@ -831,14 +831,14 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx>
|
||||||
for impl_item in impl_items {
|
for impl_item in impl_items {
|
||||||
match impl_item.node {
|
match impl_item.node {
|
||||||
hir::ImplItemKind::Const(..) => {
|
hir::ImplItemKind::Const(..) => {
|
||||||
if self.item_is_public(&impl_item.id, impl_item.vis) {
|
if self.item_is_public(&impl_item.id, &impl_item.vis) {
|
||||||
found_pub_static = true;
|
found_pub_static = true;
|
||||||
intravisit::walk_impl_item(self, impl_item);
|
intravisit::walk_impl_item(self, impl_item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hir::ImplItemKind::Method(ref sig, _) => {
|
hir::ImplItemKind::Method(ref sig, _) => {
|
||||||
if sig.explicit_self.node == hir::SelfStatic &&
|
if sig.explicit_self.node == hir::SelfStatic &&
|
||||||
self.item_is_public(&impl_item.id, impl_item.vis) {
|
self.item_is_public(&impl_item.id, &impl_item.vis) {
|
||||||
found_pub_static = true;
|
found_pub_static = true;
|
||||||
intravisit::walk_impl_item(self, impl_item);
|
intravisit::walk_impl_item(self, impl_item);
|
||||||
}
|
}
|
||||||
|
@ -858,7 +858,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx>
|
||||||
hir::ItemTy(..) => return,
|
hir::ItemTy(..) => return,
|
||||||
|
|
||||||
// not at all public, so we don't care
|
// not at all public, so we don't care
|
||||||
_ if !self.item_is_public(&item.id, item.vis) => {
|
_ if !self.item_is_public(&item.id, &item.vis) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ use rustc::middle::cstore::{CrateStore, ChildItem, DlDef};
|
||||||
use rustc::lint;
|
use rustc::lint;
|
||||||
use rustc::hir::def::*;
|
use rustc::hir::def::*;
|
||||||
use rustc::hir::def_id::{CRATE_DEF_INDEX, DefId};
|
use rustc::hir::def_id::{CRATE_DEF_INDEX, DefId};
|
||||||
use rustc::ty::VariantKind;
|
use rustc::ty::{self, VariantKind};
|
||||||
|
|
||||||
use syntax::ast::Name;
|
use syntax::ast::Name;
|
||||||
use syntax::attr::AttrMetaMethods;
|
use syntax::attr::AttrMetaMethods;
|
||||||
|
@ -434,7 +434,7 @@ impl<'b, 'tcx:'b> Resolver<'b, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let name = xcdef.name;
|
let name = xcdef.name;
|
||||||
let is_public = xcdef.vis == hir::Public || parent.is_trait();
|
let is_public = xcdef.vis == ty::Visibility::Public || parent.is_trait();
|
||||||
|
|
||||||
let mut modifiers = DefModifiers::empty();
|
let mut modifiers = DefModifiers::empty();
|
||||||
if is_public {
|
if is_public {
|
||||||
|
|
|
@ -16,7 +16,7 @@ use hir::def::Def;
|
||||||
use hir::def_id::DefId;
|
use hir::def_id::DefId;
|
||||||
use rustc::ty::subst;
|
use rustc::ty::subst;
|
||||||
use rustc::traits;
|
use rustc::traits;
|
||||||
use rustc::ty::{self, TyCtxt, ToPredicate, ToPolyTraitRef, TraitRef, TypeFoldable};
|
use rustc::ty::{self, TyCtxt, ToPredicate, ToPolyTraitRef, TraitRef, TypeFoldable, Visibility};
|
||||||
use rustc::ty::adjustment::{AdjustDerefRef, AutoDerefRef, AutoPtr};
|
use rustc::ty::adjustment::{AdjustDerefRef, AutoDerefRef, AutoPtr};
|
||||||
use rustc::infer;
|
use rustc::infer;
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ pub fn resolve_ufcs<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
|
||||||
let def = pick.item.def();
|
let def = pick.item.def();
|
||||||
|
|
||||||
if let probe::InherentImplPick = pick.kind {
|
if let probe::InherentImplPick = pick.kind {
|
||||||
if pick.item.vis() != hir::Public && !fcx.private_item_is_visible(def.def_id()) {
|
if pick.item.vis() != Visibility::Public && !fcx.private_item_is_visible(def.def_id()) {
|
||||||
let msg = format!("{} `{}` is private", def.kind_name(), &method_name.as_str());
|
let msg = format!("{} `{}` is private", def.kind_name(), &method_name.as_str());
|
||||||
fcx.tcx().sess.span_err(span, &msg);
|
fcx.tcx().sess.span_err(span, &msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ use hir::def::Def;
|
||||||
use rustc::ty::subst;
|
use rustc::ty::subst;
|
||||||
use rustc::ty::subst::Subst;
|
use rustc::ty::subst::Subst;
|
||||||
use rustc::traits;
|
use rustc::traits;
|
||||||
use rustc::ty::{self, NoPreference, Ty, TyCtxt, ToPolyTraitRef, TraitRef, TypeFoldable};
|
use rustc::ty::{self, NoPreference, Ty, TyCtxt, ToPolyTraitRef, TraitRef, TypeFoldable, Visibility};
|
||||||
use rustc::infer::{self, InferCtxt, InferOk, TypeOrigin};
|
use rustc::infer::{self, InferCtxt, InferOk, TypeOrigin};
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::codemap::{Span, DUMMY_SP};
|
use syntax::codemap::{Span, DUMMY_SP};
|
||||||
|
@ -412,7 +412,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> {
|
||||||
return self.record_static_candidate(ImplSource(impl_def_id));
|
return self.record_static_candidate(ImplSource(impl_def_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if item.vis() != hir::Public && !self.fcx.private_item_is_visible(item.def_id()) {
|
if item.vis() != Visibility::Public && !self.fcx.private_item_is_visible(item.def_id()) {
|
||||||
self.private_candidate = Some(item.def());
|
self.private_candidate = Some(item.def());
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ use rustc::traits::{self, report_fulfillment_errors, ProjectionMode};
|
||||||
use rustc::ty::{GenericPredicates, TypeScheme};
|
use rustc::ty::{GenericPredicates, TypeScheme};
|
||||||
use rustc::ty::{ParamTy, ParameterEnvironment};
|
use rustc::ty::{ParamTy, ParameterEnvironment};
|
||||||
use rustc::ty::{LvaluePreference, NoPreference, PreferMutLvalue};
|
use rustc::ty::{LvaluePreference, NoPreference, PreferMutLvalue};
|
||||||
use rustc::ty::{self, ToPolyTraitRef, Ty, TyCtxt};
|
use rustc::ty::{self, ToPolyTraitRef, Ty, TyCtxt, Visibility};
|
||||||
use rustc::ty::{MethodCall, MethodCallee};
|
use rustc::ty::{MethodCall, MethodCallee};
|
||||||
use rustc::ty::adjustment;
|
use rustc::ty::adjustment;
|
||||||
use rustc::ty::error::TypeError;
|
use rustc::ty::error::TypeError;
|
||||||
|
@ -125,8 +125,7 @@ use syntax::ptr::P;
|
||||||
use syntax::util::lev_distance::find_best_match_for_name;
|
use syntax::util::lev_distance::find_best_match_for_name;
|
||||||
|
|
||||||
use rustc::hir::intravisit::{self, Visitor};
|
use rustc::hir::intravisit::{self, Visitor};
|
||||||
use rustc::hir;
|
use rustc::hir::{self, PatKind};
|
||||||
use rustc::hir::{Visibility, PatKind};
|
|
||||||
use rustc::hir::print as pprust;
|
use rustc::hir::print as pprust;
|
||||||
use rustc_back::slice;
|
use rustc_back::slice;
|
||||||
use rustc_const_eval::eval_repeat_count;
|
use rustc_const_eval::eval_repeat_count;
|
||||||
|
@ -2967,7 +2966,8 @@ fn check_expr_with_expectation_and_lvalue_pref<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
|
||||||
debug!("struct named {:?}", base_t);
|
debug!("struct named {:?}", base_t);
|
||||||
if let Some(field) = base_def.struct_variant().find_field_named(field.node) {
|
if let Some(field) = base_def.struct_variant().find_field_named(field.node) {
|
||||||
let field_ty = fcx.field_ty(expr.span, field, substs);
|
let field_ty = fcx.field_ty(expr.span, field, substs);
|
||||||
if field.vis == hir::Public || fcx.private_item_is_visible(base_def.did) {
|
if field.vis == Visibility::Public ||
|
||||||
|
fcx.private_item_is_visible(base_def.did) {
|
||||||
return Some(field_ty);
|
return Some(field_ty);
|
||||||
}
|
}
|
||||||
private_candidate = Some((base_def.did, field_ty));
|
private_candidate = Some((base_def.did, field_ty));
|
||||||
|
@ -3079,7 +3079,7 @@ fn check_expr_with_expectation_and_lvalue_pref<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
|
||||||
debug!("tuple struct named {:?}", base_t);
|
debug!("tuple struct named {:?}", base_t);
|
||||||
if let Some(field) = base_def.struct_variant().fields.get(idx.node) {
|
if let Some(field) = base_def.struct_variant().fields.get(idx.node) {
|
||||||
let field_ty = fcx.field_ty(expr.span, field, substs);
|
let field_ty = fcx.field_ty(expr.span, field, substs);
|
||||||
if field.vis == hir::Public || fcx.private_item_is_visible(base_def.did) {
|
if field.vis == Visibility::Public || fcx.private_item_is_visible(base_def.did) {
|
||||||
return Some(field_ty);
|
return Some(field_ty);
|
||||||
}
|
}
|
||||||
private_candidate = Some((base_def.did, field_ty));
|
private_candidate = Some((base_def.did, field_ty));
|
||||||
|
|
|
@ -532,7 +532,7 @@ fn convert_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
||||||
container: ImplOrTraitItemContainer,
|
container: ImplOrTraitItemContainer,
|
||||||
name: ast::Name,
|
name: ast::Name,
|
||||||
id: ast::NodeId,
|
id: ast::NodeId,
|
||||||
vis: hir::Visibility,
|
vis: &hir::Visibility,
|
||||||
sig: &hir::MethodSig,
|
sig: &hir::MethodSig,
|
||||||
defaultness: hir::Defaultness,
|
defaultness: hir::Defaultness,
|
||||||
untransformed_rcvr_ty: Ty<'tcx>,
|
untransformed_rcvr_ty: Ty<'tcx>,
|
||||||
|
@ -555,7 +555,7 @@ fn convert_method<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
||||||
ty_generic_predicates,
|
ty_generic_predicates,
|
||||||
fty,
|
fty,
|
||||||
explicit_self_category,
|
explicit_self_category,
|
||||||
vis,
|
ty::Visibility::from_hir(vis, id, ccx.tcx),
|
||||||
defaultness,
|
defaultness,
|
||||||
def_id,
|
def_id,
|
||||||
container);
|
container);
|
||||||
|
@ -602,7 +602,7 @@ fn convert_associated_const<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
||||||
container: ImplOrTraitItemContainer,
|
container: ImplOrTraitItemContainer,
|
||||||
name: ast::Name,
|
name: ast::Name,
|
||||||
id: ast::NodeId,
|
id: ast::NodeId,
|
||||||
vis: hir::Visibility,
|
vis: &hir::Visibility,
|
||||||
defaultness: hir::Defaultness,
|
defaultness: hir::Defaultness,
|
||||||
ty: ty::Ty<'tcx>,
|
ty: ty::Ty<'tcx>,
|
||||||
has_value: bool)
|
has_value: bool)
|
||||||
|
@ -614,7 +614,7 @@ fn convert_associated_const<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
||||||
|
|
||||||
let associated_const = Rc::new(ty::AssociatedConst {
|
let associated_const = Rc::new(ty::AssociatedConst {
|
||||||
name: name,
|
name: name,
|
||||||
vis: vis,
|
vis: ty::Visibility::from_hir(vis, id, ccx.tcx),
|
||||||
defaultness: defaultness,
|
defaultness: defaultness,
|
||||||
def_id: ccx.tcx.map.local_def_id(id),
|
def_id: ccx.tcx.map.local_def_id(id),
|
||||||
container: container,
|
container: container,
|
||||||
|
@ -629,13 +629,13 @@ fn convert_associated_type<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
||||||
container: ImplOrTraitItemContainer,
|
container: ImplOrTraitItemContainer,
|
||||||
name: ast::Name,
|
name: ast::Name,
|
||||||
id: ast::NodeId,
|
id: ast::NodeId,
|
||||||
vis: hir::Visibility,
|
vis: &hir::Visibility,
|
||||||
defaultness: hir::Defaultness,
|
defaultness: hir::Defaultness,
|
||||||
ty: Option<Ty<'tcx>>)
|
ty: Option<Ty<'tcx>>)
|
||||||
{
|
{
|
||||||
let associated_type = Rc::new(ty::AssociatedType {
|
let associated_type = Rc::new(ty::AssociatedType {
|
||||||
name: name,
|
name: name,
|
||||||
vis: vis,
|
vis: ty::Visibility::from_hir(vis, id, ccx.tcx),
|
||||||
defaultness: defaultness,
|
defaultness: defaultness,
|
||||||
ty: ty,
|
ty: ty,
|
||||||
def_id: ccx.tcx.map.local_def_id(id),
|
def_id: ccx.tcx.map.local_def_id(id),
|
||||||
|
@ -761,8 +761,8 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
|
||||||
ty: ty,
|
ty: ty,
|
||||||
});
|
});
|
||||||
// Trait-associated constants are always public.
|
// Trait-associated constants are always public.
|
||||||
let visibility =
|
let public = &hir::Public;
|
||||||
if opt_trait_ref.is_some() { hir::Public } else { impl_item.vis };
|
let visibility = if opt_trait_ref.is_some() { public } else { &impl_item.vis };
|
||||||
convert_associated_const(ccx, ImplContainer(def_id),
|
convert_associated_const(ccx, ImplContainer(def_id),
|
||||||
impl_item.name, impl_item.id,
|
impl_item.name, impl_item.id,
|
||||||
visibility,
|
visibility,
|
||||||
|
@ -782,7 +782,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
|
||||||
let typ = ccx.icx(&ty_predicates).to_ty(&ExplicitRscope, ty);
|
let typ = ccx.icx(&ty_predicates).to_ty(&ExplicitRscope, ty);
|
||||||
|
|
||||||
convert_associated_type(ccx, ImplContainer(def_id),
|
convert_associated_type(ccx, ImplContainer(def_id),
|
||||||
impl_item.name, impl_item.id, impl_item.vis,
|
impl_item.name, impl_item.id, &impl_item.vis,
|
||||||
impl_item.defaultness, Some(typ));
|
impl_item.defaultness, Some(typ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -790,8 +790,8 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
|
||||||
for impl_item in impl_items {
|
for impl_item in impl_items {
|
||||||
if let hir::ImplItemKind::Method(ref sig, _) = impl_item.node {
|
if let hir::ImplItemKind::Method(ref sig, _) = impl_item.node {
|
||||||
// Trait methods are always public.
|
// Trait methods are always public.
|
||||||
let method_vis =
|
let public = &hir::Public;
|
||||||
if opt_trait_ref.is_some() { hir::Public } else { impl_item.vis };
|
let method_vis = if opt_trait_ref.is_some() { public } else { &impl_item.vis };
|
||||||
|
|
||||||
convert_method(ccx, ImplContainer(def_id),
|
convert_method(ccx, ImplContainer(def_id),
|
||||||
impl_item.name, impl_item.id, method_vis,
|
impl_item.name, impl_item.id, method_vis,
|
||||||
|
@ -829,7 +829,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
|
||||||
container,
|
container,
|
||||||
trait_item.name,
|
trait_item.name,
|
||||||
trait_item.id,
|
trait_item.id,
|
||||||
hir::Public,
|
&hir::Public,
|
||||||
hir::Defaultness::Default,
|
hir::Defaultness::Default,
|
||||||
ty,
|
ty,
|
||||||
default.is_some())
|
default.is_some())
|
||||||
|
@ -847,7 +847,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
|
||||||
container,
|
container,
|
||||||
trait_item.name,
|
trait_item.name,
|
||||||
trait_item.id,
|
trait_item.id,
|
||||||
hir::Public,
|
&hir::Public,
|
||||||
hir::Defaultness::Default,
|
hir::Defaultness::Default,
|
||||||
typ);
|
typ);
|
||||||
}
|
}
|
||||||
|
@ -860,7 +860,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
|
||||||
container,
|
container,
|
||||||
trait_item.name,
|
trait_item.name,
|
||||||
trait_item.id,
|
trait_item.id,
|
||||||
hir::Inherited,
|
&hir::Inherited,
|
||||||
sig,
|
sig,
|
||||||
hir::Defaultness::Default,
|
hir::Defaultness::Default,
|
||||||
tcx.mk_self_type(),
|
tcx.mk_self_type(),
|
||||||
|
@ -977,6 +977,7 @@ fn convert_struct_variant<'tcx>(tcx: &TyCtxt<'tcx>,
|
||||||
disr_val: ty::Disr,
|
disr_val: ty::Disr,
|
||||||
def: &hir::VariantData) -> ty::VariantDefData<'tcx, 'tcx> {
|
def: &hir::VariantData) -> ty::VariantDefData<'tcx, 'tcx> {
|
||||||
let mut seen_fields: FnvHashMap<ast::Name, Span> = FnvHashMap();
|
let mut seen_fields: FnvHashMap<ast::Name, Span> = FnvHashMap();
|
||||||
|
let node_id = tcx.map.as_local_node_id(did).unwrap();
|
||||||
let fields = def.fields().iter().map(|f| {
|
let fields = def.fields().iter().map(|f| {
|
||||||
let fid = tcx.map.local_def_id(f.id);
|
let fid = tcx.map.local_def_id(f.id);
|
||||||
let dup_span = seen_fields.get(&f.name).cloned();
|
let dup_span = seen_fields.get(&f.name).cloned();
|
||||||
|
@ -990,7 +991,7 @@ fn convert_struct_variant<'tcx>(tcx: &TyCtxt<'tcx>,
|
||||||
seen_fields.insert(f.name, f.span);
|
seen_fields.insert(f.name, f.span);
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::FieldDefData::new(fid, f.name, f.vis)
|
ty::FieldDefData::new(fid, f.name, ty::Visibility::from_hir(&f.vis, node_id, tcx))
|
||||||
}).collect();
|
}).collect();
|
||||||
ty::VariantDefData {
|
ty::VariantDefData {
|
||||||
did: did,
|
did: did,
|
||||||
|
|
|
@ -361,7 +361,7 @@ pub fn build_impl(cx: &DocContext,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ty::MethodTraitItem(method) => {
|
ty::MethodTraitItem(method) => {
|
||||||
if method.vis != hir::Public && associated_trait.is_none() {
|
if method.vis != ty::Visibility::Public && associated_trait.is_none() {
|
||||||
return None
|
return None
|
||||||
}
|
}
|
||||||
let mut item = method.clean(cx);
|
let mut item = method.clean(cx);
|
||||||
|
@ -471,7 +471,7 @@ fn build_module(cx: &DocContext, tcx: &TyCtxt,
|
||||||
cstore::DlDef(Def::ForeignMod(did)) => {
|
cstore::DlDef(Def::ForeignMod(did)) => {
|
||||||
fill_in(cx, tcx, did, items);
|
fill_in(cx, tcx, did, items);
|
||||||
}
|
}
|
||||||
cstore::DlDef(def) if item.vis == hir::Public => {
|
cstore::DlDef(def) if item.vis == ty::Visibility::Public => {
|
||||||
if !visited.insert(def) { continue }
|
if !visited.insert(def) { continue }
|
||||||
if let Some(i) = try_inline_def(cx, tcx, def) {
|
if let Some(i) = try_inline_def(cx, tcx, def) {
|
||||||
items.extend(i)
|
items.extend(i)
|
||||||
|
|
|
@ -1754,7 +1754,7 @@ impl Clean<Item> for hir::StructField {
|
||||||
name: Some(self.name).clean(cx),
|
name: Some(self.name).clean(cx),
|
||||||
attrs: self.attrs.clean(cx),
|
attrs: self.attrs.clean(cx),
|
||||||
source: self.span.clean(cx),
|
source: self.span.clean(cx),
|
||||||
visibility: Some(self.vis),
|
visibility: self.vis.clean(cx),
|
||||||
stability: get_stability(cx, cx.map.local_def_id(self.id)),
|
stability: get_stability(cx, cx.map.local_def_id(self.id)),
|
||||||
deprecation: get_deprecation(cx, cx.map.local_def_id(self.id)),
|
deprecation: get_deprecation(cx, cx.map.local_def_id(self.id)),
|
||||||
def_id: cx.map.local_def_id(self.id),
|
def_id: cx.map.local_def_id(self.id),
|
||||||
|
@ -1771,7 +1771,7 @@ impl<'tcx> Clean<Item> for ty::FieldDefData<'tcx, 'static> {
|
||||||
name: Some(self.name).clean(cx),
|
name: Some(self.name).clean(cx),
|
||||||
attrs: attr_map.get(&self.did).unwrap_or(&Vec::new()).clean(cx),
|
attrs: attr_map.get(&self.did).unwrap_or(&Vec::new()).clean(cx),
|
||||||
source: Span::empty(),
|
source: Span::empty(),
|
||||||
visibility: Some(self.vis),
|
visibility: self.vis.clean(cx),
|
||||||
stability: get_stability(cx, self.did),
|
stability: get_stability(cx, self.did),
|
||||||
deprecation: get_deprecation(cx, self.did),
|
deprecation: get_deprecation(cx, self.did),
|
||||||
def_id: self.did,
|
def_id: self.did,
|
||||||
|
@ -1784,7 +1784,13 @@ pub type Visibility = hir::Visibility;
|
||||||
|
|
||||||
impl Clean<Option<Visibility>> for hir::Visibility {
|
impl Clean<Option<Visibility>> for hir::Visibility {
|
||||||
fn clean(&self, _: &DocContext) -> Option<Visibility> {
|
fn clean(&self, _: &DocContext) -> Option<Visibility> {
|
||||||
Some(*self)
|
Some(self.clone())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Clean<Option<Visibility>> for ty::Visibility {
|
||||||
|
fn clean(&self, _: &DocContext) -> Option<Visibility> {
|
||||||
|
Some(if *self == ty::Visibility::Public { hir::Public } else { hir::Inherited })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1902,7 +1908,7 @@ impl<'tcx> Clean<Item> for ty::VariantDefData<'tcx, 'static> {
|
||||||
source: Span::empty(),
|
source: Span::empty(),
|
||||||
name: Some(field.name.clean(cx)),
|
name: Some(field.name.clean(cx)),
|
||||||
attrs: cx.tcx().get_attrs(field.did).clean(cx),
|
attrs: cx.tcx().get_attrs(field.did).clean(cx),
|
||||||
visibility: Some(field.vis),
|
visibility: field.vis.clean(cx),
|
||||||
def_id: field.did,
|
def_id: field.did,
|
||||||
stability: get_stability(cx, field.did),
|
stability: get_stability(cx, field.did),
|
||||||
deprecation: get_deprecation(cx, field.did),
|
deprecation: get_deprecation(cx, field.did),
|
||||||
|
|
|
@ -31,7 +31,7 @@ use html::render::{cache, CURRENT_LOCATION_KEY};
|
||||||
/// Helper to render an optional visibility with a space after it (if the
|
/// Helper to render an optional visibility with a space after it (if the
|
||||||
/// visibility is preset)
|
/// visibility is preset)
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct VisSpace(pub Option<hir::Visibility>);
|
pub struct VisSpace<'a>(pub &'a Option<hir::Visibility>);
|
||||||
/// Similarly to VisSpace, this structure is used to render a function style with a
|
/// Similarly to VisSpace, this structure is used to render a function style with a
|
||||||
/// space after it.
|
/// space after it.
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
|
@ -56,9 +56,9 @@ pub struct TyParamBounds<'a>(pub &'a [clean::TyParamBound]);
|
||||||
pub struct CommaSep<'a, T: 'a>(pub &'a [T]);
|
pub struct CommaSep<'a, T: 'a>(pub &'a [T]);
|
||||||
pub struct AbiSpace(pub Abi);
|
pub struct AbiSpace(pub Abi);
|
||||||
|
|
||||||
impl VisSpace {
|
impl<'a> VisSpace<'a> {
|
||||||
pub fn get(&self) -> Option<hir::Visibility> {
|
pub fn get(self) -> &'a Option<hir::Visibility> {
|
||||||
let VisSpace(v) = *self; v
|
let VisSpace(v) = self; v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,9 +636,9 @@ impl<'a> fmt::Display for Method<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for VisSpace {
|
impl<'a> fmt::Display for VisSpace<'a> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match self.get() {
|
match *self.get() {
|
||||||
Some(hir::Public) => write!(f, "pub "),
|
Some(hir::Public) => write!(f, "pub "),
|
||||||
Some(hir::Inherited) | None => Ok(())
|
Some(hir::Inherited) | None => Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -1714,13 +1714,13 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
|
||||||
match *src {
|
match *src {
|
||||||
Some(ref src) => {
|
Some(ref src) => {
|
||||||
write!(w, "<tr><td><code>{}extern crate {} as {};",
|
write!(w, "<tr><td><code>{}extern crate {} as {};",
|
||||||
VisSpace(myitem.visibility),
|
VisSpace(&myitem.visibility),
|
||||||
src,
|
src,
|
||||||
name)?
|
name)?
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
write!(w, "<tr><td><code>{}extern crate {};",
|
write!(w, "<tr><td><code>{}extern crate {};",
|
||||||
VisSpace(myitem.visibility), name)?
|
VisSpace(&myitem.visibility), name)?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
write!(w, "</code></td></tr>")?;
|
write!(w, "</code></td></tr>")?;
|
||||||
|
@ -1728,7 +1728,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
|
||||||
|
|
||||||
clean::ImportItem(ref import) => {
|
clean::ImportItem(ref import) => {
|
||||||
write!(w, "<tr><td><code>{}{}</code></td></tr>",
|
write!(w, "<tr><td><code>{}{}</code></td></tr>",
|
||||||
VisSpace(myitem.visibility), *import)?;
|
VisSpace(&myitem.visibility), *import)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -1831,7 +1831,7 @@ fn item_constant(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||||
c: &clean::Constant) -> fmt::Result {
|
c: &clean::Constant) -> fmt::Result {
|
||||||
write!(w, "<pre class='rust const'>{vis}const \
|
write!(w, "<pre class='rust const'>{vis}const \
|
||||||
{name}: {typ}{init}</pre>",
|
{name}: {typ}{init}</pre>",
|
||||||
vis = VisSpace(it.visibility),
|
vis = VisSpace(&it.visibility),
|
||||||
name = it.name.as_ref().unwrap(),
|
name = it.name.as_ref().unwrap(),
|
||||||
typ = c.type_,
|
typ = c.type_,
|
||||||
init = Initializer(&c.expr))?;
|
init = Initializer(&c.expr))?;
|
||||||
|
@ -1842,7 +1842,7 @@ fn item_static(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||||
s: &clean::Static) -> fmt::Result {
|
s: &clean::Static) -> fmt::Result {
|
||||||
write!(w, "<pre class='rust static'>{vis}static {mutability}\
|
write!(w, "<pre class='rust static'>{vis}static {mutability}\
|
||||||
{name}: {typ}{init}</pre>",
|
{name}: {typ}{init}</pre>",
|
||||||
vis = VisSpace(it.visibility),
|
vis = VisSpace(&it.visibility),
|
||||||
mutability = MutableSpace(s.mutability),
|
mutability = MutableSpace(s.mutability),
|
||||||
name = it.name.as_ref().unwrap(),
|
name = it.name.as_ref().unwrap(),
|
||||||
typ = s.type_,
|
typ = s.type_,
|
||||||
|
@ -1859,7 +1859,7 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||||
};
|
};
|
||||||
write!(w, "<pre class='rust fn'>{vis}{constness}{unsafety}{abi}fn \
|
write!(w, "<pre class='rust fn'>{vis}{constness}{unsafety}{abi}fn \
|
||||||
{name}{generics}{decl}{where_clause}</pre>",
|
{name}{generics}{decl}{where_clause}</pre>",
|
||||||
vis = VisSpace(it.visibility),
|
vis = VisSpace(&it.visibility),
|
||||||
constness = ConstnessSpace(vis_constness),
|
constness = ConstnessSpace(vis_constness),
|
||||||
unsafety = UnsafetySpace(f.unsafety),
|
unsafety = UnsafetySpace(f.unsafety),
|
||||||
abi = AbiSpace(f.abi),
|
abi = AbiSpace(f.abi),
|
||||||
|
@ -1887,7 +1887,7 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||||
|
|
||||||
// Output the trait definition
|
// Output the trait definition
|
||||||
write!(w, "<pre class='rust trait'>{}{}trait {}{}{}{} ",
|
write!(w, "<pre class='rust trait'>{}{}trait {}{}{}{} ",
|
||||||
VisSpace(it.visibility),
|
VisSpace(&it.visibility),
|
||||||
UnsafetySpace(t.unsafety),
|
UnsafetySpace(t.unsafety),
|
||||||
it.name.as_ref().unwrap(),
|
it.name.as_ref().unwrap(),
|
||||||
t.generics,
|
t.generics,
|
||||||
|
@ -2214,7 +2214,7 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||||
write!(w, "<pre class='rust enum'>")?;
|
write!(w, "<pre class='rust enum'>")?;
|
||||||
render_attributes(w, it)?;
|
render_attributes(w, it)?;
|
||||||
write!(w, "{}enum {}{}{}",
|
write!(w, "{}enum {}{}{}",
|
||||||
VisSpace(it.visibility),
|
VisSpace(&it.visibility),
|
||||||
it.name.as_ref().unwrap(),
|
it.name.as_ref().unwrap(),
|
||||||
e.generics,
|
e.generics,
|
||||||
WhereClause(&e.generics))?;
|
WhereClause(&e.generics))?;
|
||||||
|
@ -2326,7 +2326,7 @@ fn render_struct(w: &mut fmt::Formatter, it: &clean::Item,
|
||||||
tab: &str,
|
tab: &str,
|
||||||
structhead: bool) -> fmt::Result {
|
structhead: bool) -> fmt::Result {
|
||||||
write!(w, "{}{}{}",
|
write!(w, "{}{}{}",
|
||||||
VisSpace(it.visibility),
|
VisSpace(&it.visibility),
|
||||||
if structhead {"struct "} else {""},
|
if structhead {"struct "} else {""},
|
||||||
it.name.as_ref().unwrap())?;
|
it.name.as_ref().unwrap())?;
|
||||||
if let Some(g) = g {
|
if let Some(g) = g {
|
||||||
|
@ -2338,7 +2338,7 @@ fn render_struct(w: &mut fmt::Formatter, it: &clean::Item,
|
||||||
for field in fields {
|
for field in fields {
|
||||||
if let clean::StructFieldItem(ref ty) = field.inner {
|
if let clean::StructFieldItem(ref ty) = field.inner {
|
||||||
write!(w, " {}{}: {},\n{}",
|
write!(w, " {}{}: {},\n{}",
|
||||||
VisSpace(field.visibility),
|
VisSpace(&field.visibility),
|
||||||
field.name.as_ref().unwrap(),
|
field.name.as_ref().unwrap(),
|
||||||
*ty,
|
*ty,
|
||||||
tab)?;
|
tab)?;
|
||||||
|
@ -2361,7 +2361,7 @@ fn render_struct(w: &mut fmt::Formatter, it: &clean::Item,
|
||||||
write!(w, "_")?
|
write!(w, "_")?
|
||||||
}
|
}
|
||||||
clean::StructFieldItem(ref ty) => {
|
clean::StructFieldItem(ref ty) => {
|
||||||
write!(w, "{}{}", VisSpace(field.visibility), *ty)?
|
write!(w, "{}{}", VisSpace(&field.visibility), *ty)?
|
||||||
}
|
}
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
struct_type: struct_type,
|
struct_type: struct_type,
|
||||||
name: name,
|
name: name,
|
||||||
vis: item.vis,
|
vis: item.vis.clone(),
|
||||||
stab: self.stability(item.id),
|
stab: self.stability(item.id),
|
||||||
depr: self.deprecation(item.id),
|
depr: self.deprecation(item.id),
|
||||||
attrs: item.attrs.clone(),
|
attrs: item.attrs.clone(),
|
||||||
|
@ -125,7 +125,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||||
def: v.node.data.clone(),
|
def: v.node.data.clone(),
|
||||||
whence: v.span,
|
whence: v.span,
|
||||||
}).collect(),
|
}).collect(),
|
||||||
vis: it.vis,
|
vis: it.vis.clone(),
|
||||||
stab: self.stability(it.id),
|
stab: self.stability(it.id),
|
||||||
depr: self.deprecation(it.id),
|
depr: self.deprecation(it.id),
|
||||||
generics: params.clone(),
|
generics: params.clone(),
|
||||||
|
@ -144,7 +144,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||||
debug!("Visiting fn");
|
debug!("Visiting fn");
|
||||||
Function {
|
Function {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
vis: item.vis,
|
vis: item.vis.clone(),
|
||||||
stab: self.stability(item.id),
|
stab: self.stability(item.id),
|
||||||
depr: self.deprecation(item.id),
|
depr: self.deprecation(item.id),
|
||||||
attrs: item.attrs.clone(),
|
attrs: item.attrs.clone(),
|
||||||
|
@ -166,7 +166,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||||
om.where_outer = span;
|
om.where_outer = span;
|
||||||
om.where_inner = m.inner;
|
om.where_inner = m.inner;
|
||||||
om.attrs = attrs;
|
om.attrs = attrs;
|
||||||
om.vis = vis;
|
om.vis = vis.clone();
|
||||||
om.stab = self.stability(id);
|
om.stab = self.stability(id);
|
||||||
om.depr = self.deprecation(id);
|
om.depr = self.deprecation(id);
|
||||||
om.id = id;
|
om.id = id;
|
||||||
|
@ -299,7 +299,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||||
om.extern_crates.push(ExternCrate {
|
om.extern_crates.push(ExternCrate {
|
||||||
name: name,
|
name: name,
|
||||||
path: p.map(|x|x.to_string()),
|
path: p.map(|x|x.to_string()),
|
||||||
vis: item.vis,
|
vis: item.vis.clone(),
|
||||||
attrs: item.attrs.clone(),
|
attrs: item.attrs.clone(),
|
||||||
whence: item.span,
|
whence: item.span,
|
||||||
})
|
})
|
||||||
|
@ -324,7 +324,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||||
};
|
};
|
||||||
om.imports.push(Import {
|
om.imports.push(Import {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
vis: item.vis,
|
vis: item.vis.clone(),
|
||||||
attrs: item.attrs.clone(),
|
attrs: item.attrs.clone(),
|
||||||
node: node,
|
node: node,
|
||||||
whence: item.span,
|
whence: item.span,
|
||||||
|
@ -333,7 +333,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||||
hir::ItemMod(ref m) => {
|
hir::ItemMod(ref m) => {
|
||||||
om.mods.push(self.visit_mod_contents(item.span,
|
om.mods.push(self.visit_mod_contents(item.span,
|
||||||
item.attrs.clone(),
|
item.attrs.clone(),
|
||||||
item.vis,
|
item.vis.clone(),
|
||||||
item.id,
|
item.id,
|
||||||
m,
|
m,
|
||||||
Some(name)));
|
Some(name)));
|
||||||
|
@ -353,7 +353,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
attrs: item.attrs.clone(),
|
attrs: item.attrs.clone(),
|
||||||
whence: item.span,
|
whence: item.span,
|
||||||
vis: item.vis,
|
vis: item.vis.clone(),
|
||||||
stab: self.stability(item.id),
|
stab: self.stability(item.id),
|
||||||
depr: self.deprecation(item.id),
|
depr: self.deprecation(item.id),
|
||||||
};
|
};
|
||||||
|
@ -368,7 +368,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||||
name: name,
|
name: name,
|
||||||
attrs: item.attrs.clone(),
|
attrs: item.attrs.clone(),
|
||||||
whence: item.span,
|
whence: item.span,
|
||||||
vis: item.vis,
|
vis: item.vis.clone(),
|
||||||
stab: self.stability(item.id),
|
stab: self.stability(item.id),
|
||||||
depr: self.deprecation(item.id),
|
depr: self.deprecation(item.id),
|
||||||
};
|
};
|
||||||
|
@ -382,7 +382,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||||
name: name,
|
name: name,
|
||||||
attrs: item.attrs.clone(),
|
attrs: item.attrs.clone(),
|
||||||
whence: item.span,
|
whence: item.span,
|
||||||
vis: item.vis,
|
vis: item.vis.clone(),
|
||||||
stab: self.stability(item.id),
|
stab: self.stability(item.id),
|
||||||
depr: self.deprecation(item.id),
|
depr: self.deprecation(item.id),
|
||||||
};
|
};
|
||||||
|
@ -398,7 +398,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
attrs: item.attrs.clone(),
|
attrs: item.attrs.clone(),
|
||||||
whence: item.span,
|
whence: item.span,
|
||||||
vis: item.vis,
|
vis: item.vis.clone(),
|
||||||
stab: self.stability(item.id),
|
stab: self.stability(item.id),
|
||||||
depr: self.deprecation(item.id),
|
depr: self.deprecation(item.id),
|
||||||
};
|
};
|
||||||
|
@ -415,7 +415,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
||||||
attrs: item.attrs.clone(),
|
attrs: item.attrs.clone(),
|
||||||
id: item.id,
|
id: item.id,
|
||||||
whence: item.span,
|
whence: item.span,
|
||||||
vis: item.vis,
|
vis: item.vis.clone(),
|
||||||
stab: self.stability(item.id),
|
stab: self.stability(item.id),
|
||||||
depr: self.deprecation(item.id),
|
depr: self.deprecation(item.id),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue