Restrict access to crate_name.
Also remove original_crate_name, which had the exact same implementation
This commit is contained in:
parent
2f601ef527
commit
0e71283495
19 changed files with 23 additions and 30 deletions
|
@ -285,7 +285,7 @@ pub type DepNode = rustc_query_system::dep_graph::DepNode<DepKind>;
|
|||
// required that their size stay the same, but we don't want to change
|
||||
// it inadvertently. This assert just ensures we're aware of any change.
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
static_assert_size!(DepNode, 18);
|
||||
static_assert_size!(DepNode, 17);
|
||||
|
||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
static_assert_size!(DepNode, 24);
|
||||
|
|
|
@ -49,7 +49,7 @@ impl<'tcx> ExportedSymbol<'tcx> {
|
|||
pub fn metadata_symbol_name(tcx: TyCtxt<'_>) -> String {
|
||||
format!(
|
||||
"rust_metadata_{}_{:08x}",
|
||||
tcx.original_crate_name(LOCAL_CRATE),
|
||||
tcx.crate_name(LOCAL_CRATE),
|
||||
tcx.sess.local_stable_crate_id().to_u64(),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1247,10 +1247,6 @@ rustc_queries! {
|
|||
eval_always
|
||||
desc { "looking up the hash of a host version of a crate" }
|
||||
}
|
||||
query original_crate_name(_: CrateNum) -> Symbol {
|
||||
eval_always
|
||||
desc { "looking up the original name a crate" }
|
||||
}
|
||||
query extra_filename(_: CrateNum) -> String {
|
||||
eval_always
|
||||
desc { "looking up the extra filename for a crate" }
|
||||
|
|
|
@ -1005,7 +1005,7 @@ pub struct GlobalCtxt<'tcx> {
|
|||
|
||||
/// The definite name of the current crate after taking into account
|
||||
/// attributes, commandline parameters, etc.
|
||||
pub crate_name: Symbol,
|
||||
crate_name: Symbol,
|
||||
|
||||
/// Data layout specification for the current target.
|
||||
pub data_layout: TargetDataLayout,
|
||||
|
|
|
@ -1621,7 +1621,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
|
||||
fn item_name_from_def_id(self, def_id: DefId) -> Option<Symbol> {
|
||||
if def_id.index == CRATE_DEF_INDEX {
|
||||
Some(self.original_crate_name(def_id.krate))
|
||||
Some(self.crate_name(def_id.krate))
|
||||
} else {
|
||||
let def_key = self.def_key(def_id);
|
||||
match def_key.disambiguated_data.data {
|
||||
|
|
|
@ -452,7 +452,7 @@ pub trait PrettyPrinter<'tcx>:
|
|||
}
|
||||
// Re-exported `extern crate` (#43189).
|
||||
DefPathData::CrateRoot => {
|
||||
data = DefPathData::TypeNs(self.tcx().original_crate_name(def_id.krate));
|
||||
data = DefPathData::TypeNs(self.tcx().crate_name(def_id.krate));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue