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:
Jack Moffitt
2013-12-09 14:56:53 -07:00
parent 29ca4350c8
commit b349036e5f
111 changed files with 1260 additions and 603 deletions

View File

@@ -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,