Skip to content

Commit

Permalink
Use opt_def_id instead of having special branch
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Nov 25, 2018
1 parent 5c99ae6 commit 8d76f54
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/librustc/middle/reachable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ impl<'a, 'tcx> Visitor<'tcx> for ReachableContext<'a, 'tcx> {
Some(Def::Local(node_id)) | Some(Def::Upvar(node_id, ..)) => {
self.reachable_symbols.insert(node_id);
}
Some(Def::Err) => {} // #56202: calling `def.def_id()` would be an error
Some(def) => {
let def_id = def.def_id();
if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) {
if let Some((node_id, def_id)) = def.opt_def_id().and_then(|def_id| {
self.tcx.hir.as_local_node_id(def_id).map(|node_id| (node_id, def_id))
}) {
if self.def_id_represents_local_inlined_item(def_id) {
self.worklist.push(node_id);
} else {
Expand Down

0 comments on commit 8d76f54

Please sign in to comment.