]> git.lizzy.rs Git - rust.git/blob - src/librustc_codegen_utils/lib.rs
Auto merge of #61130 - jonhoo:mem-take, r=SimonSapin
[rust.git] / src / librustc_codegen_utils / lib.rs
1 //! # Note
2 //!
3 //! This API is completely unstable and subject to change.
4
5 #![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
6
7 #![feature(arbitrary_self_types)]
8 #![feature(box_patterns)]
9 #![feature(box_syntax)]
10 #![feature(core_intrinsics)]
11 #![feature(custom_attribute)]
12 #![feature(never_type)]
13 #![feature(nll)]
14 #![allow(unused_attributes)]
15 #![feature(rustc_diagnostic_macros)]
16 #![feature(in_band_lifetimes)]
17
18 #![recursion_limit="256"]
19
20 #![deny(rust_2018_idioms)]
21 #![deny(internal)]
22
23 #[macro_use]
24 extern crate rustc;
25
26 use rustc::ty::TyCtxt;
27 use rustc::hir::def_id::LOCAL_CRATE;
28 use syntax::symbol::sym;
29
30 pub mod link;
31 pub mod codegen_backend;
32 pub mod symbol_names;
33 pub mod symbol_names_test;
34
35 /// check for the #[rustc_error] annotation, which forces an
36 /// error in codegen. This is used to write compile-fail tests
37 /// that actually test that compilation succeeds without
38 /// reporting an error.
39 pub fn check_for_rustc_errors_attr(tcx: TyCtxt<'_, '_, '_>) {
40     if let Some((def_id, _)) = tcx.entry_fn(LOCAL_CRATE) {
41         if tcx.has_attr(def_id, sym::rustc_error) {
42             tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful");
43         }
44     }
45 }