Fix some rustc tests

* Check for `#[rustc_error]` attribute.
* Use the same weak static type error message as cg_llvm
This commit is contained in:
bjorn3 2019-08-01 14:07:08 +02:00
parent 6f23a053e4
commit 11b2b86b08
2 changed files with 3 additions and 1 deletions

View file

@ -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();

View file

@ -195,6 +195,8 @@ impl CodegenBackend for CraneliftCodegenBackend {
need_metadata_module: bool,
_rx: mpsc::Receiver<Box<dyn Any + Send>>,
) -> Box<dyn Any> {
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);