mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
Make the definite name of the local crate available in the tcx.
This commit is contained in:
committed by
Niko Matsakis
parent
32a2e9a8e1
commit
3a756fea50
@@ -43,7 +43,7 @@
|
||||
use std::rc::Rc;
|
||||
use syntax::ast::{self, Name, NodeId};
|
||||
use syntax::attr;
|
||||
use syntax::parse::token::special_idents;
|
||||
use syntax::parse::token::{self, special_idents};
|
||||
|
||||
use rustc_front::hir;
|
||||
|
||||
@@ -415,6 +415,10 @@ pub struct TyCtxt<'tcx> {
|
||||
/// fragmented data to the set of unfragmented pieces that
|
||||
/// constitute it.
|
||||
pub fragment_infos: RefCell<DefIdMap<Vec<ty::FragmentInfo>>>,
|
||||
|
||||
/// The definite name of the current crate after taking into account
|
||||
/// attributes, commandline parameters, etc.
|
||||
pub crate_name: token::InternedString,
|
||||
}
|
||||
|
||||
impl<'tcx> TyCtxt<'tcx> {
|
||||
@@ -511,6 +515,7 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
|
||||
region_maps: RegionMaps,
|
||||
lang_items: middle::lang_items::LanguageItems,
|
||||
stability: stability::Index<'tcx>,
|
||||
crate_name: &str,
|
||||
f: F) -> R
|
||||
where F: FnOnce(&TyCtxt<'tcx>) -> R
|
||||
{
|
||||
@@ -570,7 +575,8 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
|
||||
const_qualif_map: RefCell::new(NodeMap()),
|
||||
custom_coerce_unsized_kinds: RefCell::new(DefIdMap()),
|
||||
cast_kinds: RefCell::new(NodeMap()),
|
||||
fragment_infos: RefCell::new(DefIdMap())
|
||||
fragment_infos: RefCell::new(DefIdMap()),
|
||||
crate_name: token::intern_and_get_ident(crate_name),
|
||||
}, f)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -818,6 +818,7 @@ macro_rules! try_with_f {
|
||||
region_map,
|
||||
lang_items,
|
||||
index,
|
||||
name,
|
||||
|tcx| {
|
||||
// passes are timed inside typeck
|
||||
try_with_f!(typeck::check_crate(tcx, trait_map), (tcx, None, analysis));
|
||||
|
||||
@@ -146,6 +146,7 @@ fn test_env<F>(source_string: &str,
|
||||
region_map,
|
||||
lang_items,
|
||||
index,
|
||||
"test_crate",
|
||||
|tcx| {
|
||||
let infcx = infer::new_infer_ctxt(tcx,
|
||||
&tcx.tables,
|
||||
|
||||
Reference in New Issue
Block a user