提交 3a756fea 编写于 作者: M Michael Woerister 提交者: Niko Matsakis

Make the definite name of the local crate available in the tcx.

上级 32a2e9a8
......@@ -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 @@ 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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册