about summary refs log tree commit diff
path: root/compiler/rustc_span/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-12-09 03:05:27 +0000
committerbors <bors@rust-lang.org>2022-12-09 03:05:27 +0000
commit7701a7e7d4eed74a106f39fa64899dffd1e1025f (patch)
tree6921886cc9b73c908488dbfdf2322e92e0ced131 /compiler/rustc_span/src
parentb359ccf1b0b7b2d2c1c4932344b806e68bd053a9 (diff)
parent660795eee5852a9ea66e7554cb517f14b99fb2f0 (diff)
downloadrust-7701a7e7d4eed74a106f39fa64899dffd1e1025f.tar.gz
rust-7701a7e7d4eed74a106f39fa64899dffd1e1025f.zip
Auto merge of #105456 - matthiaskrgr:rollup-yennygf, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #104922 (Detect long types in E0308 and write them to disk)
 - #105120 (kmc-solid: `std::sys` code maintenance)
 - #105255 (Make nested RPIT inherit the parent opaque's generics.)
 - #105317 (make retagging work even with 'unstable' places)
 - #105405 (Stop passing -export-dynamic to wasm-ld.)
 - #105408 (Add help for `#![feature(impl_trait_in_fn_trait_return)]`)
 - #105423 (Use `Symbol` for the crate name instead of `String`/`str`)
 - #105433 (CI: add missing line continuation marker)
 - #105434 (Fix warning when libcore is compiled with no_fp_fmt_parse)
 - #105441 (Remove `UnsafetyState`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_span/src')
-rw-r--r--compiler/rustc_span/src/def_id.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs
index 0ad1f1a0da7..e62ce2c266a 100644
--- a/compiler/rustc_span/src/def_id.rs
+++ b/compiler/rustc_span/src/def_id.rs
@@ -1,4 +1,4 @@
-use crate::HashStableContext;
+use crate::{HashStableContext, Symbol};
 use rustc_data_structures::fingerprint::Fingerprint;
 use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
 use rustc_data_structures::AtomicRef;
@@ -149,9 +149,11 @@ impl StableCrateId {
 
     /// Computes the stable ID for a crate with the given name and
     /// `-Cmetadata` arguments.
-    pub fn new(crate_name: &str, is_exe: bool, mut metadata: Vec<String>) -> StableCrateId {
+    pub fn new(crate_name: Symbol, is_exe: bool, mut metadata: Vec<String>) -> StableCrateId {
         let mut hasher = StableHasher::new();
-        crate_name.hash(&mut hasher);
+        // We must hash the string text of the crate name, not the id, as the id is not stable
+        // across builds.
+        crate_name.as_str().hash(&mut hasher);
 
         // We don't want the stable crate ID to depend on the order of
         // -C metadata arguments, so sort them: