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