rollup merge of #17226 : P1start/rustdoc-colour
This commit is contained in:
commit
27af691017
18 changed files with 66 additions and 42 deletions
|
@ -325,7 +325,7 @@ fn item_to_def_like(item: rbml::Doc, did: ast::DefId, cnum: ast::CrateNum)
|
||||||
};
|
};
|
||||||
DlDef(def::DefStaticMethod(did, provenance, fn_style))
|
DlDef(def::DefStaticMethod(did, provenance, fn_style))
|
||||||
}
|
}
|
||||||
Type | ForeignType => DlDef(def::DefTy(did)),
|
Type | ForeignType => DlDef(def::DefTy(did, false)),
|
||||||
Mod => DlDef(def::DefMod(did)),
|
Mod => DlDef(def::DefMod(did)),
|
||||||
ForeignMod => DlDef(def::DefForeignMod(did)),
|
ForeignMod => DlDef(def::DefForeignMod(did)),
|
||||||
StructVariant => {
|
StructVariant => {
|
||||||
|
@ -337,7 +337,7 @@ fn item_to_def_like(item: rbml::Doc, did: ast::DefId, cnum: ast::CrateNum)
|
||||||
DlDef(def::DefVariant(enum_did, did, false))
|
DlDef(def::DefVariant(enum_did, did, false))
|
||||||
}
|
}
|
||||||
Trait => DlDef(def::DefTrait(did)),
|
Trait => DlDef(def::DefTrait(did)),
|
||||||
Enum => DlDef(def::DefTy(did)),
|
Enum => DlDef(def::DefTy(did, true)),
|
||||||
Impl => DlImpl(did),
|
Impl => DlImpl(did),
|
||||||
PublicField | InheritedField => DlField,
|
PublicField | InheritedField => DlField,
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,7 +454,7 @@ impl tr for def::Def {
|
||||||
def::DefVariant(e_did.tr(dcx), v_did.tr(dcx), is_s)
|
def::DefVariant(e_did.tr(dcx), v_did.tr(dcx), is_s)
|
||||||
},
|
},
|
||||||
def::DefTrait(did) => def::DefTrait(did.tr(dcx)),
|
def::DefTrait(did) => def::DefTrait(did.tr(dcx)),
|
||||||
def::DefTy(did) => def::DefTy(did.tr(dcx)),
|
def::DefTy(did, is_enum) => def::DefTy(did.tr(dcx), is_enum),
|
||||||
def::DefPrimTy(p) => def::DefPrimTy(p),
|
def::DefPrimTy(p) => def::DefPrimTy(p),
|
||||||
def::DefTyParam(s, did, v) => def::DefTyParam(s, did.tr(dcx), v),
|
def::DefTyParam(s, did, v) => def::DefTyParam(s, did.tr(dcx), v),
|
||||||
def::DefBinding(nid, bm) => def::DefBinding(dcx.tr_id(nid), bm),
|
def::DefBinding(nid, bm) => def::DefBinding(dcx.tr_id(nid), bm),
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub enum Def {
|
||||||
DefArg(ast::NodeId, ast::BindingMode),
|
DefArg(ast::NodeId, ast::BindingMode),
|
||||||
DefLocal(ast::NodeId, ast::BindingMode),
|
DefLocal(ast::NodeId, ast::BindingMode),
|
||||||
DefVariant(ast::DefId /* enum */, ast::DefId /* variant */, bool /* is_structure */),
|
DefVariant(ast::DefId /* enum */, ast::DefId /* variant */, bool /* is_structure */),
|
||||||
DefTy(ast::DefId),
|
DefTy(ast::DefId, bool /* is_enum */),
|
||||||
DefTrait(ast::DefId),
|
DefTrait(ast::DefId),
|
||||||
DefPrimTy(ast::PrimTy),
|
DefPrimTy(ast::PrimTy),
|
||||||
DefTyParam(ParamSpace, ast::DefId, uint),
|
DefTyParam(ParamSpace, ast::DefId, uint),
|
||||||
|
@ -62,7 +62,7 @@ impl Def {
|
||||||
match *self {
|
match *self {
|
||||||
DefFn(id, _) | DefStaticMethod(id, _, _) | DefMod(id) |
|
DefFn(id, _) | DefStaticMethod(id, _, _) | DefMod(id) |
|
||||||
DefForeignMod(id) | DefStatic(id, _) |
|
DefForeignMod(id) | DefStatic(id, _) |
|
||||||
DefVariant(_, id, _) | DefTy(id) | DefTyParam(_, id, _) |
|
DefVariant(_, id, _) | DefTy(id, _) | DefTyParam(_, id, _) |
|
||||||
DefUse(id) | DefStruct(id) | DefTrait(id) | DefMethod(id, _) => {
|
DefUse(id) | DefStruct(id) | DefTrait(id) | DefMethod(id, _) => {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
|
|
|
@ -531,7 +531,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
|
||||||
Ok(self.cat_rvalue_node(id, span, expr_ty))
|
Ok(self.cat_rvalue_node(id, span, expr_ty))
|
||||||
}
|
}
|
||||||
def::DefMod(_) | def::DefForeignMod(_) | def::DefUse(_) |
|
def::DefMod(_) | def::DefForeignMod(_) | def::DefUse(_) |
|
||||||
def::DefTrait(_) | def::DefTy(_) | def::DefPrimTy(_) |
|
def::DefTrait(_) | def::DefTy(..) | def::DefPrimTy(_) |
|
||||||
def::DefTyParam(..) | def::DefTyParamBinder(..) | def::DefRegion(_) |
|
def::DefTyParam(..) | def::DefTyParamBinder(..) | def::DefRegion(_) |
|
||||||
def::DefLabel(_) | def::DefSelfTy(..) | def::DefMethod(..) => {
|
def::DefLabel(_) | def::DefSelfTy(..) | def::DefMethod(..) => {
|
||||||
Ok(Rc::new(cmt_ {
|
Ok(Rc::new(cmt_ {
|
||||||
|
|
|
@ -771,7 +771,8 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
|
||||||
def::DefFn(..) => ck("function"),
|
def::DefFn(..) => ck("function"),
|
||||||
def::DefStatic(..) => ck("static"),
|
def::DefStatic(..) => ck("static"),
|
||||||
def::DefVariant(..) => ck("variant"),
|
def::DefVariant(..) => ck("variant"),
|
||||||
def::DefTy(..) => ck("type"),
|
def::DefTy(_, false) => ck("type"),
|
||||||
|
def::DefTy(_, true) => ck("enum"),
|
||||||
def::DefTrait(..) => ck("trait"),
|
def::DefTrait(..) => ck("trait"),
|
||||||
def::DefStruct(..) => ck("struct"),
|
def::DefStruct(..) => ck("struct"),
|
||||||
def::DefMethod(_, Some(..)) => ck("trait method"),
|
def::DefMethod(_, Some(..)) => ck("trait method"),
|
||||||
|
|
|
@ -1252,7 +1252,7 @@ impl<'a> Resolver<'a> {
|
||||||
sp);
|
sp);
|
||||||
|
|
||||||
name_bindings.define_type
|
name_bindings.define_type
|
||||||
(DefTy(local_def(item.id)), sp, is_public);
|
(DefTy(local_def(item.id), false), sp, is_public);
|
||||||
parent
|
parent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1264,7 +1264,7 @@ impl<'a> Resolver<'a> {
|
||||||
sp);
|
sp);
|
||||||
|
|
||||||
name_bindings.define_type
|
name_bindings.define_type
|
||||||
(DefTy(local_def(item.id)), sp, is_public);
|
(DefTy(local_def(item.id), true), sp, is_public);
|
||||||
|
|
||||||
for variant in (*enum_definition).variants.iter() {
|
for variant in (*enum_definition).variants.iter() {
|
||||||
self.build_reduced_graph_for_variant(
|
self.build_reduced_graph_for_variant(
|
||||||
|
@ -1287,7 +1287,7 @@ impl<'a> Resolver<'a> {
|
||||||
let name_bindings = self.add_child(ident, parent.clone(), forbid, sp);
|
let name_bindings = self.add_child(ident, parent.clone(), forbid, sp);
|
||||||
|
|
||||||
// Define a name in the type namespace.
|
// Define a name in the type namespace.
|
||||||
name_bindings.define_type(DefTy(local_def(item.id)), sp, is_public);
|
name_bindings.define_type(DefTy(local_def(item.id), false), sp, is_public);
|
||||||
|
|
||||||
// If this is a newtype or unit-like struct, define a name
|
// If this is a newtype or unit-like struct, define a name
|
||||||
// in the value namespace as well
|
// in the value namespace as well
|
||||||
|
@ -1732,7 +1732,7 @@ impl<'a> Resolver<'a> {
|
||||||
|
|
||||||
match def {
|
match def {
|
||||||
DefMod(def_id) | DefForeignMod(def_id) | DefStruct(def_id) |
|
DefMod(def_id) | DefForeignMod(def_id) | DefStruct(def_id) |
|
||||||
DefTy(def_id) => {
|
DefTy(def_id, _) => {
|
||||||
let type_def = child_name_bindings.type_def.borrow().clone();
|
let type_def = child_name_bindings.type_def.borrow().clone();
|
||||||
match type_def {
|
match type_def {
|
||||||
Some(TypeNsDef { module_def: Some(module_def), .. }) => {
|
Some(TypeNsDef { module_def: Some(module_def), .. }) => {
|
||||||
|
@ -1823,7 +1823,7 @@ impl<'a> Resolver<'a> {
|
||||||
is_public,
|
is_public,
|
||||||
DUMMY_SP)
|
DUMMY_SP)
|
||||||
}
|
}
|
||||||
DefTy(_) => {
|
DefTy(..) => {
|
||||||
debug!("(building reduced graph for external \
|
debug!("(building reduced graph for external \
|
||||||
crate) building type {}", final_ident);
|
crate) building type {}", final_ident);
|
||||||
|
|
||||||
|
@ -4320,7 +4320,7 @@ impl<'a> Resolver<'a> {
|
||||||
|
|
||||||
// If it's a typedef, give a note
|
// If it's a typedef, give a note
|
||||||
match def {
|
match def {
|
||||||
DefTy(_) => {
|
DefTy(..) => {
|
||||||
self.session.span_note(
|
self.session.span_note(
|
||||||
trait_reference.path.span,
|
trait_reference.path.span,
|
||||||
format!("`type` aliases cannot \
|
format!("`type` aliases cannot \
|
||||||
|
@ -4381,7 +4381,7 @@ impl<'a> Resolver<'a> {
|
||||||
Some(ref t) => match t.node {
|
Some(ref t) => match t.node {
|
||||||
TyPath(ref path, None, path_id) => {
|
TyPath(ref path, None, path_id) => {
|
||||||
match this.resolve_path(id, path, TypeNS, true) {
|
match this.resolve_path(id, path, TypeNS, true) {
|
||||||
Some((DefTy(def_id), lp)) if this.structs.contains_key(&def_id) => {
|
Some((DefTy(def_id, _), lp)) if this.structs.contains_key(&def_id) => {
|
||||||
let def = DefStruct(def_id);
|
let def = DefStruct(def_id);
|
||||||
debug!("(resolving struct) resolved `{}` to type {:?}",
|
debug!("(resolving struct) resolved `{}` to type {:?}",
|
||||||
token::get_ident(path.segments
|
token::get_ident(path.segments
|
||||||
|
@ -5440,7 +5440,7 @@ impl<'a> Resolver<'a> {
|
||||||
if allowed == Everything {
|
if allowed == Everything {
|
||||||
// Look for a field with the same name in the current self_type.
|
// Look for a field with the same name in the current self_type.
|
||||||
match self.def_map.borrow().find(&node_id) {
|
match self.def_map.borrow().find(&node_id) {
|
||||||
Some(&DefTy(did))
|
Some(&DefTy(did, _))
|
||||||
| Some(&DefStruct(did))
|
| Some(&DefStruct(did))
|
||||||
| Some(&DefVariant(_, did, _)) => match self.structs.find(&did) {
|
| Some(&DefVariant(_, did, _)) => match self.structs.find(&did) {
|
||||||
None => {}
|
None => {}
|
||||||
|
@ -5582,7 +5582,7 @@ impl<'a> Resolver<'a> {
|
||||||
// structs, which wouldn't result in this error.)
|
// structs, which wouldn't result in this error.)
|
||||||
match self.with_no_errors(|this|
|
match self.with_no_errors(|this|
|
||||||
this.resolve_path(expr.id, path, TypeNS, false)) {
|
this.resolve_path(expr.id, path, TypeNS, false)) {
|
||||||
Some((DefTy(struct_id), _))
|
Some((DefTy(struct_id, _), _))
|
||||||
if self.structs.contains_key(&struct_id) => {
|
if self.structs.contains_key(&struct_id) => {
|
||||||
self.resolve_error(expr.span,
|
self.resolve_error(expr.span,
|
||||||
format!("`{}` is a structure name, but \
|
format!("`{}` is a structure name, but \
|
||||||
|
|
|
@ -226,7 +226,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
|
||||||
def::DefMod(_) |
|
def::DefMod(_) |
|
||||||
def::DefForeignMod(_) => Some(recorder::ModRef),
|
def::DefForeignMod(_) => Some(recorder::ModRef),
|
||||||
def::DefStruct(_) => Some(recorder::StructRef),
|
def::DefStruct(_) => Some(recorder::StructRef),
|
||||||
def::DefTy(_) |
|
def::DefTy(..) |
|
||||||
def::DefTrait(_) => Some(recorder::TypeRef),
|
def::DefTrait(_) => Some(recorder::TypeRef),
|
||||||
def::DefStatic(_, _) |
|
def::DefStatic(_, _) |
|
||||||
def::DefBinding(_, _) |
|
def::DefBinding(_, _) |
|
||||||
|
|
|
@ -438,7 +438,7 @@ pub fn ast_ty_to_builtin_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
|
||||||
// FIXME(#12938): This is a hack until we have full support for
|
// FIXME(#12938): This is a hack until we have full support for
|
||||||
// DST.
|
// DST.
|
||||||
match a_def {
|
match a_def {
|
||||||
def::DefTy(did) | def::DefStruct(did)
|
def::DefTy(did, _) | def::DefStruct(did)
|
||||||
if Some(did) == this.tcx().lang_items.owned_box() => {
|
if Some(did) == this.tcx().lang_items.owned_box() => {
|
||||||
if path.segments
|
if path.segments
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -462,7 +462,7 @@ pub fn ast_ty_to_builtin_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
|
||||||
"not enough type parameters supplied to `Box<T>`");
|
"not enough type parameters supplied to `Box<T>`");
|
||||||
Some(ty::mk_err())
|
Some(ty::mk_err())
|
||||||
}
|
}
|
||||||
def::DefTy(did) | def::DefStruct(did)
|
def::DefTy(did, _) | def::DefStruct(did)
|
||||||
if Some(did) == this.tcx().lang_items.gc() => {
|
if Some(did) == this.tcx().lang_items.gc() => {
|
||||||
if path.segments
|
if path.segments
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -833,7 +833,7 @@ pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
|
||||||
result.substs.clone(),
|
result.substs.clone(),
|
||||||
bounds)
|
bounds)
|
||||||
}
|
}
|
||||||
def::DefTy(did) | def::DefStruct(did) => {
|
def::DefTy(did, _) | def::DefStruct(did) => {
|
||||||
ast_path_to_ty(this, rscope, did, path).ty
|
ast_path_to_ty(this, rscope, did, path).ty
|
||||||
}
|
}
|
||||||
def::DefTyParam(space, id, n) => {
|
def::DefTyParam(space, id, n) => {
|
||||||
|
|
|
@ -4937,7 +4937,7 @@ pub fn polytype_for_def(fcx: &FnCtxt,
|
||||||
return polytype_for_def(fcx, sp, *inner);
|
return polytype_for_def(fcx, sp, *inner);
|
||||||
}
|
}
|
||||||
def::DefTrait(_) |
|
def::DefTrait(_) |
|
||||||
def::DefTy(_) |
|
def::DefTy(..) |
|
||||||
def::DefPrimTy(_) |
|
def::DefPrimTy(_) |
|
||||||
def::DefTyParam(..)=> {
|
def::DefTyParam(..)=> {
|
||||||
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found type");
|
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found type");
|
||||||
|
|
|
@ -1235,7 +1235,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
|
||||||
Some(&d) => d
|
Some(&d) => d
|
||||||
};
|
};
|
||||||
match a_def {
|
match a_def {
|
||||||
def::DefTy(did) | def::DefStruct(did) => {
|
def::DefTy(did, _) | def::DefStruct(did) => {
|
||||||
let generics = ty::lookup_item_type(self.tcx, did).generics;
|
let generics = ty::lookup_item_type(self.tcx, did).generics;
|
||||||
|
|
||||||
let expected =
|
let expected =
|
||||||
|
|
|
@ -87,7 +87,12 @@ fn try_inline_def(cx: &DocContext, tcx: &ty::ctxt,
|
||||||
ret.extend(build_impls(cx, tcx, did).into_iter());
|
ret.extend(build_impls(cx, tcx, did).into_iter());
|
||||||
clean::StructItem(build_struct(cx, tcx, did))
|
clean::StructItem(build_struct(cx, tcx, did))
|
||||||
}
|
}
|
||||||
def::DefTy(did) => {
|
def::DefTy(did, false) => {
|
||||||
|
record_extern_fqn(cx, did, clean::TypeTypedef);
|
||||||
|
ret.extend(build_impls(cx, tcx, did).into_iter());
|
||||||
|
build_type(cx, tcx, did)
|
||||||
|
}
|
||||||
|
def::DefTy(did, true) => {
|
||||||
record_extern_fqn(cx, did, clean::TypeEnum);
|
record_extern_fqn(cx, did, clean::TypeEnum);
|
||||||
ret.extend(build_impls(cx, tcx, did).into_iter());
|
ret.extend(build_impls(cx, tcx, did).into_iter());
|
||||||
build_type(cx, tcx, did)
|
build_type(cx, tcx, did)
|
||||||
|
|
|
@ -1094,6 +1094,7 @@ pub enum TypeKind {
|
||||||
TypeStruct,
|
TypeStruct,
|
||||||
TypeTrait,
|
TypeTrait,
|
||||||
TypeVariant,
|
TypeVariant,
|
||||||
|
TypeTypedef,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive {
|
impl Primitive {
|
||||||
|
@ -2049,7 +2050,8 @@ fn resolve_type(cx: &DocContext, path: Path,
|
||||||
fn register_def(cx: &DocContext, def: def::Def) -> ast::DefId {
|
fn register_def(cx: &DocContext, def: def::Def) -> ast::DefId {
|
||||||
let (did, kind) = match def {
|
let (did, kind) = match def {
|
||||||
def::DefFn(i, _) => (i, TypeFunction),
|
def::DefFn(i, _) => (i, TypeFunction),
|
||||||
def::DefTy(i) => (i, TypeEnum),
|
def::DefTy(i, false) => (i, TypeTypedef),
|
||||||
|
def::DefTy(i, true) => (i, TypeEnum),
|
||||||
def::DefTrait(i) => (i, TypeTrait),
|
def::DefTrait(i) => (i, TypeTrait),
|
||||||
def::DefStruct(i) => (i, TypeStruct),
|
def::DefStruct(i) => (i, TypeStruct),
|
||||||
def::DefMod(i) => (i, TypeModule),
|
def::DefMod(i) => (i, TypeModule),
|
||||||
|
|
|
@ -45,7 +45,7 @@ impl ItemType {
|
||||||
match *self {
|
match *self {
|
||||||
Module => "mod",
|
Module => "mod",
|
||||||
Struct => "struct",
|
Struct => "struct",
|
||||||
Enum => "type",
|
Enum => "enum",
|
||||||
Function => "fn",
|
Function => "fn",
|
||||||
Typedef => "type",
|
Typedef => "type",
|
||||||
Static => "static",
|
Static => "static",
|
||||||
|
|
|
@ -308,6 +308,7 @@ pub fn run(mut krate: clean::Crate, external_html: &ExternalHtml, dst: Path) ->
|
||||||
clean::TypeModule => item_type::Module,
|
clean::TypeModule => item_type::Module,
|
||||||
clean::TypeStatic => item_type::Static,
|
clean::TypeStatic => item_type::Static,
|
||||||
clean::TypeVariant => item_type::Variant,
|
clean::TypeVariant => item_type::Variant,
|
||||||
|
clean::TypeTypedef => item_type::Typedef,
|
||||||
}))
|
}))
|
||||||
}).collect()
|
}).collect()
|
||||||
}).unwrap_or(HashMap::new());
|
}).unwrap_or(HashMap::new());
|
||||||
|
|
|
@ -229,6 +229,8 @@ nav.sub {
|
||||||
.content .highlighted.enum { background-color: #b4d1b9; }
|
.content .highlighted.enum { background-color: #b4d1b9; }
|
||||||
.content .highlighted.struct { background-color: #e7b1a0; }
|
.content .highlighted.struct { background-color: #e7b1a0; }
|
||||||
.content .highlighted.fn { background-color: #c6afb3; }
|
.content .highlighted.fn { background-color: #c6afb3; }
|
||||||
|
.content .highlighted.method { background-color: #c6afb3; }
|
||||||
|
.content .highlighted.ffi { background-color: #c6afb3; }
|
||||||
|
|
||||||
.docblock.short.nowrap {
|
.docblock.short.nowrap {
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -336,11 +338,13 @@ a {
|
||||||
p a { color: #4e8bca; }
|
p a { color: #4e8bca; }
|
||||||
p a:hover { text-decoration: underline; }
|
p a:hover { text-decoration: underline; }
|
||||||
|
|
||||||
.content span.trait, .block a.current.trait { color: #ed9603; }
|
.content span.trait, .content a.trait, .block a.current.trait { color: #ed9603; }
|
||||||
.content span.mod, .block a.current.mod { color: #4d76ae; }
|
.content span.mod, .content a.mod, block a.current.mod { color: #4d76ae; }
|
||||||
.content span.enum, .block a.current.enum { color: #5e9766; }
|
.content span.enum, .content a.enum, .block a.current.enum { color: #5e9766; }
|
||||||
.content span.struct, .block a.current.struct { color: #e53700; }
|
.content span.struct, .content a.struct, .block a.current.struct { color: #e53700; }
|
||||||
.content span.fn, .block a.current.fn { color: #8c6067; }
|
.content span.fn, .content a.fn, .block a.current.fn { color: #8c6067; }
|
||||||
|
.content span.method, .content a.method, .block a.current.method { color: #8c6067; }
|
||||||
|
.content span.ffi, .content a.ffi, .block a.current.ffi { color: #8c6067; }
|
||||||
.content .fnname { color: #8c6067; }
|
.content .fnname { color: #8c6067; }
|
||||||
|
|
||||||
.search-input {
|
.search-input {
|
||||||
|
|
|
@ -555,7 +555,7 @@
|
||||||
// `rustdoc::html::item_type::ItemType` type in Rust.
|
// `rustdoc::html::item_type::ItemType` type in Rust.
|
||||||
var itemTypes = ["mod",
|
var itemTypes = ["mod",
|
||||||
"struct",
|
"struct",
|
||||||
"type",
|
"enum",
|
||||||
"fn",
|
"fn",
|
||||||
"type",
|
"type",
|
||||||
"static",
|
"static",
|
||||||
|
|
|
@ -24,6 +24,7 @@ mod foo {
|
||||||
pub fn b() {}
|
pub fn b() {}
|
||||||
pub struct c;
|
pub struct c;
|
||||||
pub enum d {}
|
pub enum d {}
|
||||||
|
pub type e = int;
|
||||||
|
|
||||||
pub struct A(());
|
pub struct A(());
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ mod foo {
|
||||||
pub fn reexported_b() {}
|
pub fn reexported_b() {}
|
||||||
pub struct reexported_c;
|
pub struct reexported_c;
|
||||||
pub enum reexported_d {}
|
pub enum reexported_d {}
|
||||||
|
pub type reexported_e = int;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod bar {
|
pub mod bar {
|
||||||
|
@ -43,14 +45,17 @@ pub mod bar {
|
||||||
pub use foo::reexported_b as f;
|
pub use foo::reexported_b as f;
|
||||||
pub use foo::reexported_c as g;
|
pub use foo::reexported_c as g;
|
||||||
pub use foo::reexported_d as h;
|
pub use foo::reexported_d as h;
|
||||||
|
pub use foo::reexported_e as i;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub static a: int = 0;
|
pub static a: int = 0;
|
||||||
pub fn b() {}
|
pub fn b() {}
|
||||||
pub struct c;
|
pub struct c;
|
||||||
pub enum d {}
|
pub enum d {}
|
||||||
|
pub type e = int;
|
||||||
|
|
||||||
static i: int = 0;
|
static j: int = 0;
|
||||||
fn j() {}
|
fn k() {}
|
||||||
struct k;
|
struct l;
|
||||||
enum l {}
|
enum m {}
|
||||||
|
type n = int;
|
||||||
|
|
|
@ -20,22 +20,26 @@ fn main() {
|
||||||
static_priv_by_default::b;
|
static_priv_by_default::b;
|
||||||
static_priv_by_default::c;
|
static_priv_by_default::c;
|
||||||
foo::<static_priv_by_default::d>();
|
foo::<static_priv_by_default::d>();
|
||||||
|
foo::<static_priv_by_default::e>();
|
||||||
|
|
||||||
// publicly re-exported items should be available
|
// publicly re-exported items should be available
|
||||||
static_priv_by_default::bar::e;
|
static_priv_by_default::bar::e;
|
||||||
static_priv_by_default::bar::f;
|
static_priv_by_default::bar::f;
|
||||||
static_priv_by_default::bar::g;
|
static_priv_by_default::bar::g;
|
||||||
foo::<static_priv_by_default::bar::h>();
|
foo::<static_priv_by_default::bar::h>();
|
||||||
|
foo::<static_priv_by_default::bar::i>();
|
||||||
|
|
||||||
// private items at the top should be inaccessible
|
// private items at the top should be inaccessible
|
||||||
static_priv_by_default::i;
|
|
||||||
//~^ ERROR: static `i` is private
|
|
||||||
static_priv_by_default::j;
|
static_priv_by_default::j;
|
||||||
//~^ ERROR: function `j` is private
|
//~^ ERROR: static `j` is private
|
||||||
static_priv_by_default::k;
|
static_priv_by_default::k;
|
||||||
//~^ ERROR: struct `k` is private
|
//~^ ERROR: function `k` is private
|
||||||
foo::<static_priv_by_default::l>();
|
static_priv_by_default::l;
|
||||||
//~^ ERROR: type `l` is private
|
//~^ ERROR: struct `l` is private
|
||||||
|
foo::<static_priv_by_default::m>();
|
||||||
|
//~^ ERROR: enum `m` is private
|
||||||
|
foo::<static_priv_by_default::n>();
|
||||||
|
//~^ ERROR: type `n` is private
|
||||||
|
|
||||||
// public items in a private mod should be inaccessible
|
// public items in a private mod should be inaccessible
|
||||||
static_priv_by_default::foo::a;
|
static_priv_by_default::foo::a;
|
||||||
|
@ -45,5 +49,7 @@ fn main() {
|
||||||
static_priv_by_default::foo::c;
|
static_priv_by_default::foo::c;
|
||||||
//~^ ERROR: struct `c` is private
|
//~^ ERROR: struct `c` is private
|
||||||
foo::<static_priv_by_default::foo::d>();
|
foo::<static_priv_by_default::foo::d>();
|
||||||
//~^ ERROR: type `d` is private
|
//~^ ERROR: enum `d` is private
|
||||||
|
foo::<static_priv_by_default::foo::e>();
|
||||||
|
//~^ ERROR: type `e` is private
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue