rust/tests
Jubilee Young 2edf6c8784 Default repr(C) enums to c_int size
This is what ISO C strongly implies this is correct, and
many processor-specific ABIs imply or mandate this size, so
"everyone" (LLVM, gcc...) defaults to emitting enums this way.
However, this is by no means guaranteed by ISO C,
and the bare-metal Arm targets show it can be overridden,
which rustc supports via `c-enum-min-bits` in a target.json.

The override is a flag named `-fshort-enums` in clang and gcc,
but introducing a CLI flag is probably unnecessary for rustc.
This flag can be used by non-Arm microcontroller targets,
like AVR and MSP430, but it is not enabled for them by default.
Rust programmers who know the size of a target's enums
can use explicit reprs, which also lets them match C23 code.

This change is most relevant to 16-bit targets: AVR and MSP430.
Most of rustc's targets use 32-bit ints, but ILP64 does exist.
Regardless, rustc should now correctly handle enums for
both very small and very large targets.

Thanks to William for confirming MSP430 behavior,
and to Waffle for better style and no-core size_of asserts.

Co-authored-by: William D. Jones <thor0505@comcast.net>
Co-authored-by: Waffle Maybe <waffle.lapkin@gmail.com>
2023-02-16 15:06:17 -08:00
..
assembly Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
auxiliary Move /src/test to /tests 2023-01-11 09:32:08 +00:00
codegen replace manual ptr arithmetic with ptr_sub 2023-01-15 17:38:05 +01:00
codegen-units Move /src/test to /tests 2023-01-11 09:32:08 +00:00
debuginfo Move /src/test to /tests 2023-01-11 09:32:08 +00:00
incremental Move /src/test to /tests 2023-01-11 09:32:08 +00:00
mir-opt Auto merge of #106850 - cjgillot:issue-106141, r=oli-obk 2023-01-16 12:30:49 +00:00
pretty Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
run-make Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
run-make-fulldeps Auto merge of #106092 - asquared31415:start_lang_item_checks, r=davidtwco 2023-01-13 07:45:34 +00:00
run-pass-valgrind Move /src/test to /tests 2023-01-11 09:32:08 +00:00
rustdoc Rollup merge of #106828 - notriddle:notriddle/notable-trait-docblock, r=GuillaumeGomez 2023-01-14 18:45:27 +01:00
rustdoc-gui Rollup merge of #106888 - GuillaumeGomez:tidy-gui-test, r=notriddle 2023-01-15 21:17:34 +01:00
rustdoc-js Move /src/test to /tests 2023-01-11 09:32:08 +00:00
rustdoc-js-std Move /src/test to /tests 2023-01-11 09:32:08 +00:00
rustdoc-json Move /src/test to /tests 2023-01-11 09:32:08 +00:00
rustdoc-ui Rollup merge of #106566 - clubby789:contiguous-weird-unicode, r=cjgillot 2023-01-14 13:04:24 +01:00
ui Default repr(C) enums to c_int size 2023-02-16 15:06:17 -08:00
ui-fulldeps Auto merge of #106004 - fee1-dead-contrib:const-closures, r=oli-obk 2023-01-13 05:04:48 +00:00
COMPILER_TESTS.md Move /src/test to /tests 2023-01-11 09:32:08 +00:00