This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
compiler/rustc_transmute/src Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ mod rustc {
123123 param_env : ParamEnv < ' tcx > ,
124124 c : Const < ' tcx > ,
125125 ) -> Self {
126- use rustc_middle:: ty:: DestructuredConst ;
126+ use rustc_middle:: ty:: ScalarInt ;
127127 use rustc_middle:: ty:: TypeVisitable ;
128128 use rustc_span:: symbol:: sym;
129129
@@ -142,9 +142,8 @@ mod rustc {
142142 LangItem :: TransmuteOpts . name( ) ,
143143 ) ;
144144
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 ( ) ;
148147
149148 let get_field = |name| {
150149 let ( field_idx, _) = variant
@@ -153,9 +152,7 @@ mod rustc {
153152 . enumerate ( )
154153 . find ( |( _, field_def) | name == field_def. name )
155154 . 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
159156 } ;
160157
161158 Self {
You can’t perform that action at this time.
0 commit comments