3 //! This API is completely unstable and subject to change.
5 #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
7 #![feature(arbitrary_self_types)]
8 #![feature(box_patterns)]
9 #![feature(box_syntax)]
10 #![feature(custom_attribute)]
12 #![allow(unused_attributes)]
13 #![feature(rustc_diagnostic_macros)]
14 #![feature(in_band_lifetimes)]
16 #![recursion_limit="256"]
18 #![deny(rust_2018_idioms)]
19 #![cfg_attr(not(stage0), deny(internal))]
24 use rustc::ty::TyCtxt;
25 use rustc::hir::def_id::LOCAL_CRATE;
28 pub mod codegen_backend;
30 pub mod symbol_names_test;
32 /// check for the #[rustc_error] annotation, which forces an
33 /// error in codegen. This is used to write compile-fail tests
34 /// that actually test that compilation succeeds without
35 /// reporting an error.
36 pub fn check_for_rustc_errors_attr(tcx: TyCtxt<'_, '_, '_>) {
37 if let Some((def_id, _)) = tcx.entry_fn(LOCAL_CRATE) {
38 if tcx.has_attr(def_id, "rustc_error") {
39 tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful");