about summary refs log tree commit diff
path: root/src/librustc_codegen_utils
diff options
context:
space:
mode:
authorIgor Matuszewski <Xanewok@gmail.com>2019-01-13 13:06:26 +0100
committerIgor Matuszewski <Xanewok@gmail.com>2019-01-15 11:10:51 +0100
commitff19a53ef07566aa30860023f6eac6e75ffaf900 (patch)
treea929931a30157db943e9f92a40188c227c48338a /src/librustc_codegen_utils
parent33e6df4b62237af312bf6e3f40a97f5bdc94949a (diff)
downloadrust-ff19a53ef07566aa30860023f6eac6e75ffaf900.tar.gz
rust-ff19a53ef07566aa30860023f6eac6e75ffaf900.zip
Querify entry_fn
Diffstat (limited to 'src/librustc_codegen_utils')
-rw-r--r--src/librustc_codegen_utils/lib.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs
index b59bca0ae0e..5f61852178d 100644
--- a/src/librustc_codegen_utils/lib.rs
+++ b/src/librustc_codegen_utils/lib.rs
@@ -31,6 +31,7 @@ extern crate syntax_pos;
 #[macro_use] extern crate rustc_data_structures;
 
 use rustc::ty::TyCtxt;
+use rustc::hir::def_id::LOCAL_CRATE;
 
 pub mod link;
 pub mod codegen_backend;
@@ -42,11 +43,9 @@ pub mod symbol_names_test;
 /// that actually test that compilation succeeds without
 /// reporting an error.
 pub fn check_for_rustc_errors_attr(tcx: TyCtxt) {
-    if let Some((id, span, _)) = *tcx.sess.entry_fn.borrow() {
-        let main_def_id = tcx.hir().local_def_id(id);
-
-        if tcx.has_attr(main_def_id, "rustc_error") {
-            tcx.sess.span_fatal(span, "compilation successful");
+    if let Some((def_id, _)) = tcx.entry_fn(LOCAL_CRATE) {
+        if tcx.has_attr(def_id, "rustc_error") {
+            tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful");
         }
     }
 }