-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use 128 bit instead of Symbol for crate disambiguator #45476
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,6 +114,7 @@ | |
//! unsupported file system and emit a warning in that case. This is not yet | ||
//! implemented. | ||
|
||
use rustc::ich::Fingerprint; | ||
use rustc::hir::svh::Svh; | ||
use rustc::session::Session; | ||
use rustc::util::fs as fs_util; | ||
|
@@ -188,7 +189,7 @@ pub fn in_incr_comp_dir(incr_comp_session_dir: &Path, file_name: &str) -> PathBu | |
/// The garbage collection will take care of it. | ||
pub fn prepare_session_directory(sess: &Session, | ||
crate_name: &str, | ||
crate_disambiguator: &str) { | ||
crate_disambiguator: &Fingerprint) { | ||
if sess.opts.incremental.is_none() { | ||
return | ||
} | ||
|
@@ -614,21 +615,15 @@ fn string_to_timestamp(s: &str) -> Result<SystemTime, ()> { | |
|
||
fn crate_path(sess: &Session, | ||
crate_name: &str, | ||
crate_disambiguator: &str) | ||
crate_disambiguator: &Fingerprint) | ||
-> PathBuf { | ||
use std::hash::{Hasher, Hash}; | ||
use std::collections::hash_map::DefaultHasher; | ||
|
||
let incr_dir = sess.opts.incremental.as_ref().unwrap().clone(); | ||
|
||
// The full crate disambiguator is really long. A hash of it should be | ||
// sufficient. | ||
let mut hasher = DefaultHasher::new(); | ||
crate_disambiguator.hash(&mut hasher); | ||
|
||
let crate_disambiguator = crate_disambiguator.to_smaller_hash(); | ||
let crate_name = format!("{}-{}", | ||
crate_name, | ||
base_n::encode(hasher.finish(), INT_ENCODE_BASE)); | ||
base_n::encode(crate_disambiguator, INT_ENCODE_BASE)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This truncates the hash to 64 bits, should I implement a 128 but encoding in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is pre-existing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now sure what you mean exactly, but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code you wrote should have roughly the same effect as before since Maybe you could add a comment here, similar to the one that is replaced:
|
||
incr_dir.join(crate_name) | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually we pass around
Fingerprint
by value. It implementsCopy
so that should be easy.