@@ -268,28 +268,29 @@ fn fn_abi_of_instance<'tcx>(
268268}
269269
270270// Handle safe Rust thin and wide pointers.
271- fn adjust_for_rust_scalar < ' tcx > (
271+ fn arg_attrs_for_rust_scalar < ' tcx > (
272272 cx : LayoutCx < ' tcx > ,
273- attrs : & mut ArgAttributes ,
274273 scalar : Scalar ,
275274 layout : TyAndLayout < ' tcx > ,
276275 offset : Size ,
277276 is_return : bool ,
278277 drop_target_pointee : Option < Ty < ' tcx > > ,
279- ) {
278+ ) -> ArgAttributes {
279+ let mut attrs = ArgAttributes :: new ( ) ;
280+
280281 // Booleans are always a noundef i1 that needs to be zero-extended.
281282 if scalar. is_bool ( ) {
282283 attrs. ext ( ArgExtension :: Zext ) ;
283284 attrs. set ( ArgAttribute :: NoUndef ) ;
284- return ;
285+ return attrs ;
285286 }
286287
287288 if !scalar. is_uninit_valid ( ) {
288289 attrs. set ( ArgAttribute :: NoUndef ) ;
289290 }
290291
291292 // 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 } ;
293294
294295 // Set `nonnull` if the validity range excludes zero, or for the argument to `drop_in_place`,
295296 // which must be nonnull per its documented safety requirements.
@@ -358,6 +359,8 @@ fn adjust_for_rust_scalar<'tcx>(
358359 }
359360 }
360361 }
362+
363+ attrs
361364}
362365
363366/// Ensure that the ABI makes basic sense.
@@ -530,17 +533,7 @@ fn fn_abi_new_uncached<'tcx>(
530533 } ;
531534
532535 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)
544537 } ) ;
545538
546539 if arg. layout . is_zst ( ) {
0 commit comments