@@ -65,7 +65,6 @@ use rustc_hir::definitions::DefPathHash;
65
65
use rustc_hir:: { HirId , ItemLocalId , OwnerId } ;
66
66
use rustc_query_system:: dep_graph:: FingerprintStyle ;
67
67
use rustc_span:: symbol:: Symbol ;
68
- use std:: hash:: Hash ;
69
68
70
69
pub use rustc_query_system:: dep_graph:: dep_node:: DepKind ;
71
70
pub use rustc_query_system:: dep_graph:: { DepContext , DepNode , DepNodeParams } ;
@@ -85,9 +84,8 @@ macro_rules! define_dep_nodes {
85
84
// encoding. The derived Encodable/Decodable uses leb128 encoding which is
86
85
// dense when only considering this enum. But DepKind is encoded in a larger
87
86
// struct, and there we can take advantage of the unused bits in the u16.
88
- #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash ) ]
89
87
#[ allow( non_camel_case_types) ]
90
- #[ repr( u16 ) ]
88
+ #[ repr( u16 ) ] // Must be kept in sync with the inner type of `DepKind`.
91
89
enum DepKindDefs {
92
90
$( $( #[ $attr] ) * $variant) ,*
93
91
}
@@ -97,14 +95,15 @@ macro_rules! define_dep_nodes {
97
95
use super :: * ;
98
96
99
97
$(
98
+ // The `as u16` cast must be kept in sync with the inner type of `DepKind`.
100
99
pub const $variant: DepKind = DepKind :: new( DepKindDefs :: $variant as u16 ) ;
101
100
) *
102
101
}
103
102
104
103
// This checks that the discriminants of the variants have been assigned consecutively
105
104
// from 0 so that they can be used as a dense index.
106
105
pub const DEP_KIND_VARIANTS : u16 = {
107
- let deps: & [ DepKind ] = & [ $( dep_kinds:: $variant, ) * ] ;
106
+ let deps = & [ $( dep_kinds:: $variant, ) * ] ;
108
107
let mut i = 0 ;
109
108
while i < deps. len( ) {
110
109
if i != deps[ i] . as_usize( ) {
@@ -143,8 +142,6 @@ rustc_query_append!(define_dep_nodes![
143
142
[ ] fn CompileMonoItem ( ) -> ( ) ,
144
143
] ) ;
145
144
146
- static_assert_size ! ( DepKind , 2 ) ;
147
-
148
145
// WARNING: `construct` is generic and does not know that `CompileCodegenUnit` takes `Symbol`s as keys.
149
146
// Be very careful changing this type signature!
150
147
pub ( crate ) fn make_compile_codegen_unit ( tcx : TyCtxt < ' _ > , name : Symbol ) -> DepNode {
0 commit comments