@@ -14,7 +14,7 @@ use rustc_hir::def::DefKind;
1414use rustc_hir:: def_id:: { DefId , LocalDefId , LocalModDefId } ;
1515use rustc_hir:: * ;
1616use rustc_macros:: { Decodable , Encodable , HashStable } ;
17- use rustc_span:: { ErrorGuaranteed , ExpnId } ;
17+ use rustc_span:: { ErrorGuaranteed , ExpnId , Span } ;
1818
1919use crate :: query:: Providers ;
2020use crate :: ty:: { EarlyBinder , ImplSubject , TyCtxt } ;
@@ -157,6 +157,7 @@ impl<'tcx> TyCtxt<'tcx> {
157157 node : OwnerNode < ' _ > ,
158158 bodies : & SortedMap < ItemLocalId , & Body < ' _ > > ,
159159 attrs : & SortedMap < ItemLocalId , & [ Attribute ] > ,
160+ define_opaque : Option < & [ ( Span , LocalDefId ) ] > ,
160161 ) -> ( Option < Fingerprint > , Option < Fingerprint > ) {
161162 if self . needs_crate_hash ( ) {
162163 self . with_stable_hashing_context ( |mut hcx| {
@@ -168,6 +169,10 @@ impl<'tcx> TyCtxt<'tcx> {
168169
169170 let mut stable_hasher = StableHasher :: new ( ) ;
170171 attrs. hash_stable ( & mut hcx, & mut stable_hasher) ;
172+
173+ // Hash the defined opaque types, which are not present in the attrs.
174+ define_opaque. hash_stable ( & mut hcx, & mut stable_hasher) ;
175+
171176 let h2 = stable_hasher. finish ( ) ;
172177 ( Some ( h1) , Some ( h2) )
173178 } )
0 commit comments