Skip to content

Fix inappropriate bool calling convention for aarch64#159317

Draft
workingjubilee wants to merge 3 commits into
rust-lang:mainfrom
workingjubilee:aarch64-bool-callconv
Draft

Fix inappropriate bool calling convention for aarch64#159317
workingjubilee wants to merge 3 commits into
rust-lang:mainfrom
workingjubilee:aarch64-bool-callconv

Conversation

@workingjubilee

@workingjubilee workingjubilee commented Jul 15, 2026

Copy link
Copy Markdown
Member

TODO:

  1. Get a real codegen test
  2. Get a real assembly test for aarch64
  3. Get ahead of perf regressions by having Rust ABIs fix this?

Currently in draft mode, posting it now to kick my ass into finishing it tomorrow(?).

Will address #159244

We still attach `noundef` using the code that immediately follows.
It will be fine, trust.
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 15, 2026
Comment on lines -334 to -340
// Booleans are always a noundef i1 that needs to be zero-extended.
if scalar.is_bool() {
attrs.ext(ArgExtension::Zext);
attrs.set(ArgAttribute::NoUndef);
return attrs;
}

@workingjubilee workingjubilee Jul 15, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about doing a fancier handling based on a test of the ExternAbi but I think the way to fix the probably-inevitable performance regressions on some platforms is to have Rust ABI impls handle having their own zero-extension policy.

View changes since the review

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- [ui] tests/ui/abi/bad-regression-test.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/abi/bad-regression-test.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/abi/bad-regression-test/a" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: linking with `cc` failed: exit status: 1
   |
   = note:  "cc" "-Wl,--fix-cortex-a53-843419" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/abi/bad-regression-test/rustcgJrZ6R/symbols.o" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bdynamic" "-lget_a" "<sysroot>/lib/rustlib/aarch64-unknown-linux-gnu/lib/libstd-9dc72fd00365d7c9.so" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-*.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/abi/bad-regression-test/rustcgJrZ6R/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-L" "<sysroot>/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/abi/bad-regression-test/a" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-debug" "-nodefaultlibs" "-Wl,-rpath,$ORIGIN/../../../../stage2/lib/rustlib/aarch64-unknown-linux-gnu/lib,--enable-new-dtags,-z,origin"
   = note: some arguments are omitted. use `--verbose` to show all linker arguments
   = note: /usr/bin/ld: cannot find -lget_a: No such file or directory
           collect2: error: ld returned 1 exit status
           

error: aborting due to 1 previous error
------------------------------------------
---
diff of stderr:

