Skip to content

Commit

Permalink
Auto merge of #58501 - oli-obk:beta, r=eddyb
Browse files Browse the repository at this point in the history
[beta] Fix `attempted .def_id() on invalid def: NonMacroAttr(Builtin)`

backport of the fix so we can get update the bootstrap compiler to a compiler that has this fix. It's very hard to do development on stage 0/1 since resolve errors often end up with an ICE before outputting any useful diagnostics.

cc @rust-lang/compiler @rust-lang/infra I would like to fast-track this backport as it severly hampers @varkor's and my rustc developments. The ICE never happens for successful compiles, only if there are errors.

Since it is very minimalistic and can easily be reverted if desired I think/hope we can skip the usual beta nomination + beta accepted steps
  • Loading branch information
bors committed Feb 16, 2019
2 parents b203178 + 81571bf commit 08f1073
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/librustc_typeck/check/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,12 +750,11 @@ fn compute_all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Vec<DefId>
traits: &mut Vec<DefId>,
external_mods: &mut FxHashSet<DefId>,
def: Def) {
let def_id = def.def_id();
match def {
Def::Trait(..) => {
Def::Trait(def_id) => {
traits.push(def_id);
}
Def::Mod(..) => {
Def::Mod(def_id) => {
if !external_mods.insert(def_id) {
return;
}
Expand Down
8 changes: 5 additions & 3 deletions src/librustdoc/visit_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ impl<'a, 'tcx, 'rcx> LibEmbargoVisitor<'a, 'tcx, 'rcx> {
}

for item in self.cx.tcx.item_children(def_id).iter() {
if self.cx.tcx.def_key(item.def.def_id()).parent.map_or(false, |d| d == def_id.index) ||
item.vis == Visibility::Public {
self.visit_item(item.def);
if let Some(def_id) = item.def.opt_def_id() {
if self.cx.tcx.def_key(def_id).parent.map_or(false, |d| d == def_id.index) ||
item.vis == Visibility::Public {
self.visit_item(item.def);
}
}
}
}
Expand Down

0 comments on commit 08f1073

Please sign in to comment.