]> git.lizzy.rs Git - rust.git/blob - src/librustc_codegen_utils/lib.rs
Auto merge of #64432 - gnzlbg:simplify_truncate, r=alexcrichton
[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(never_type)]
12 #![feature(nll)]
13 #![feature(in_band_lifetimes)]
14
15 #![recursion_limit="256"]
16
17 #[macro_use]
18 extern crate rustc;
19
20 use rustc::ty::TyCtxt;
21 use rustc::ty::query::Providers;
22 use rustc::hir::def_id::LOCAL_CRATE;
23 use syntax::symbol::sym;
24
25 pub mod link;
26 pub mod codegen_backend;
27 pub mod symbol_names;
28 pub mod symbol_names_test;
29
30 /// check for the #[rustc_error] annotation, which forces an
31 /// error in codegen. This is used to write compile-fail tests
32 /// that actually test that compilation succeeds without
33 /// reporting an error.
34 pub fn check_for_rustc_errors_attr(tcx: TyCtxt<'_>) {
35     if let Some((def_id, _)) = tcx.entry_fn(LOCAL_CRATE) {
36         if tcx.has_attr(def_id, sym::rustc_error) {
37             tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful");
38         }
39     }
40 }
41
42 pub fn provide(providers: &mut Providers<'_>) {
43     crate::symbol_names::provide(providers);
44 }