@@ -58,6 +58,7 @@ use stable_mir::ty::{RigidTy, Ty as TyStable, TyKind};
5858/// - Extract the tail element of the struct which are of type `T` and `U`, respectively.
5959/// 4. Coercion between smart pointers of wrapper structs.
6060/// - Apply the logic from item 2 then item 3.
61+ #[ allow( dead_code) ]
6162pub fn extract_unsize_casting_stable (
6263 tcx : TyCtxt ,
6364 src_ty : TyStable ,
@@ -89,14 +90,12 @@ pub fn extract_unsize_casting<'tcx>(
8990 . last ( )
9091 . unwrap ( ) ;
9192 // Extract the pointee type that is being coerced.
92- let src_pointee_ty = extract_pointee ( tcx, coerce_info. src_ty ) . expect ( & format ! (
93- "Expected source to be a pointer. Found {:?} instead" ,
94- coerce_info. src_ty
95- ) ) ;
96- let dst_pointee_ty = extract_pointee ( tcx, coerce_info. dst_ty ) . expect ( & format ! (
97- "Expected destination to be a pointer. Found {:?} instead" ,
98- coerce_info. dst_ty
99- ) ) ;
93+ let src_pointee_ty = extract_pointee ( tcx, coerce_info. src_ty ) . unwrap_or_else ( || {
94+ panic ! ( "Expected source to be a pointer. Found {:?} instead" , coerce_info. src_ty)
95+ } ) ;
96+ let dst_pointee_ty = extract_pointee ( tcx, coerce_info. dst_ty ) . unwrap_or_else ( || {
97+ panic ! ( "Expected destination to be a pointer. Found {:?} instead" , coerce_info. dst_ty)
98+ } ) ;
10099 // Find the tail of the coercion that determines the type of metadata to be stored.
101100 let ( src_base_ty, dst_base_ty) = tcx. struct_lockstep_tails_for_codegen (
102101 src_pointee_ty,
@@ -124,6 +123,7 @@ pub struct CoercionBase<'tcx> {
124123}
125124
126125#[ derive( Debug ) ]
126+ #[ allow( dead_code) ]
127127pub struct CoercionBaseStable {
128128 pub src_ty : TyStable ,
129129 pub dst_ty : TyStable ,
@@ -221,8 +221,8 @@ impl Iterator for CoerceUnsizedIterator<'_> {
221221 let coerce_index = coerce_index. as_usize ( ) ;
222222 assert ! ( coerce_index < src_fields. len( ) ) ;
223223
224- self . src_ty = Some ( src_fields[ coerce_index] . ty_with_args ( & src_args) ) ;
225- self . dst_ty = Some ( dst_fields[ coerce_index] . ty_with_args ( & dst_args) ) ;
224+ self . src_ty = Some ( src_fields[ coerce_index] . ty_with_args ( src_args) ) ;
225+ self . dst_ty = Some ( dst_fields[ coerce_index] . ty_with_args ( dst_args) ) ;
226226 Some ( src_fields[ coerce_index] . name . clone ( ) )
227227 }
228228 _ => {
0 commit comments