rust/tests/ui/codegen
bors 8af70c7a18 Auto merge of #120062 - davidtwco:llvm-data-layout-check, r=wesleywiser
llvm: change data layout bug to an error and make it trigger more

Fixes #33446.

Don't skip the inconsistent data layout check for custom LLVMs or non-built-in targets.

With #118708, all targets will have a simple test that would trigger this error if LLVM's data layouts do change - so data layouts would be corrected during the LLVM upgrade. Therefore, with builtin targets, this error won't happen with our LLVM because each target will have been confirmed to work. With non-builtin targets, this error is probably useful to have because you can change the data layout in your target and if it is wrong then that could lead to bugs.

When using a custom LLVM, the same justification makes sense for non-builtin targets as with our LLVM, the user can update their target to match their LLVM and that's probably a good thing to do. However, with a custom LLVM, the user cannot change the builtin target data layouts if they don't match - though given that the compiler's data layout is used for layout computation and a bunch of other things - you could get some bugs because of the mismatch and probably want to know about that. I'm not sure if this is something that people do and is okay, but I doubt it?

`CFG_LLVM_ROOT` was also always set during local development with `download-ci-llvm` so this bug would never trigger locally.

In #33446, two points are raised:

- In the issue itself, changing this from a `bug!` to a proper error is what is suggested, by using `isCompatibleDataLayout` from LLVM, but that function still just does the same thing that we do and check for equality, so I've avoided the additional code necessary to do that FFI call.
- `@Mark-Simulacrum` suggests a different check is necessary to maintain backwards compatibility with old LLVM versions. I don't know how often this comes up, but we can do that with some simple string manipulation + LLVM version checks as happens already for LLVM 17 just above this diff.
2024-01-27 12:19:41 +00:00
..
auxiliary
const-bool-bitcast.rs Use immediate_backend_type when reading from a const alloc 2023-12-09 17:13:11 -05:00
freeze-on-polymorphic-projection.rs Check freeze with right param-env 2023-04-16 23:09:57 +00:00
freeze-on-polymorphic-projection.stderr Check freeze with right param-env 2023-04-16 23:09:57 +00:00
init-large-type.rs
issue-16602-1.rs
issue-16602-2.rs
issue-16602-3.rs Adjust compiler tests for unused_tuple_struct_fields -> dead_code 2024-01-02 15:34:37 -05:00
issue-28950.rs
issue-55976.rs Update the minimum external LLVM to 15 2023-07-27 14:07:08 -07:00
issue-63787.rs
issue-64401.rs
issue-79865-llvm-miscompile.rs Fix misuses of a vs an 2023-10-04 08:01:11 +08:00
issue-82859-slice-miscompile.rs
issue-88043-bb-does-not-have-terminator.rs
issue-97708.rs
issue-99551.rs Revert "Auto merge of #118133 - Urgau:stabilize_trait_upcasting, r=WaffleLapkin" 2024-01-22 14:24:31 +00:00
issue-101585-128bit-repeat.rs
llvm-pr32379.rs
mismatched-data-layout.json llvm: simplify data layout check 2024-01-18 10:46:03 +00:00
mismatched-data-layouts.rs llvm: simplify data layout check 2024-01-18 10:46:03 +00:00
mismatched-data-layouts.stderr llvm: simplify data layout check 2024-01-18 10:46:03 +00:00
mono-impossible-2.rs Erase impl regions when checking for impossible to eagerly monomorphize items 2023-03-28 02:07:35 +00:00
mono-impossible.rs Don't codegen impossible to satisfy impls 2023-03-14 16:19:57 +00:00
subtyping-enforces-type-equality.rs Remove assert that checks type equality 2023-09-11 23:08:40 +03:00
subtyping-impacts-selection-1.rs add tests for unsound subtype handling 2023-06-19 09:01:29 +02:00
subtyping-impacts-selection-2.rs add tests for unsound subtype handling 2023-06-19 09:01:29 +02:00
target-cpus.rs Add ui test of LLVM print-from-C++ changes 2023-07-20 11:04:31 -07:00
target-cpus.stdout Add ui test of LLVM print-from-C++ changes 2023-07-20 11:04:31 -07:00