mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
8af70c7a18
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. |
||
---|---|---|
.. | ||
auxiliary | ||
const-bool-bitcast.rs | ||
freeze-on-polymorphic-projection.rs | ||
freeze-on-polymorphic-projection.stderr | ||
init-large-type.rs | ||
issue-16602-1.rs | ||
issue-16602-2.rs | ||
issue-16602-3.rs | ||
issue-28950.rs | ||
issue-55976.rs | ||
issue-63787.rs | ||
issue-64401.rs | ||
issue-79865-llvm-miscompile.rs | ||
issue-82859-slice-miscompile.rs | ||
issue-88043-bb-does-not-have-terminator.rs | ||
issue-97708.rs | ||
issue-99551.rs | ||
issue-101585-128bit-repeat.rs | ||
llvm-pr32379.rs | ||
mismatched-data-layout.json | ||
mismatched-data-layouts.rs | ||
mismatched-data-layouts.stderr | ||
mono-impossible-2.rs | ||
mono-impossible.rs | ||
subtyping-enforces-type-equality.rs | ||
subtyping-impacts-selection-1.rs | ||
subtyping-impacts-selection-2.rs | ||
target-cpus.rs | ||
target-cpus.stdout |