diff options
| author | Mark Mansi <markm@cs.wisc.edu> | 2020-03-12 18:07:58 -0500 |
|---|---|---|
| committer | mark <markm@cs.wisc.edu> | 2020-03-19 23:14:46 -0500 |
| commit | 2d75a339ca9e7cd11338b165311927e6eb73cca4 (patch) | |
| tree | a48f8cbc64cb11fc1ec825190fe708a13657cbd5 /src/librustc_codegen_utils/lib.rs | |
| parent | f4c675c476c18b1a11041193f2f59d695b126bc8 (diff) | |
| download | rust-2d75a339ca9e7cd11338b165311927e6eb73cca4.tar.gz rust-2d75a339ca9e7cd11338b165311927e6eb73cca4.zip | |
Refactorings to begin getting rid of rustc_codegen_utils
Diffstat (limited to 'src/librustc_codegen_utils/lib.rs')
| -rw-r--r-- | src/librustc_codegen_utils/lib.rs | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs deleted file mode 100644 index 38906bbaef8..00000000000 --- a/src/librustc_codegen_utils/lib.rs +++ /dev/null @@ -1,66 +0,0 @@ -//! # Note -//! -//! This API is completely unstable and subject to change. - -#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")] -#![feature(never_type)] -#![feature(nll)] -#![feature(in_band_lifetimes)] -#![recursion_limit = "256"] - -#[macro_use] -extern crate rustc; - -use rustc::ty::query::Providers; -use rustc::ty::TyCtxt; -use rustc_hir::def_id::{DefId, LOCAL_CRATE}; -use rustc_span::symbol::sym; - -pub mod codegen_backend; -pub mod link; -pub mod symbol_names; -pub mod symbol_names_test; - -pub fn trigger_delay_span_bug(tcx: TyCtxt<'_>, key: DefId) { - tcx.sess.delay_span_bug( - tcx.def_span(key), - "delayed span bug triggered by #[rustc_error(delay_span_bug_from_inside_query)]", - ); -} - -/// 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. -pub fn check_for_rustc_errors_attr(tcx: TyCtxt<'_>) { - if let Some((def_id, _)) = tcx.entry_fn(LOCAL_CRATE) { - let attrs = &*tcx.get_attrs(def_id); - for attr in attrs { - if attr.check_name(sym::rustc_error) { - match attr.meta_item_list() { - // check if there is a #[rustc_error(delayed)] - Some(list) => { - if list.iter().any(|list_item| { - list_item.ident().map(|i| i.name) - == Some(sym::delay_span_bug_from_inside_query) - }) { - tcx.ensure().trigger_delay_span_bug(def_id); - } - } - // bare #[rustc_error] - None => { - tcx.sess.span_fatal( - tcx.def_span(def_id), - "fatal error triggered by #[rustc_error]", - ); - } - } - } - } - } -} - -pub fn provide(providers: &mut Providers<'_>) { - crate::symbol_names::provide(providers); - *providers = Providers { trigger_delay_span_bug, ..*providers }; -} |
