Skip to content

Commit

Permalink
Rollup merge of rust-lang#52886 - petrochenkov:noga, r=alexcrichton
Browse files Browse the repository at this point in the history
cleanup: Remove `Def::GlobalAsm`

Global asm is not something that needs to have a `Def` or `DefId`.
  • Loading branch information
cramertj authored Aug 2, 2018
2 parents ca93f6f + ef6fddd commit ec58d48
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 16 deletions.
6 changes: 1 addition & 5 deletions src/librustc/hir/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ pub enum Def {
// Macro namespace
Macro(DefId, MacroKind),

GlobalAsm(DefId),

// Both namespaces
Err,
}
Expand Down Expand Up @@ -249,8 +247,7 @@ impl Def {
Def::AssociatedTy(id) | Def::TyParam(id) | Def::Struct(id) | Def::StructCtor(id, ..) |
Def::Union(id) | Def::Trait(id) | Def::Method(id) | Def::Const(id) |
Def::AssociatedConst(id) | Def::Macro(id, ..) |
Def::Existential(id) | Def::AssociatedExistential(id) |
Def::GlobalAsm(id) | Def::TyForeign(id) => {
Def::Existential(id) | Def::AssociatedExistential(id) | Def::TyForeign(id) => {
id
}

Expand Down Expand Up @@ -298,7 +295,6 @@ impl Def {
Def::Label(..) => "label",
Def::SelfTy(..) => "self type",
Def::Macro(.., macro_kind) => macro_kind.descr(),
Def::GlobalAsm(..) => "global asm",
Def::Err => "unresolved item",
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ impl<'hir> Map<'hir> {
ItemKind::Const(..) => Some(Def::Const(def_id())),
ItemKind::Fn(..) => Some(Def::Fn(def_id())),
ItemKind::Mod(..) => Some(Def::Mod(def_id())),
ItemKind::GlobalAsm(..) => Some(Def::GlobalAsm(def_id())),
ItemKind::Existential(..) => Some(Def::Existential(def_id())),
ItemKind::Ty(..) => Some(Def::TyAlias(def_id())),
ItemKind::Enum(..) => Some(Def::Enum(def_id())),
Expand All @@ -445,6 +444,7 @@ impl<'hir> Map<'hir> {
ItemKind::ExternCrate(_) |
ItemKind::Use(..) |
ItemKind::ForeignMod(..) |
ItemKind::GlobalAsm(..) |
ItemKind::Impl(..) => None,
}
}
Expand Down
1 change: 0 additions & 1 deletion src/librustc/ich/impls_hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,6 @@ impl_stable_hash_for!(enum hir::def::Def {
Upvar(def_id, index, expr_id),
Label(node_id),
Macro(def_id, macro_kind),
GlobalAsm(def_id),
Err
});

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,10 @@ impl<'tcx> EntryKind<'tcx> {
EntryKind::Trait(_) => Def::Trait(did),
EntryKind::Enum(..) => Def::Enum(did),
EntryKind::MacroDef(_) => Def::Macro(did, MacroKind::Bang),
EntryKind::GlobalAsm => Def::GlobalAsm(did),
EntryKind::ForeignType => Def::TyForeign(did),

EntryKind::ForeignMod |
EntryKind::GlobalAsm |
EntryKind::Impl(_) |
EntryKind::Field |
EntryKind::Generator(_) |
Expand Down
9 changes: 2 additions & 7 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,10 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
err.span_label(typaram_span, "type variable from outer function");
}
},
Def::Mod(..) | Def::Struct(..) | Def::Union(..) | Def::Enum(..) | Def::Variant(..) |
Def::Trait(..) | Def::TyAlias(..) | Def::TyForeign(..) | Def::TraitAlias(..) |
Def::AssociatedTy(..) | Def::PrimTy(..) | Def::Fn(..) | Def::Const(..) |
Def::Static(..) | Def::StructCtor(..) | Def::VariantCtor(..) | Def::Method(..) |
Def::AssociatedConst(..) | Def::Local(..) | Def::Upvar(..) | Def::Label(..) |
Def::Existential(..) | Def::AssociatedExistential(..) |
Def::Macro(..) | Def::GlobalAsm(..) | Def::Err =>
_ => {
bug!("TypeParametersFromOuterFunction should only be used with Def::SelfTy or \
Def::TyParam")
}
}

// Try to retrieve the span of the function signature and generate a new message with
Expand Down
1 change: 0 additions & 1 deletion src/librustc_save_analysis/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,6 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
HirDef::SelfTy(..) |
HirDef::Label(..) |
HirDef::Macro(..) |
HirDef::GlobalAsm(..) |
HirDef::Err => None,
}
}
Expand Down

0 comments on commit ec58d48

Please sign in to comment.