diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index b061663148d4d..92efeb7fd8629 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -257,11 +257,11 @@ macro_rules! define_dep_nodes { pub fn extract_def_id(&self, tcx: TyCtxt) -> Option { if self.kind.can_reconstruct_query_key() { let def_path_hash = DefPathHash(self.hash); - tcx.def_path_hash_to_def_id - .as_ref() - .unwrap() - .get(&def_path_hash) - .cloned() + if let Some(ref def_path_map) = tcx.def_path_hash_to_def_id.as_ref() { + def_path_map.get(&def_path_hash).cloned() + } else { + None + } } else { None } diff --git a/src/test/run-pass/rustc-rust-log.rs b/src/test/run-pass/rustc-rust-log.rs new file mode 100644 index 0000000000000..629387d4cb11d --- /dev/null +++ b/src/test/run-pass/rustc-rust-log.rs @@ -0,0 +1,13 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// rustc-env:RUST_LOG=debug + +fn main() {}