@@ -2736,13 +2736,14 @@ where
27362736 let arg_of = |ty : Ty < ' tcx > , arg_idx : Option < usize > | {
27372737 let is_return = arg_idx. is_none ( ) ;
27382738
2739+ let layout = cx. layout_of ( ty) ;
27392740 let layout = if force_thin_self_ptr && arg_idx == Some ( 0 ) {
27402741 // Don't pass the vtable, it's not an argument of the virtual fn.
27412742 // Instead, pass just the data pointer, but give it the type `*const/mut dyn Trait`
27422743 // or `&/&mut dyn Trait` because this is special-cased elsewhere in codegen
2743- make_thin_self_ptr ( cx, cx . layout_of ( ty ) )
2744+ make_thin_self_ptr ( cx, layout )
27442745 } else {
2745- cx . layout_of ( ty )
2746+ layout
27462747 } ;
27472748
27482749 let mut arg = ArgAbi :: new ( cx, layout, |layout, scalar, offset| {
@@ -2842,11 +2843,9 @@ where
28422843 let max_by_val_size = Pointer . size ( cx) * 2 ;
28432844 let size = arg. layout . size ;
28442845
2845- assert ! (
2846- matches!( arg. mode, PassMode :: Indirect { on_stack: false , .. } ) ,
2847- "{:?}" ,
2848- arg
2849- ) ;
2846+ let is_indirect_not_on_stack =
2847+ matches ! ( arg. mode, PassMode :: Indirect { on_stack: false , .. } ) ;
2848+ assert ! ( is_indirect_not_on_stack, "{:?}" , arg) ;
28502849 if !arg. layout . is_unsized ( ) && size <= max_by_val_size {
28512850 // We want to pass small aggregates as immediates, but using
28522851 // a LLVM aggregate type for this leads to bad optimizations,
0 commit comments