3 //! This API is completely unstable and subject to change.
5 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
6 html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
7 html_root_url = "https://doc.rust-lang.org/nightly/")]
9 #![feature(box_patterns)]
10 #![feature(box_syntax)]
11 #![feature(custom_attribute)]
13 #![allow(unused_attributes)]
14 #![feature(rustc_diagnostic_macros)]
15 #![feature(in_band_lifetimes)]
17 #![recursion_limit="256"]
25 extern crate rustc_target;
26 extern crate rustc_metadata;
27 extern crate rustc_mir;
28 extern crate rustc_incremental;
30 extern crate syntax_pos;
31 #[macro_use] extern crate rustc_data_structures;
33 use rustc::ty::TyCtxt;
34 use rustc::hir::def_id::LOCAL_CRATE;
37 pub mod codegen_backend;
39 pub mod symbol_names_test;
41 /// check for the #[rustc_error] annotation, which forces an
42 /// error in codegen. This is used to write compile-fail tests
43 /// that actually test that compilation succeeds without
44 /// reporting an error.
45 pub fn check_for_rustc_errors_attr(tcx: TyCtxt) {
46 if let Some((def_id, _)) = tcx.entry_fn(LOCAL_CRATE) {
47 if tcx.has_attr(def_id, "rustc_error") {
48 tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful");