1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
13 //! This API is completely unstable and subject to change.
15 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
16 html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
17 html_root_url = "https://doc.rust-lang.org/nightly/")]
20 #![feature(box_patterns)]
21 #![feature(box_syntax)]
22 #![feature(custom_attribute)]
23 #![allow(unused_attributes)]
24 #![feature(i128_type)]
26 #![feature(rustc_diagnostic_macros)]
27 #![feature(slice_patterns)]
28 #![feature(conservative_impl_trait)]
37 extern crate rustc_back;
38 extern crate rustc_mir;
39 extern crate rustc_incremental;
42 extern crate syntax_pos;
43 #[macro_use] extern crate rustc_data_structures;
45 pub extern crate rustc as __rustc;
47 use rustc::ty::TyCtxt;
53 pub mod symbol_names_test;
55 /// check for the #[rustc_error] annotation, which forces an
56 /// error in trans. This is used to write compile-fail tests
57 /// that actually test that compilation succeeds without
58 /// reporting an error.
59 pub fn check_for_rustc_errors_attr(tcx: TyCtxt) {
60 if let Some((id, span)) = *tcx.sess.entry_fn.borrow() {
61 let main_def_id = tcx.hir.local_def_id(id);
63 if tcx.has_attr(main_def_id, "rustc_error") {
64 tcx.sess.span_fatal(span, "compilation successful");
69 __build_diagnostic_array! { librustc_trans_utils, DIAGNOSTICS }