Skip to content

Commit 27af691

Browse files
committed
rollup merge of rust-lang#17226 : P1start/rustdoc-colour
2 parents 8875584 + 8b88811 commit 27af691

File tree

18 files changed

+66
-42
lines changed

18 files changed

+66
-42
lines changed

src/librustc/metadata/decoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ fn item_to_def_like(item: rbml::Doc, did: ast::DefId, cnum: ast::CrateNum)
325325
};
326326
DlDef(def::DefStaticMethod(did, provenance, fn_style))
327327
}
328-
Type | ForeignType => DlDef(def::DefTy(did)),
328+
Type | ForeignType => DlDef(def::DefTy(did, false)),
329329
Mod => DlDef(def::DefMod(did)),
330330
ForeignMod => DlDef(def::DefForeignMod(did)),
331331
StructVariant => {
@@ -337,7 +337,7 @@ fn item_to_def_like(item: rbml::Doc, did: ast::DefId, cnum: ast::CrateNum)
337337
DlDef(def::DefVariant(enum_did, did, false))
338338
}
339339
Trait => DlDef(def::DefTrait(did)),
340-
Enum => DlDef(def::DefTy(did)),
340+
Enum => DlDef(def::DefTy(did, true)),
341341
Impl => DlImpl(did),
342342
PublicField | InheritedField => DlField,
343343
}

src/librustc/middle/astencode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ impl tr for def::Def {
454454
def::DefVariant(e_did.tr(dcx), v_did.tr(dcx), is_s)
455455
},
456456
def::DefTrait(did) => def::DefTrait(did.tr(dcx)),
457-
def::DefTy(did) => def::DefTy(did.tr(dcx)),
457+
def::DefTy(did, is_enum) => def::DefTy(did.tr(dcx), is_enum),
458458
def::DefPrimTy(p) => def::DefPrimTy(p),
459459
def::DefTyParam(s, did, v) => def::DefTyParam(s, did.tr(dcx), v),
460460
def::DefBinding(nid, bm) => def::DefBinding(dcx.tr_id(nid), bm),

