Make the definite name of the local crate available in the tcx.
This commit is contained in:
parent
32a2e9a8e1
commit
3a756fea50
3 changed files with 10 additions and 2 deletions
|
|
@ -43,7 +43,7 @@ use std::hash::{Hash, Hasher};
|
|||
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 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
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 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
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 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
|
|||
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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue