@@ -3,7 +3,7 @@ use rustc_data_structures::stack::ensure_sufficient_stack;
33use rustc_middle:: mir:: interpret:: { EvalToValTreeResult , GlobalId , ValTreeCreationError } ;
44use rustc_middle:: traits:: ObligationCause ;
55use rustc_middle:: ty:: layout:: { LayoutCx , TyAndLayout } ;
6- use rustc_middle:: ty:: { self , Ty , TyCtxt , ValTreeKindExt } ;
6+ use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
77use rustc_middle:: { bug, mir} ;
88use rustc_span:: DUMMY_SP ;
99use tracing:: { debug, instrument, trace} ;
@@ -204,7 +204,7 @@ fn reconstruct_place_meta<'tcx>(
204204 & ObligationCause :: dummy ( ) ,
205205 |ty| ty,
206206 || {
207- let branches = last_valtree. unwrap_branch ( ) ;
207+ let branches = last_valtree. to_branch ( ) ;
208208 last_valtree = branches. last ( ) . unwrap ( ) . to_value ( ) . valtree ;
209209 debug ! ( ?branches, ?last_valtree) ;
210210 } ,
@@ -216,7 +216,7 @@ fn reconstruct_place_meta<'tcx>(
216216 } ;
217217
218218 // Get the number of elements in the unsized field.
219- let num_elems = last_valtree. unwrap_branch ( ) . len ( ) ;
219+ let num_elems = last_valtree. to_branch ( ) . len ( ) ;
220220 MemPlaceMeta :: Meta ( Scalar :: from_target_usize ( num_elems as u64 , & tcx) )
221221}
222222
@@ -278,7 +278,7 @@ pub fn valtree_to_const_value<'tcx>(
278278 mir:: ConstValue :: ZeroSized
279279 }
280280 ty:: Bool | ty:: Int ( _) | ty:: Uint ( _) | ty:: Float ( _) | ty:: Char | ty:: RawPtr ( _, _) => {
281- mir:: ConstValue :: Scalar ( Scalar :: Int ( cv. valtree . unwrap_leaf ( ) ) )
281+ mir:: ConstValue :: Scalar ( Scalar :: Int ( cv. to_leaf ( ) ) )
282282 }
283283 ty:: Pat ( ty, _) => {
284284 let cv = ty:: Value { valtree : cv. valtree , ty } ;
@@ -305,7 +305,7 @@ pub fn valtree_to_const_value<'tcx>(
305305 || matches ! ( cv. ty. kind( ) , ty:: Adt ( def, _) if def. is_struct( ) ) )
306306 {
307307 // A Scalar tuple/struct; we can avoid creating an allocation.
308- let branches = cv. valtree . unwrap_branch ( ) ;
308+ let branches = cv. to_branch ( ) ;
309309 // Find the non-ZST field. (There can be aligned ZST!)
310310 for ( i, & inner_valtree) in branches. iter ( ) . enumerate ( ) {
311311 let field = layout. field ( & LayoutCx :: new ( tcx, typing_env) , i) ;
@@ -386,7 +386,7 @@ fn valtree_into_mplace<'tcx>(
386386 // Zero-sized type, nothing to do.
387387 }
388388 ty:: Bool | ty:: Int ( _) | ty:: Uint ( _) | ty:: Float ( _) | ty:: Char | ty:: RawPtr ( ..) => {
389- let scalar_int = valtree. unwrap_leaf ( ) ;
389+ let scalar_int = valtree. to_leaf ( ) ;
390390 debug ! ( "writing trivial valtree {:?} to place {:?}" , scalar_int, place) ;
391391 ecx. write_immediate ( Immediate :: Scalar ( scalar_int. into ( ) ) , place) . unwrap ( ) ;
392392 }
@@ -396,13 +396,13 @@ fn valtree_into_mplace<'tcx>(
396396 ecx. write_immediate ( imm, place) . unwrap ( ) ;
397397 }
398398 ty:: Adt ( _, _) | ty:: Tuple ( _) | ty:: Array ( _, _) | ty:: Str | ty:: Slice ( _) => {
399- let branches = valtree. unwrap_branch ( ) ;
399+ let branches = valtree. to_branch ( ) ;
400400
401401 // Need to downcast place for enums
402402 let ( place_adjusted, branches, variant_idx) = match ty. kind ( ) {
403403 ty:: Adt ( def, _) if def. is_enum ( ) => {
404404 // First element of valtree corresponds to variant
405- let scalar_int = branches[ 0 ] . to_value ( ) . valtree . unwrap_leaf ( ) ;
405+ let scalar_int = branches[ 0 ] . to_leaf ( ) ;
406406 let variant_idx = VariantIdx :: from_u32 ( scalar_int. to_u32 ( ) ) ;
407407 let variant = def. variant ( variant_idx) ;
408408 debug ! ( ?variant) ;
0 commit comments