src/librustc/middle/def.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub enum Def {
2525
DefArg(ast::NodeId, ast::BindingMode),
2626
DefLocal(ast::NodeId, ast::BindingMode),
2727
DefVariant(ast::DefId /* enum */, ast::DefId /* variant */, bool /* is_structure */),
28-
DefTy(ast::DefId),
28+
DefTy(ast::DefId, bool /* is_enum */),
2929
DefTrait(ast::DefId),
3030
DefPrimTy(ast::PrimTy),
3131
DefTyParam(ParamSpace, ast::DefId, uint),
@@ -62,7 +62,7 @@ impl Def {
6262
match *self {
6363
DefFn(id, _) | DefStaticMethod(id, _, _) | DefMod(id) |
6464
DefForeignMod(id) | DefStatic(id, _) |
65-
DefVariant(_, id, _) | DefTy(id) | DefTyParam(_, id, _) |
65+
DefVariant(_, id, _) | DefTy(id, _) | DefTyParam(_, id, _) |
6666
DefUse(id) | DefStruct(id) | DefTrait(id) | DefMethod(id, _) => {
6767
id
6868
}

src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
531531
Ok(self.cat_rvalue_node(id, span, expr_ty))
532532
}
533533
def::DefMod(_) | def::DefForeignMod(_) | def::DefUse(_) |
534-
def::DefTrait(_) | def::DefTy(_) | def::DefPrimTy(_) |
534+
def::DefTrait(_) | def::DefTy(..) | def::DefPrimTy(_) |
535535
def::DefTyParam(..) | def::DefTyParamBinder(..) | def::DefRegion(_) |
536536
def::DefLabel(_) | def::DefSelfTy(..) | def::DefMethod(..) => {
537537
Ok(Rc::new(cmt_ {

src/librustc/middle/privacy.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,8 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
771771
def::DefFn(..) => ck("function"),
772772
def::DefStatic(..) => ck("static"),
773773
def::DefVariant(..) => ck("variant"),
774-
def::DefTy(..) => ck("type"),
774+
def::DefTy(_, false) => ck("type"),
775+
def::DefTy(_, true) => ck("enum"),
775776
def::DefTrait(..) => ck("trait"),
776777
def::DefStruct(..) => ck("struct"),
777778
def::DefMethod(_, Some(..)) => ck("trait method"),

src/librustc/middle/resolve.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ impl<'a> Resolver<'a> {
12521252
sp);
12531253

12541254
name_bindings.define_type
1255-
(DefTy(local_def(item.id)), sp, is_public);
1255+
(DefTy(local_def(item.id), false), sp, is_public);
12561256
parent
12571257
}
12581258

@@ -1264,7 +1264,7 @@ impl<'a> Resolver<'a> {
12641264
sp);
12651265

12661266
name_bindings.define_type
1267-
(DefTy(local_def(item.id)), sp, is_public);
1267+
(DefTy(local_def(item.id), true), sp, is_public);
12681268

12691269
for variant in (*enum_definition).variants.iter() {
12701270
self.build_reduced_graph_for_variant(
@@ -1287,7 +1287,7 @@ impl<'a> Resolver<'a> {
12871287
let name_bindings = self.add_child(ident, parent.clone(), forbid, sp);
12881288

12891289
// Define a name in the type namespace.
1290-
name_bindings.define_type(DefTy(local_def(item.id)), sp, is_public);
1290+
name_bindings.define_type(DefTy(local_def(item.id), false), sp, is_public);
12911291

12921292
// If this is a newtype or unit-like struct, define a name
12931293
// in the value namespace as well
@@ -1732,7 +1732,7 @@ impl<'a> Resolver<'a> {
17321732

17331733
match def {
17341734
DefMod(def_id) | DefForeignMod(def_id) | DefStruct(def_id) |
1735-
DefTy(def_id) => {
1735+
DefTy(def_id, _) => {
17361736
let type_def = child_name_bindings.type_def.borrow().clone();
17371737
match type_def {
17381738
Some(TypeNsDef { module_def: Some(module_def), .. }) => {
@@ -1823,7 +1823,7 @@ impl<'a> Resolver<'a> {
18231823
is_public,
18241824
DUMMY_SP)
18251825
}
1826-
DefTy(_) => {
1826+
DefTy(..) => {
18271827
debug!("(building reduced graph for external \
18281828
crate) building type {}", final_ident);
18291829

@@ -4320,7 +4320,7 @@ impl<'a> Resolver<'a> {
43204320

43214321
// If it's a typedef, give a note
43224322
match def {
4323-
DefTy(_) => {
4323+
DefTy(..) => {
43244324
self.session.span_note(
43254325
trait_reference.path.span,
43264326
format!("`type` aliases cannot \
@@ -4381,7 +4381,7 @@ impl<'a> Resolver<'a> {
43814381
Some(ref t) => match t.node {
43824382
TyPath(ref path, None, path_id) => {
43834383
match this.resolve_path(id, path, TypeNS, true) {
4384-
Some((DefTy(def_id), lp)) if this.structs.contains_key(&def_id) => {
4384+
Some((DefTy(def_id, _), lp)) if this.structs.contains_key(&def_id) => {
43854385
let def = DefStruct(def_id);
43864386
debug!("(resolving struct) resolved `{}` to type {:?}",
43874387
token::get_ident(path.segments
@@ -5440,7 +5440,7 @@ impl<'a> Resolver<'a> {
54405440
if allowed == Everything {
54415441
// Look for a field with the same name in the current self_type.
54425442
match self.def_map.borrow().find(&node_id) {
5443-
Some(&DefTy(did))
5443+
Some(&DefTy(did, _))
54445444
| Some(&DefStruct(did))
54455445
| Some(&DefVariant(_, did, _)) => match self.structs.find(&did) {
54465446
None => {}
@@ -5582,7 +5582,7 @@ impl<'a> Resolver<'a> {
55825582
// structs, which wouldn't result in this error.)
55835583
match self.with_no_errors(|this|
55845584
this.resolve_path(expr.id, path, TypeNS, false)) {
5585-
Some((DefTy(struct_id), _))
5585+
Some((DefTy(struct_id, _), _))
55865586
if self.structs.contains_key(&struct_id) => {
55875587
self.resolve_error(expr.span,
55885588
format!("`{}` is a structure name, but \

src/librustc/middle/save/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
226226
def::DefMod(_) |
227227
def::DefForeignMod(_) => Some(recorder::ModRef),
228228
def::DefStruct(_) => Some(recorder::StructRef),
229-
def::DefTy(_) |
229+
def::DefTy(..) |
230230
def::DefTrait(_) => Some(recorder::TypeRef),
231231
def::DefStatic(_, _) |
232232
def::DefBinding(_, _) |

src/librustc/middle/typeck/astconv.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ pub fn ast_ty_to_builtin_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
438438
// FIXME(#12938): This is a hack until we have full support for
439439
// DST.
440440
match a_def {
441-
def::DefTy(did) | def::DefStruct(did)
441+
def::DefTy(did, _) | def::DefStruct(did)
442442
if Some(did) == this.tcx().lang_items.owned_box() => {
443443
if path.segments
444444
.iter()
@@ -462,7 +462,7 @@ pub fn ast_ty_to_builtin_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
462462
"not enough type parameters supplied to `Box<T>`");
463463
Some(ty::mk_err())
464464
}
465-
def::DefTy(did) | def::DefStruct(did)
465+
def::DefTy(did, _) | def::DefStruct(did)
466466
if Some(did) == this.tcx().lang_items.gc() => {
467467
if path.segments
468468
.iter()
@@ -833,7 +833,7 @@ pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
833833
result.substs.clone(),
834834
bounds)
835835
}
836-
def::DefTy(did) | def::DefStruct(did) => {
836+
def::DefTy(did, _) | def::DefStruct(did) => {
837837
ast_path_to_ty(this, rscope, did, path).ty
838838
}
839839
def::DefTyParam(space, id, n) => {

src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4937,7 +4937,7 @@ pub fn polytype_for_def(fcx: &FnCtxt,
49374937
return polytype_for_def(fcx, sp, *inner);
49384938
}
49394939
def::DefTrait(_) |
4940-
def::DefTy(_) |
4940+
def::DefTy(..) |
49414941
def::DefPrimTy(_) |
49424942
def::DefTyParam(..)=> {
49434943
fcx.ccx.tcx.sess.span_bug(sp, "expected value, found type");

src/librustc/middle/typeck/infer/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
12351235
Some(&d) => d
12361236
};
12371237
match a_def {
1238-
def::DefTy(did) | def::DefStruct(did) => {
1238+
def::DefTy(did, _) | def::DefStruct(did) => {
12391239
let generics = ty::lookup_item_type(self.tcx, did).generics;
12401240

12411241
let expected =

0 commit comments

Comments
 (0)