File tree 1 file changed +4
-7
lines changed
compiler/rustc_transmute/src
1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ mod rustc {
123
123
param_env : ParamEnv < ' tcx > ,
124
124
c : Const < ' tcx > ,
125
125
) -> Self {
126
- use rustc_middle:: ty:: DestructuredConst ;
126
+ use rustc_middle:: ty:: ScalarInt ;
127
127
use rustc_middle:: ty:: TypeVisitable ;
128
128
use rustc_span:: symbol:: sym;
129
129
@@ -142,9 +142,8 @@ mod rustc {
142
142
LangItem :: TransmuteOpts . name( ) ,
143
143
) ;
144
144
145
- let DestructuredConst { variant, fields } = tcx. destructure_const ( c) ;
146
- let variant_idx = variant. expect ( "The given `Const` must be an ADT." ) ;
147
- let variant = adt_def. variant ( variant_idx) ;
145
+ let variant = adt_def. non_enum_variant ( ) ;
146
+ let fields = c. to_valtree ( ) . unwrap_branch ( ) ;
148
147
149
148
let get_field = |name| {
150
149
let ( field_idx, _) = variant
@@ -153,9 +152,7 @@ mod rustc {
153
152
. enumerate ( )
154
153
. find ( |( _, field_def) | name == field_def. name )
155
154
. expect ( & format ! ( "There were no fields named `{name}`." ) ) ;
156
- fields[ field_idx] . try_eval_bool ( tcx, param_env) . expect ( & format ! (
157
- "The field named `{name}` lang item could not be evaluated to a bool."
158
- ) )
155
+ fields[ field_idx] . unwrap_leaf ( ) == ScalarInt :: TRUE
159
156
} ;
160
157
161
158
Self {
You can’t perform that action at this time.
0 commit comments