rust/compiler
David Rheinsberg b0dadff6de error/E0691: include alignment in error message
Include the computed alignment of the violating field when rejecting
transparent types with non-trivially aligned ZSTs.

ZST member fields in transparent types must have an alignment of 1 (to
ensure it does not raise the layout requirements of the transparent
field). The current error message looks like this:

 LL | struct Foobar(u32, [u32; 0]);
    |                    ^^^^^^^^ has alignment larger than 1

This patch changes the report to include the alignment of the violating
field:

 LL | struct Foobar(u32, [u32; 0]);
    |                    ^^^^^^^^ has alignment of 4, which is larger than 1

In case of unknown alignments, it will yield:

 LL | struct Foobar<T>(u32, [T; 0]);
    |                       ^^^^^^ may have alignment larger than 1

This allows developers to get a better grasp why a specific field is
rejected. Knowing the alignment of the violating field makes it easier
to judge where that alignment-requirement originates, and thus hopefully
provide better hints on how to mitigate the problem.

This idea was proposed in 2022 in #98071 as part of a bigger change.
This commit simply extracts this error-message change, to decouple it
from the other diagnostic improvements.
2023-07-21 11:04:16 +02:00
..
rustc
rustc_abi i686-windows: make requested alignment > 4 special case apply transitively 2023-07-14 17:48:13 -04:00
rustc_apfloat
rustc_arena
rustc_ast Flip cfg's for bootstrap bump 2023-07-12 21:38:55 -04:00
rustc_ast_lowering Properly document lifetime_mapping in OpaqueTy 2023-07-17 14:56:33 +00:00
rustc_ast_passes Lint against misplaced where-clauses on assoc tys in traits 2023-07-11 01:19:11 +02:00
rustc_ast_pretty Syntatically accept become expressions 2023-06-19 12:54:34 +00:00
rustc_attr Add infrastructure #[rustc_confusables] attribute to allow targeted 2023-07-16 19:22:03 +08:00
rustc_baked_icu_data
rustc_borrowck Rename arg_iter to iter_instantiated 2023-07-17 21:04:12 +00:00
rustc_builtin_macros Add a comparison between match *self and intrinsics::unreachable() 2023-07-16 15:33:29 -07:00
rustc_codegen_cranelift support for mips64r6 as a target_arch value 2023-07-18 18:58:18 +08:00
rustc_codegen_gcc support for mips32r6 as a target_arch value 2023-07-18 18:58:18 +08:00
rustc_codegen_llvm Rollup merge of #113716 - DianQK:add-no_builtins-to-function, r=pnkfelix 2023-07-19 22:37:06 +05:30
rustc_codegen_ssa Rollup merge of #113529 - oli-obk:simd_shuffle_evaluated, r=wesleywiser 2023-07-20 17:19:32 +02:00
rustc_const_eval Refactor checking function target features during const-eval 2023-07-16 16:07:55 +02:00
rustc_data_structures Introduce ExtentUnord trait for collections that can safely consume UnordItems. 2023-07-14 10:10:15 +02:00
rustc_driver Update rustix 2023-07-03 07:20:51 +00:00
rustc_driver_impl On nightly, dump ICE backtraces to disk 2023-07-19 14:10:07 +00:00
rustc_error_codes error/E0691: include alignment in error message 2023-07-21 11:04:16 +02:00
rustc_error_messages On nightly, dump ICE backtraces to disk 2023-07-19 14:10:07 +00:00
rustc_errors Don't translate compiler-internal bug messages 2023-07-20 09:51:47 +00:00
rustc_expand Don't translate compiler-internal bug messages 2023-07-20 09:51:47 +00:00
rustc_feature Add infrastructure #[rustc_confusables] attribute to allow targeted 2023-07-16 19:22:03 +08:00
rustc_fluent_macro
rustc_fs_util
rustc_graphviz
rustc_hir Properly document lifetime_mapping in OpaqueTy 2023-07-17 14:56:33 +00:00
rustc_hir_analysis error/E0691: include alignment in error message 2023-07-21 11:04:16 +02:00
rustc_hir_pretty hir: Add Become expression kind 2023-06-26 08:56:32 +00:00
rustc_hir_typeck Make it clearer that edition functions are >=, not == 2023-07-19 16:38:35 +00:00
rustc_incremental Re-format let-else per rustfmt update 2023-07-12 21:49:27 -04:00
rustc_index Re-format let-else per rustfmt update 2023-07-12 21:49:27 -04:00
rustc_infer Document PredicateSet::insert 2023-07-19 09:44:40 +00:00
rustc_interface On nightly, dump ICE backtraces to disk 2023-07-19 14:10:07 +00:00
rustc_lexer Revert the lexing of c_str_literals 2023-07-05 13:11:17 +02:00
rustc_lint Rollup merge of #113832 - WaffleLapkin:track_lint_caller, r=compiler-errors 2023-07-18 19:06:04 +02:00
rustc_lint_defs Fix removal span calculation of unused_qualifications suggestion 2023-07-18 09:52:08 +08:00
rustc_llvm Auto merge of #113714 - Kobzol:ci-cmake, r=nikic 2023-07-17 15:46:43 +00:00
rustc_log Downgrade tracing and syn 2023-07-02 21:02:31 +02:00
rustc_macros Re-format let-else per rustfmt update 2023-07-12 21:49:27 -04:00
rustc_metadata Auto merge of #113695 - bjorn3:fix_rlib_cdylib_metadata_handling, r=pnkfelix,petrochenkov 2023-07-20 09:00:10 +00:00
rustc_middle Auto merge of #113546 - cjgillot:unused-query, r=compiler-errors 2023-07-20 18:45:09 +00:00
rustc_mir_build Make it clearer that edition functions are >=, not == 2023-07-19 16:38:35 +00:00
rustc_mir_dataflow Turn copy into moves during DSE. 2023-07-19 09:59:12 +00:00
rustc_mir_transform Inline should_const_prop. 2023-07-20 21:30:51 +00:00
rustc_monomorphize Change the primary CGU merging algorithm. 2023-07-19 07:23:11 +10:00
rustc_parse Don't translate compiler-internal bug messages 2023-07-20 09:51:47 +00:00
rustc_parse_format Fix unit tests 2023-07-19 16:37:09 +00:00
rustc_passes Add infrastructure #[rustc_confusables] attribute to allow targeted 2023-07-16 19:22:03 +08:00
rustc_plugin_impl
rustc_privacy refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
rustc_query_impl Avoid calling queries during query stack printing 2023-06-27 16:12:07 +02:00
rustc_query_system Auto merge of #113622 - RickleAndMortimer:issue-113184-fix, r=oli-obk 2023-07-20 03:18:41 +00:00
rustc_resolve Make it clearer that edition functions are >=, not == 2023-07-19 16:38:35 +00:00
rustc_serialize Upgrade to indexmap 2.0.0 2023-07-03 13:51:54 -07:00
rustc_session Don't translate compiler-internal bug messages 2023-07-20 09:51:47 +00:00
rustc_smir Remove FIXMEs a lot of things need fixes 2023-07-19 11:05:21 -03:00
rustc_span Make it clearer that edition functions are >=, not == 2023-07-19 16:38:35 +00:00
rustc_symbol_mangling refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
rustc_target support for mips32r6 as a target_arch value 2023-07-18 18:58:18 +08:00
rustc_trait_selection Auto merge of #113856 - WaffleLapkin:vtablin', r=oli-obk 2023-07-20 20:34:06 +00:00
rustc_traits refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
rustc_transmute Auto merge of #113677 - bryangarza:unevaluated-const-ice_issue-110892, r=davidtwco 2023-07-18 09:07:32 +00:00
rustc_ty_utils Rollup merge of #113824 - lcnr:exhaustive-match, r=wesleywiser 2023-07-18 19:06:03 +02:00
rustc_type_ir refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00