@@ -268,28 +268,29 @@ fn fn_abi_of_instance<'tcx>(
268
268
}
269
269
270
270
// Handle safe Rust thin and wide pointers.
271
- fn adjust_for_rust_scalar < ' tcx > (
271
+ fn arg_attrs_for_rust_scalar < ' tcx > (
272
272
cx : LayoutCx < ' tcx > ,
273
- attrs : & mut ArgAttributes ,
274
273
scalar : Scalar ,
275
274
layout : TyAndLayout < ' tcx > ,
276
275
offset : Size ,
277
276
is_return : bool ,
278
277
drop_target_pointee : Option < Ty < ' tcx > > ,
279
- ) {
278
+ ) -> ArgAttributes {
279
+ let mut attrs = ArgAttributes :: new ( ) ;
280
+
280
281
// Booleans are always a noundef i1 that needs to be zero-extended.
281
282
if scalar. is_bool ( ) {
282
283
attrs. ext ( ArgExtension :: Zext ) ;
283
284
attrs. set ( ArgAttribute :: NoUndef ) ;
284
- return ;
285
+ return attrs ;
285
286
}
286
287
287
288
if !scalar. is_uninit_valid ( ) {
288
289
attrs. set ( ArgAttribute :: NoUndef ) ;
289
290
}
290
291
291
292
// Only pointer types handled below.
292
- let Scalar :: Initialized { value : Pointer ( _) , valid_range } = scalar else { return } ;
293
+ let Scalar :: Initialized { value : Pointer ( _) , valid_range } = scalar else { return attrs } ;
293
294
294
295
// Set `nonnull` if the validity range excludes zero, or for the argument to `drop_in_place`,
295
296
// which must be nonnull per its documented safety requirements.
@@ -358,6 +359,8 @@ fn adjust_for_rust_scalar<'tcx>(
358
359
}
359
360
}
360
361
}
362
+
363
+ attrs
361
364
}
362
365
363
366
/// Ensure that the ABI makes basic sense.
@@ -530,17 +533,7 @@ fn fn_abi_new_uncached<'tcx>(
530
533
} ;
531
534
532
535
let mut arg = ArgAbi :: new ( cx, layout, |layout, scalar, offset| {
533
- let mut attrs = ArgAttributes :: new ( ) ;
534
- adjust_for_rust_scalar (
535
- * cx,
536
- & mut attrs,
537
- scalar,
538
- * layout,
539
- offset,
540
- is_return,
541
- drop_target_pointee,
542
- ) ;
543
- attrs
536
+ arg_attrs_for_rust_scalar ( * cx, scalar, * layout, offset, is_return, drop_target_pointee)
544
537
} ) ;
545
538
546
539
if arg. layout . is_zst ( ) {
0 commit comments