@@ -65,7 +65,6 @@ use rustc_hir::definitions::DefPathHash;
6565use rustc_hir:: { HirId , ItemLocalId , OwnerId } ;
6666use rustc_query_system:: dep_graph:: FingerprintStyle ;
6767use rustc_span:: symbol:: Symbol ;
68- use std:: hash:: Hash ;
6968
7069pub use rustc_query_system:: dep_graph:: dep_node:: DepKind ;
7170pub use rustc_query_system:: dep_graph:: { DepContext , DepNode , DepNodeParams } ;
@@ -85,9 +84,8 @@ macro_rules! define_dep_nodes {
8584 // encoding. The derived Encodable/Decodable uses leb128 encoding which is
8685 // dense when only considering this enum. But DepKind is encoded in a larger
8786 // struct, and there we can take advantage of the unused bits in the u16.
88- #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash ) ]
8987 #[ allow( non_camel_case_types) ]
90- #[ repr( u16 ) ]
88+ #[ repr( u16 ) ] // Must be kept in sync with the inner type of `DepKind`.
9189 enum DepKindDefs {
9290 $( $( #[ $attr] ) * $variant) ,*
9391 }
@@ -97,14 +95,15 @@ macro_rules! define_dep_nodes {
9795 use super :: * ;
9896
9997 $(
98+ // The `as u16` cast must be kept in sync with the inner type of `DepKind`.
10099 pub const $variant: DepKind = DepKind :: new( DepKindDefs :: $variant as u16 ) ;
101100 ) *
102101 }
103102
104103 // This checks that the discriminants of the variants have been assigned consecutively
105104 // from 0 so that they can be used as a dense index.
106105 pub const DEP_KIND_VARIANTS : u16 = {
107- let deps: & [ DepKind ] = & [ $( dep_kinds:: $variant, ) * ] ;
106+ let deps = & [ $( dep_kinds:: $variant, ) * ] ;
108107 let mut i = 0 ;
109108 while i < deps. len( ) {
110109 if i != deps[ i] . as_usize( ) {
@@ -143,8 +142,6 @@ rustc_query_append!(define_dep_nodes![
143142 [ ] fn CompileMonoItem ( ) -> ( ) ,
144143] ) ;
145144
146- static_assert_size ! ( DepKind , 2 ) ;
147-
148145// WARNING: `construct` is generic and does not know that `CompileCodegenUnit` takes `Symbol`s as keys.
149146// Be very careful changing this type signature!
150147pub ( crate ) fn make_compile_codegen_unit ( tcx : TyCtxt < ' _ > , name : Symbol ) -> DepNode {
0 commit comments