File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
src/librustc_mir/transform/check_consts Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change
1
+ use rustc:: mir:: * ;
2
+ use rustc:: mir:: interpret:: ConstValue ;
3
+ use rustc:: ty:: { self , Ty } ;
4
+ use rustc_data_structures:: bit_set:: BitSet ;
5
+ use syntax_pos:: DUMMY_SP ;
6
+
7
+ use super :: Item as ConstCx ;
8
+ use super :: validation:: Mode ;
9
+
10
+ #[ derive( Clone , Copy ) ]
11
+ pub struct QualifSet ( u8 ) ;
12
+
13
+ impl QualifSet {
14
+ fn contains < Q : ?Sized + Qualif > ( self ) -> bool {
15
+ self . 0 & ( 1 << Q :: IDX ) != 0
16
+ }
17
+ }
18
+
1
19
/// A "qualif"(-ication) is a way to look for something "bad" in the MIR that would disqualify some
2
20
/// code for promotion or prevent it from evaluating at compile time. So `return true` means
3
21
/// "I found something bad, no reason to go on searching". `false` is only returned if we
@@ -103,7 +121,7 @@ pub trait Qualif {
103
121
} else {
104
122
let ( bits, _) = cx. tcx . at ( constant. span ) . mir_const_qualif ( def_id) ;
105
123
106
- let qualif = PerQualif :: decode_from_bits ( bits) . 0 [ Self :: IDX ] ;
124
+ let qualif = QualifSet ( bits) . contains :: < Self > ( ) ;
107
125
108
126
// Just in case the type is more specific than
109
127
// the definition, e.g., impl associated const
You can’t perform that action at this time.
0 commit comments