Make crate hash stable and externally computable.
This replaces the link meta attributes with a pkgid attribute and uses a hash of this as the crate hash. This makes the crate hash computable by things other than the Rust compiler. It also switches the hash function ot SHA1 since that is much more likely to be available in shell, Python, etc than SipHash. Fixes #10188, #8523.
This commit is contained in:
@@ -18,6 +18,7 @@ use codemap::{Span, Spanned, spanned, dummy_spanned};
|
||||
use codemap::BytePos;
|
||||
use diagnostic::span_handler;
|
||||
use parse::comments::{doc_comment_style, strip_doc_comment_decoration};
|
||||
use pkgid::PkgId;
|
||||
|
||||
use std::hashmap::HashSet;
|
||||
|
||||
@@ -235,6 +236,13 @@ pub fn find_linkage_metas(attrs: &[Attribute]) -> ~[@MetaItem] {
|
||||
result
|
||||
}
|
||||
|
||||
pub fn find_pkgid(attrs: &[Attribute]) -> Option<PkgId> {
|
||||
match first_attr_value_str_by_name(attrs, "pkgid") {
|
||||
None => None,
|
||||
Some(id) => from_str::<PkgId>(id),
|
||||
}
|
||||
}
|
||||
|
||||
#[deriving(Eq)]
|
||||
pub enum InlineAttr {
|
||||
InlineNone,
|
||||
|
||||
Reference in New Issue
Block a user