42 lines
1.1 KiB
Rust
Raw Normal View History

//! # Note
//!
//! This API is completely unstable and subject to change.
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(custom_attribute)]
#![feature(nll)]
#![allow(unused_attributes)]
#![feature(rustc_diagnostic_macros)]
#![feature(in_band_lifetimes)]
2018-03-03 06:22:19 +01:00
#![recursion_limit="256"]
2019-02-08 21:06:07 +09:00
#![deny(rust_2018_idioms)]
#[macro_use]
extern crate rustc;
2018-03-03 06:17:06 +01:00
#[macro_use] extern crate rustc_data_structures;
use rustc::ty::TyCtxt;
2019-01-13 13:06:26 +01:00
use rustc::hir::def_id::LOCAL_CRATE;
2017-08-13 18:53:50 +02:00
pub mod link;
2018-05-08 16:10:16 +03:00
pub mod codegen_backend;
pub mod symbol_names;
pub mod symbol_names_test;
/// check for the #[rustc_error] annotation, which forces an
/// error in codegen. This is used to write compile-fail tests
/// that actually test that compilation succeeds without
/// reporting an error.
2019-02-08 21:06:07 +09:00
pub fn check_for_rustc_errors_attr(tcx: TyCtxt<'_, '_, '_>) {
2019-01-13 13:06:26 +01:00
if let Some((def_id, _)) = tcx.entry_fn(LOCAL_CRATE) {
if tcx.has_attr(def_id, "rustc_error") {
tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful");
}
}
}