|
1 | 1 | use self::collector::NodeCollector;
|
2 | 2 |
|
3 |
| -use crate::hir::{HirOwnerData, IndexedHir}; |
| 3 | +use crate::hir::{AttributeMap, HirOwnerData, IndexedHir}; |
4 | 4 | use crate::middle::cstore::CrateStore;
|
5 | 5 | use crate::ty::TyCtxt;
|
6 | 6 | use rustc_ast as ast;
|
@@ -943,14 +943,19 @@ pub(super) fn index_hir<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> &'tcx Indexe
|
943 | 943 | }
|
944 | 944 |
|
945 | 945 | pub(super) fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh {
|
| 946 | + let mut hcx = tcx.create_stable_hashing_context(); |
| 947 | + |
946 | 948 | let mut hir_body_nodes: Vec<_> = tcx
|
947 | 949 | .index_hir(crate_num)
|
948 | 950 | .map
|
949 | 951 | .iter_enumerated()
|
950 | 952 | .filter_map(|(def_id, hod)| {
|
951 | 953 | let def_path_hash = tcx.definitions.def_path_hash(def_id);
|
952 |
| - let hash = hod.with_bodies.as_ref()?.hash; |
953 |
| - Some((def_path_hash, hash)) |
| 954 | + let mut hasher = StableHasher::new(); |
| 955 | + hod.with_bodies.as_ref()?.hash_stable(&mut hcx, &mut hasher); |
| 956 | + AttributeMap { map: &tcx.untracked_crate.attrs, prefix: def_id } |
| 957 | + .hash_stable(&mut hcx, &mut hasher); |
| 958 | + Some((def_path_hash, hasher.finish())) |
954 | 959 | })
|
955 | 960 | .collect();
|
956 | 961 | hir_body_nodes.sort_unstable_by_key(|bn| bn.0);
|
@@ -980,13 +985,13 @@ pub(super) fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh {
|
980 | 985 |
|
981 | 986 | source_file_names.sort_unstable();
|
982 | 987 |
|
983 |
| - let mut hcx = tcx.create_stable_hashing_context(); |
984 | 988 | let mut stable_hasher = StableHasher::new();
|
985 | 989 | node_hashes.hash_stable(&mut hcx, &mut stable_hasher);
|
986 | 990 | upstream_crates.hash_stable(&mut hcx, &mut stable_hasher);
|
987 | 991 | source_file_names.hash_stable(&mut hcx, &mut stable_hasher);
|
988 | 992 | tcx.sess.opts.dep_tracking_hash(true).hash_stable(&mut hcx, &mut stable_hasher);
|
989 | 993 | tcx.sess.local_crate_disambiguator().to_fingerprint().hash_stable(&mut hcx, &mut stable_hasher);
|
| 994 | + tcx.untracked_crate.non_exported_macro_attrs.hash_stable(&mut hcx, &mut stable_hasher); |
990 | 995 |
|
991 | 996 | let crate_hash: Fingerprint = stable_hasher.finish();
|
992 | 997 | Svh::new(crate_hash.to_smaller_hash())
|
|
0 commit comments