From 11b2b86b087d17018c71edef3e411b04483ae6b2 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Thu, 1 Aug 2019 14:07:08 +0200 Subject: [PATCH] Fix some rustc tests * Check for `#[rustc_error]` attribute. * Use the same weak static type error message as cg_llvm --- src/constant.rs | 2 +- src/lib.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/constant.rs b/src/constant.rs index 3ccd0f97dc54..a71a8d0bf2cd 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -202,7 +202,7 @@ fn data_id_for_static( if linkage == Linkage::Preemptible { if let ty::RawPtr(_) = tcx.type_of(def_id).sty { } else { - tcx.sess.span_fatal(tcx.def_span(def_id), "must have type `*const T` or `*mut T`") + tcx.sess.span_fatal(tcx.def_span(def_id), "must have type `*const T` or `*mut T` due to `#[linkage]` attribute") } let mut data_ctx = DataContext::new(); diff --git a/src/lib.rs b/src/lib.rs index 30a8ca02975e..b6ef7e39d148 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -195,6 +195,8 @@ impl CodegenBackend for CraneliftCodegenBackend { need_metadata_module: bool, _rx: mpsc::Receiver>, ) -> Box { + rustc_codegen_utils::check_for_rustc_errors_attr(tcx); + let res = driver::codegen_crate(tcx, metadata, need_metadata_module); rustc_incremental::assert_module_sources::assert_module_sources(tcx);