111                mode: Direct(
112                    ArgAttributes {
113                        regular: NoUndef,
-                        arg_ext: Zext,
+                        arg_ext: None,
115                        pointee_size: Size(0 bytes),
116                        pointee_align: None,
117                    },

169                    mode: Direct(
170                        ArgAttributes {
171                            regular: NoUndef,
-                            arg_ext: Zext,
+                            arg_ext: None,
173                            pointee_size: Size(0 bytes),
174                            pointee_align: None,
175                        },


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args abi/debug.rs`

error in revision `generic`: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/abi/debug.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--cfg" "generic" "--check-cfg" "cfg(test,FALSE,generic,riscv64,loongarch64)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/abi/debug.generic" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Cpanic=abort" "-Cforce-unwind-tables=yes" "-O" "--extern" "minicore=/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/abi/debug.generic/libminicore.rlib"
stdout: none
--- stderr -------------------------------
error: `#[rustc_abi]` attribute cannot be used on constants
##[error]  --> /checkout/tests/ui/abi/debug.rs:42:1
   |
LL | #[rustc_abi(debug)] //~ ERROR: `#[rustc_abi]` attribute cannot be used on constants
   | ^^^^^^^^^^^^^^^^^^^
   |
   = help: `#[rustc_abi]` can be applied to functions and type aliases

error: `#[rustc_abi]` attribute cannot be used on associated consts
##[error]  --> /checkout/tests/ui/abi/debug.rs:46:5
   |
LL |     #[rustc_abi(debug)] //~ ERROR: `#[rustc_abi]` attribute cannot be used on assoc
   |     ^^^^^^^^^^^^^^^^^^^
   |
   = help: `#[rustc_abi]` can be applied to functions and type aliases

error[E0539]: malformed `rustc_abi` attribute input
##[error]  --> /checkout/tests/ui/abi/debug.rs:74:1
   |
LL | #[rustc_abi("assert_eq")] //~ ERROR malformed `rustc_abi` attribute input
   | ^^^^^^^^^^^-------------^
   |            |
   |            valid arguments are `assert_eq` or `debug`
   |
help: try changing it to one of the following valid forms of the attribute
   |
LL - #[rustc_abi("assert_eq")] //~ ERROR malformed `rustc_abi` attribute input
LL + #[rustc_abi(assert_eq)] //~ ERROR malformed `rustc_abi` attribute input
   |
LL - #[rustc_abi("assert_eq")] //~ ERROR malformed `rustc_abi` attribute input
LL + #[rustc_abi(debug)] //~ ERROR malformed `rustc_abi` attribute input
   |

error: fn_abi_of(test) = FnAbi {
           args: [
               ArgAbi {
                   layout: TyAndLayout {
                       ty: u8,
                       layout: Layout {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: None,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
                   },
               },
               mode: Direct(
                   ArgAttributes {
                       regular: NoUndef,
                       arg_ext: None,
                       pointee_size: Size(0 bytes),
                       pointee_align: None,
                   },
               ),
           },
           c_variadic: false,
           fixed_count: 1,
           conv: Rust,
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:31:1
   |
LL | fn test(_x: u8) -> bool {
   | ^^^^^^^^^^^^^^^^^^^^^^^

error: fn_abi_of(TestFnPtr) = FnAbi {
           args: [
               ArgAbi {
                   layout: TyAndLayout {
                       ty: bool,
                       layout: Layout {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: None,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
                   },
               },
               mode: Direct(
                   ArgAttributes {
                       regular: NoUndef,
                       arg_ext: None,
                       pointee_size: Size(0 bytes),
                       pointee_align: None,
                   },
               ),
           },
           c_variadic: false,
           fixed_count: 1,
           conv: Rust,
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:37:1
   |
LL | type TestFnPtr = fn(bool) -> u8; //~ ERROR: fn_abi
   | ^^^^^^^^^^^^^^

error: fn_abi_of(test_generic) = FnAbi {
           args: [
               ArgAbi {
                   layout: TyAndLayout {
                       ty: *const T,
                       layout: Layout {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: None,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:40:1
   |
LL | fn test_generic<T>(_x: *const T) {} //~ ERROR: fn_abi
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions
##[error]  --> /checkout/tests/ui/abi/debug.rs:43:1
   |
LL | const C: () = (); //~ ERROR: `#[rustc_abi]` can only be applied to
   | ^^^^^^^^^^^

error: ABIs are not compatible
       left ABI = FnAbi {
           args: [
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: None,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: None,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:59:1
   |
LL | type TestAbiNe = (fn(u8), fn(u32)); //~ ERROR: ABIs are not compatible
   | ^^^^^^^^^^^^^^

error: ABIs are not compatible
       left ABI = FnAbi {
           args: [
---
                       },
                   },
                   mode: Indirect {
                       attrs: ArgAttributes {
                           regular: CapturesAddress | NoAlias | NonNull | NoUndef | NoFree,
                           arg_ext: None,
                           pointee_size: Size(32 bytes),
                           pointee_align: Some(
                               Align(1 bytes),
                           ),
                       },
                       meta_attrs: None,
                       on_stack: false,
                   },
---
                       },
                   },
                   mode: Indirect {
                       attrs: ArgAttributes {
                           regular: CapturesAddress | NoAlias | NonNull | NoUndef | NoFree,
                           arg_ext: None,
                           pointee_size: Size(128 bytes),
                           pointee_align: Some(
                               Align(4 bytes),
                           ),
                       },
                       meta_attrs: None,
                       on_stack: false,
                   },
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:62:1
   |
LL | type TestAbiNeLarger = (fn([u8; 32]), fn([u32; 32])); //~ ERROR: ABIs are not compatible
   | ^^^^^^^^^^^^^^^^^^^^

error: ABIs are not compatible
       left ABI = FnAbi {
           args: [
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: None,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: None,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:65:1
   |
LL | type TestAbiNeFloat = (fn(f32), fn(u32)); //~ ERROR: ABIs are not compatible
   | ^^^^^^^^^^^^^^^^^^^

error: ABIs are not compatible
       left ABI = FnAbi {
           args: [
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: None,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: None,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:69:1
   |
LL | type TestAbiNeSign = (fn(i32), fn(u32)); //~ ERROR: ABIs are not compatible
   | ^^^^^^^^^^^^^^^^^^

error[E0277]: the size for values of type `str` cannot be known at compilation time
##[error]  --> /checkout/tests/ui/abi/debug.rs:72:46
   |
LL | type TestAbiEqNonsense = (fn((str, str)), fn((str, str))); //~ ERROR: cannot be known at compilation time
   |                                              ^^^^^^^^^^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `str`
   = note: only the last element of a tuple may have a dynamically sized type

error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions
##[error]  --> /checkout/tests/ui/abi/debug.rs:47:5
   |
LL |     const C: () = (); //~ ERROR: `#[rustc_abi]` can only be applied to
   |     ^^^^^^^^^^^

error: fn_abi_of(assoc_test) = FnAbi {
           args: [
               ArgAbi {
                   layout: TyAndLayout {
                       ty: &S,
                       layout: Layout {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: CapturesReadOnly | NoAlias | NonNull | ReadOnly | NoUndef | NoFree,
                           arg_ext: None,
                           pointee_size: Size(2 bytes),
                           pointee_align: Some(
                               Align(2 bytes),
                           ),
                       },
                   ),
               },
           ],
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:52:5
   |
LL |     fn assoc_test(&self) {} //~ ERROR: fn_abi
   |     ^^^^^^^^^^^^^^^^^^^^

error: aborting due to 14 previous errors

Some errors have detailed explanations: E0277, E0539.
---
diff of stderr:

111                mode: Direct(
112                    ArgAttributes {
113                        regular: NoUndef,
-                        arg_ext: Zext,
+                        arg_ext: None,
115                        pointee_size: Size(0 bytes),
116                        pointee_align: None,
117                    },


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args abi/debug.rs`

error in revision `loongarch64`: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/abi/debug.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--cfg" "loongarch64" "--check-cfg" "cfg(test,FALSE,generic,riscv64,loongarch64)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/abi/debug.loongarch64" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Cpanic=abort" "-Cforce-unwind-tables=yes" "-O" "--target" "loongarch64-unknown-linux-gnu" "--extern" "minicore=/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/abi/debug.loongarch64/libminicore.rlib"
stdout: none
--- stderr -------------------------------
error: `#[rustc_abi]` attribute cannot be used on constants
##[error]  --> /checkout/tests/ui/abi/debug.rs:42:1
   |
LL | #[rustc_abi(debug)] //~ ERROR: `#[rustc_abi]` attribute cannot be used on constants
   | ^^^^^^^^^^^^^^^^^^^
   |
   = help: `#[rustc_abi]` can be applied to functions and type aliases

error: `#[rustc_abi]` attribute cannot be used on associated consts
##[error]  --> /checkout/tests/ui/abi/debug.rs:46:5
   |
LL |     #[rustc_abi(debug)] //~ ERROR: `#[rustc_abi]` attribute cannot be used on assoc
   |     ^^^^^^^^^^^^^^^^^^^
   |
   = help: `#[rustc_abi]` can be applied to functions and type aliases

error[E0539]: malformed `rustc_abi` attribute input
##[error]  --> /checkout/tests/ui/abi/debug.rs:74:1
   |
LL | #[rustc_abi("assert_eq")] //~ ERROR malformed `rustc_abi` attribute input
   | ^^^^^^^^^^^-------------^
   |            |
   |            valid arguments are `assert_eq` or `debug`
   |
help: try changing it to one of the following valid forms of the attribute
   |
LL - #[rustc_abi("assert_eq")] //~ ERROR malformed `rustc_abi` attribute input
LL + #[rustc_abi(assert_eq)] //~ ERROR malformed `rustc_abi` attribute input
   |
LL - #[rustc_abi("assert_eq")] //~ ERROR malformed `rustc_abi` attribute input
LL + #[rustc_abi(debug)] //~ ERROR malformed `rustc_abi` attribute input
   |

error: fn_abi_of(test) = FnAbi {
           args: [
               ArgAbi {
                   layout: TyAndLayout {
                       ty: u8,
                       layout: Layout {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: Zext,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
                   },
               },
               mode: Direct(
                   ArgAttributes {
                       regular: NoUndef,
                       arg_ext: None,
                       pointee_size: Size(0 bytes),
                       pointee_align: None,
                   },
               ),
           },
           c_variadic: false,
           fixed_count: 1,
           conv: Rust,
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:31:1
   |
LL | fn test(_x: u8) -> bool {
   | ^^^^^^^^^^^^^^^^^^^^^^^

error: fn_abi_of(TestFnPtr) = FnAbi {
           args: [
               ArgAbi {
                   layout: TyAndLayout {
                       ty: bool,
                       layout: Layout {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: Zext,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
                   },
               },
               mode: Direct(
                   ArgAttributes {
                       regular: NoUndef,
                       arg_ext: None,
                       pointee_size: Size(0 bytes),
                       pointee_align: None,
                   },
               ),
           },
           c_variadic: false,
           fixed_count: 1,
           conv: Rust,
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:37:1
   |
LL | type TestFnPtr = fn(bool) -> u8; //~ ERROR: fn_abi
   | ^^^^^^^^^^^^^^

error: fn_abi_of(test_generic) = FnAbi {
           args: [
               ArgAbi {
                   layout: TyAndLayout {
                       ty: *const T,
                       layout: Layout {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: None,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:40:1
   |
LL | fn test_generic<T>(_x: *const T) {} //~ ERROR: fn_abi
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions
##[error]  --> /checkout/tests/ui/abi/debug.rs:43:1
   |
LL | const C: () = (); //~ ERROR: `#[rustc_abi]` can only be applied to
   | ^^^^^^^^^^^

error: ABIs are not compatible
       left ABI = FnAbi {
           args: [
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: Zext,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: Sext,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:59:1
   |
LL | type TestAbiNe = (fn(u8), fn(u32)); //~ ERROR: ABIs are not compatible
   | ^^^^^^^^^^^^^^

error: ABIs are not compatible
       left ABI = FnAbi {
           args: [
---
                       },
                   },
                   mode: Indirect {
                       attrs: ArgAttributes {
                           regular: CapturesAddress | NoAlias | NonNull | NoUndef | NoFree,
                           arg_ext: None,
                           pointee_size: Size(32 bytes),
                           pointee_align: Some(
                               Align(1 bytes),
                           ),
                       },
                       meta_attrs: None,
                       on_stack: false,
                   },
---
                       },
                   },
                   mode: Indirect {
                       attrs: ArgAttributes {
                           regular: CapturesAddress | NoAlias | NonNull | NoUndef | NoFree,
                           arg_ext: None,
                           pointee_size: Size(128 bytes),
                           pointee_align: Some(
                               Align(4 bytes),
                           ),
                       },
                       meta_attrs: None,
                       on_stack: false,
                   },
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:62:1
   |
LL | type TestAbiNeLarger = (fn([u8; 32]), fn([u32; 32])); //~ ERROR: ABIs are not compatible
   | ^^^^^^^^^^^^^^^^^^^^

error: ABIs are not compatible
       left ABI = FnAbi {
           args: [
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: None,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: Sext,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:65:1
   |
LL | type TestAbiNeFloat = (fn(f32), fn(u32)); //~ ERROR: ABIs are not compatible
   | ^^^^^^^^^^^^^^^^^^^

error: ABIs are not compatible
       left ABI = FnAbi {
           args: [
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: Sext,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: Sext,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:69:1
   |
LL | type TestAbiNeSign = (fn(i32), fn(u32)); //~ ERROR: ABIs are not compatible
   | ^^^^^^^^^^^^^^^^^^

error[E0277]: the size for values of type `str` cannot be known at compilation time
##[error]  --> /checkout/tests/ui/abi/debug.rs:72:46
   |
LL | type TestAbiEqNonsense = (fn((str, str)), fn((str, str))); //~ ERROR: cannot be known at compilation time
   |                                              ^^^^^^^^^^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `str`
   = note: only the last element of a tuple may have a dynamically sized type

error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions
##[error]  --> /checkout/tests/ui/abi/debug.rs:47:5
   |
LL |     const C: () = (); //~ ERROR: `#[rustc_abi]` can only be applied to
   |     ^^^^^^^^^^^

error: fn_abi_of(assoc_test) = FnAbi {
           args: [
               ArgAbi {
                   layout: TyAndLayout {
                       ty: &S,
                       layout: Layout {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: CapturesReadOnly | NoAlias | NonNull | ReadOnly | NoUndef | NoFree,
                           arg_ext: None,
                           pointee_size: Size(2 bytes),
                           pointee_align: Some(
                               Align(2 bytes),
                           ),
                       },
                   ),
               },
           ],
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:52:5
   |
LL |     fn assoc_test(&self) {} //~ ERROR: fn_abi
   |     ^^^^^^^^^^^^^^^^^^^^

error: aborting due to 14 previous errors

Some errors have detailed explanations: E0277, E0539.
For more information about an error, try `rustc --explain E0277`.
------------------------------------------

---- [ui] tests/ui/abi/debug.rs#loongarch64 stdout end ----
---- [ui] tests/ui/abi/debug.rs#riscv64 stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/abi/debug.riscv64/debug.riscv64.stderr`
diff of stderr:

111                mode: Direct(
112                    ArgAttributes {
113                        regular: NoUndef,
-                        arg_ext: Zext,
+                        arg_ext: None,
115                        pointee_size: Size(0 bytes),
116                        pointee_align: None,
117                    },


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args abi/debug.rs`

error in revision `riscv64`: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/abi/debug.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--cfg" "riscv64" "--check-cfg" "cfg(test,FALSE,generic,riscv64,loongarch64)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/abi/debug.riscv64" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Cpanic=abort" "-Cforce-unwind-tables=yes" "-O" "--target" "riscv64gc-unknown-linux-gnu" "--extern" "minicore=/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/abi/debug.riscv64/libminicore.rlib"
stdout: none
--- stderr -------------------------------
error: `#[rustc_abi]` attribute cannot be used on constants
##[error]  --> /checkout/tests/ui/abi/debug.rs:42:1
   |
LL | #[rustc_abi(debug)] //~ ERROR: `#[rustc_abi]` attribute cannot be used on constants
   | ^^^^^^^^^^^^^^^^^^^
   |
   = help: `#[rustc_abi]` can be applied to functions and type aliases

error: `#[rustc_abi]` attribute cannot be used on associated consts
##[error]  --> /checkout/tests/ui/abi/debug.rs:46:5
   |
LL |     #[rustc_abi(debug)] //~ ERROR: `#[rustc_abi]` attribute cannot be used on assoc
   |     ^^^^^^^^^^^^^^^^^^^
   |
   = help: `#[rustc_abi]` can be applied to functions and type aliases

error[E0539]: malformed `rustc_abi` attribute input
##[error]  --> /checkout/tests/ui/abi/debug.rs:74:1
   |
LL | #[rustc_abi("assert_eq")] //~ ERROR malformed `rustc_abi` attribute input
   | ^^^^^^^^^^^-------------^
   |            |
   |            valid arguments are `assert_eq` or `debug`
   |
help: try changing it to one of the following valid forms of the attribute
   |
LL - #[rustc_abi("assert_eq")] //~ ERROR malformed `rustc_abi` attribute input
LL + #[rustc_abi(assert_eq)] //~ ERROR malformed `rustc_abi` attribute input
   |
LL - #[rustc_abi("assert_eq")] //~ ERROR malformed `rustc_abi` attribute input
LL + #[rustc_abi(debug)] //~ ERROR malformed `rustc_abi` attribute input
   |

error: fn_abi_of(test) = FnAbi {
           args: [
               ArgAbi {
                   layout: TyAndLayout {
                       ty: u8,
                       layout: Layout {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: Zext,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
                   },
               },
               mode: Direct(
                   ArgAttributes {
                       regular: NoUndef,
                       arg_ext: None,
                       pointee_size: Size(0 bytes),
                       pointee_align: None,
                   },
               ),
           },
           c_variadic: false,
           fixed_count: 1,
           conv: Rust,
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:31:1
   |
LL | fn test(_x: u8) -> bool {
   | ^^^^^^^^^^^^^^^^^^^^^^^

error: fn_abi_of(TestFnPtr) = FnAbi {
           args: [
               ArgAbi {
                   layout: TyAndLayout {
                       ty: bool,
                       layout: Layout {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: Zext,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
                   },
               },
               mode: Direct(
                   ArgAttributes {
                       regular: NoUndef,
                       arg_ext: None,
                       pointee_size: Size(0 bytes),
                       pointee_align: None,
                   },
               ),
           },
           c_variadic: false,
           fixed_count: 1,
           conv: Rust,
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:37:1
   |
LL | type TestFnPtr = fn(bool) -> u8; //~ ERROR: fn_abi
   | ^^^^^^^^^^^^^^

error: fn_abi_of(test_generic) = FnAbi {
           args: [
               ArgAbi {
                   layout: TyAndLayout {
                       ty: *const T,
                       layout: Layout {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: None,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:40:1
   |
LL | fn test_generic<T>(_x: *const T) {} //~ ERROR: fn_abi
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions
##[error]  --> /checkout/tests/ui/abi/debug.rs:43:1
   |
LL | const C: () = (); //~ ERROR: `#[rustc_abi]` can only be applied to
   | ^^^^^^^^^^^

error: ABIs are not compatible
       left ABI = FnAbi {
           args: [
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: Zext,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: Sext,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:59:1
   |
LL | type TestAbiNe = (fn(u8), fn(u32)); //~ ERROR: ABIs are not compatible
   | ^^^^^^^^^^^^^^

error: ABIs are not compatible
       left ABI = FnAbi {
           args: [
---
                       },
                   },
                   mode: Indirect {
                       attrs: ArgAttributes {
                           regular: CapturesAddress | NoAlias | NonNull | NoUndef | NoFree,
                           arg_ext: None,
                           pointee_size: Size(32 bytes),
                           pointee_align: Some(
                               Align(1 bytes),
                           ),
                       },
                       meta_attrs: None,
                       on_stack: false,
                   },
---
                       },
                   },
                   mode: Indirect {
                       attrs: ArgAttributes {
                           regular: CapturesAddress | NoAlias | NonNull | NoUndef | NoFree,
                           arg_ext: None,
                           pointee_size: Size(128 bytes),
                           pointee_align: Some(
                               Align(4 bytes),
                           ),
                       },
                       meta_attrs: None,
                       on_stack: false,
                   },
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:62:1
   |
LL | type TestAbiNeLarger = (fn([u8; 32]), fn([u32; 32])); //~ ERROR: ABIs are not compatible
   | ^^^^^^^^^^^^^^^^^^^^

error: ABIs are not compatible
       left ABI = FnAbi {
           args: [
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: None,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: Sext,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:65:1
   |
LL | type TestAbiNeFloat = (fn(f32), fn(u32)); //~ ERROR: ABIs are not compatible
   | ^^^^^^^^^^^^^^^^^^^

error: ABIs are not compatible
       left ABI = FnAbi {
           args: [
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: Sext,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: NoUndef,
                           arg_ext: Sext,
                           pointee_size: Size(0 bytes),
                           pointee_align: None,
                       },
                   ),
               },
           ],
           ret: ArgAbi {
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:69:1
   |
LL | type TestAbiNeSign = (fn(i32), fn(u32)); //~ ERROR: ABIs are not compatible
   | ^^^^^^^^^^^^^^^^^^

error[E0277]: the size for values of type `str` cannot be known at compilation time
##[error]  --> /checkout/tests/ui/abi/debug.rs:72:46
   |
LL | type TestAbiEqNonsense = (fn((str, str)), fn((str, str))); //~ ERROR: cannot be known at compilation time
   |                                              ^^^^^^^^^^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `str`
   = note: only the last element of a tuple may have a dynamically sized type

error: `#[rustc_abi]` can only be applied to function items, type aliases, and associated functions
##[error]  --> /checkout/tests/ui/abi/debug.rs:47:5
   |
LL |     const C: () = (); //~ ERROR: `#[rustc_abi]` can only be applied to
   |     ^^^^^^^^^^^

error: fn_abi_of(assoc_test) = FnAbi {
           args: [
               ArgAbi {
                   layout: TyAndLayout {
                       ty: &S,
                       layout: Layout {
---
                       },
                   },
                   mode: Direct(
                       ArgAttributes {
                           regular: CapturesReadOnly | NoAlias | NonNull | ReadOnly | NoUndef | NoFree,
                           arg_ext: None,
                           pointee_size: Size(2 bytes),
                           pointee_align: Some(
                               Align(2 bytes),
                           ),
                       },
                   ),
               },
           ],
---
           can_unwind: false,
       }
  --> /checkout/tests/ui/abi/debug.rs:52:5
   |
LL |     fn assoc_test(&self) {} //~ ERROR: fn_abi
   |     ^^^^^^^^^^^^^^^^^^^^

error: aborting due to 14 previous errors

Some errors have detailed explanations: E0277, E0539.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants