@@ -14,10 +14,6 @@ impl<'tcx, 'ctx> ItemTransCtx<'tcx, 'ctx> {
1414 ) -> Result < ConstantExprKind , Error > {
1515 Ok ( match v {
1616 hax:: ConstantLiteral :: ByteStr ( bs) => ConstantExprKind :: ByteStr ( bs. clone ( ) ) ,
17- // The data backing a string, when we represent strings as unsized [u8]s.
18- hax:: ConstantLiteral :: Str ( str) if self . t_ctx . options . unsized_strings => {
19- ConstantExprKind :: RawMemory ( str. bytes ( ) . map ( Byte :: Value ) . collect ( ) )
20- }
2117 // A `str` value not behind a reference, e.g. the tail of a `str`-tailed DST
2218 hax:: ConstantLiteral :: Str ( str) => {
2319 let ty_is_sized = self . translate_sized_proof ( span, self . tcx . types . u8 ) ?;
@@ -175,8 +171,7 @@ impl<'tcx, 'ctx> ItemTransCtx<'tcx, 'ctx> {
175171 ..
176172 } if ty. is_ref ( )
177173 && let hax:: ConstantExprKind :: Literal ( hax:: ConstantLiteral :: Str ( s) ) =
178- arg. contents . as_ref ( )
179- && !self . t_ctx . options . unsized_strings =>
174+ arg. contents . as_ref ( ) =>
180175 {
181176 ConstantExprKind :: Str ( s. clone ( ) )
182177 }
@@ -191,20 +186,7 @@ impl<'tcx, 'ctx> ItemTransCtx<'tcx, 'ctx> {
191186 ty : self . translate_ty ( span, base_ty) ?,
192187 } ,
193188 hax:: ConstantPtrBase :: Value ( arg) => {
194- let mut val = self . translate_constant_expr ( span, arg) ?;
195- // With `--unsized-strings`, a string literal is the `[u8; N]` behind the
196- // `&str`.
197- if ty. is_ref ( )
198- && let hax:: ConstantExprKind :: Literal ( hax:: ConstantLiteral :: Str ( s) ) =
199- arg. contents . as_ref ( )
200- {
201- let len = ConstantExpr :: mk_usize ( s. len ( ) as u128 ) ;
202- let ty_is_sized =
203- self . translate_sized_proof ( span, self . tcx . types . u8 ) ?;
204- let array_ty = Ty :: mk_array ( Ty :: mk_u8 ( ) , len, ty_is_sized) ;
205- val. with_contents_mut ( |_, ty| * ty = array_ty) ;
206- }
207- GlobalPlace :: new_value ( val)
189+ GlobalPlace :: new_value ( self . translate_constant_expr ( span, arg) ?)
208190 }
209191 } ;
210192 for ( proj, proj_ty) in projections {
0 commit comments