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)]
16 #![recursion_limit="256"]
24 extern crate rustc_target;
25 extern crate rustc_metadata;
26 extern crate rustc_mir;
27 extern crate rustc_incremental;
29 extern crate syntax_pos;
30 #[macro_use] extern crate rustc_data_structures;
32 use rustc::ty::TyCtxt;
33 use rustc::hir::def_id::LOCAL_CRATE;
36 pub mod codegen_backend;
38 pub mod symbol_names_test;
40 /// check for the #[rustc_error] annotation, which forces an
41 /// error in codegen. This is used to write compile-fail tests
42 /// that actually test that compilation succeeds without
43 /// reporting an error.
44 pub fn check_for_rustc_errors_attr(tcx: TyCtxt) {
45 if let Some((def_id, _)) = tcx.entry_fn(LOCAL_CRATE) {
46 if tcx.has_attr(def_id, "rustc_error") {
47 tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful");