diff options
| author | Igor Matuszewski <Xanewok@gmail.com> | 2019-01-13 13:06:26 +0100 |
|---|---|---|
| committer | Igor Matuszewski <Xanewok@gmail.com> | 2019-01-15 11:10:51 +0100 |
| commit | ff19a53ef07566aa30860023f6eac6e75ffaf900 (patch) | |
| tree | a929931a30157db943e9f92a40188c227c48338a /src/librustc_codegen_utils | |
| parent | 33e6df4b62237af312bf6e3f40a97f5bdc94949a (diff) | |
| download | rust-ff19a53ef07566aa30860023f6eac6e75ffaf900.tar.gz rust-ff19a53ef07566aa30860023f6eac6e75ffaf900.zip | |
Querify entry_fn
Diffstat (limited to 'src/librustc_codegen_utils')
| -rw-r--r-- | src/librustc_codegen_utils/lib.rs | 9 |
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"); } } } |
