rust/compiler
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
..
rustc Clean up rustc_*/Cargo.toml. 2023-10-30 08:46:02 +11:00
rustc_abi Fix rustc_abi build on stable 2024-01-16 21:15:31 +01:00
rustc_arena Fix Stable trait and its impls to work with the new with_tables 2024-01-19 09:42:51 +00:00
rustc_ast Rollup merge of #120329 - nnethercote:3349-precursors, r=fee1-dead 2024-01-26 14:43:31 +01:00
rustc_ast_lowering Remove unused features 2024-01-25 14:01:33 +00:00
rustc_ast_passes Remove unused features 2024-01-25 14:01:33 +00:00
rustc_ast_pretty Remove unused features 2024-01-25 14:01:33 +00:00
rustc_attr Pack the u128 in LitKind::Int 2024-01-19 20:10:39 -08:00
rustc_baked_icu_data Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
rustc_borrowck Remove unused features 2024-01-25 14:01:33 +00:00
rustc_builtin_macros Auto merge of #119968 - clubby789:unused-feature, r=compiler-errors 2024-01-26 03:18:34 +00:00
rustc_codegen_cranelift Merge commit '3e50cf65025f96854d6597e80449b0d64ad89589' into sync_cg_clif-2024-01-26 2024-01-26 18:33:45 +00:00
rustc_codegen_gcc Auto merge of #116167 - RalfJung:structural-eq, r=lcnr 2024-01-26 00:17:00 +00:00
rustc_codegen_llvm Auto merge of #120062 - davidtwco:llvm-data-layout-check, r=wesleywiser 2024-01-27 12:19:41 +00:00
rustc_codegen_ssa Auto merge of #119968 - clubby789:unused-feature, r=compiler-errors 2024-01-26 03:18:34 +00:00
rustc_const_eval Normalize field types before checking validity 2024-01-26 18:36:15 +00:00
rustc_data_structures Remove unused features 2024-01-25 14:01:33 +00:00
rustc_driver Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
rustc_driver_impl Remove unused features 2024-01-25 14:01:33 +00:00
rustc_error_codes Stabilize simple offset_of 2024-01-19 20:38:51 +00:00
rustc_error_messages Remove unused features 2024-01-25 14:01:33 +00:00
rustc_errors Fix typo 2024-01-26 21:01:45 +01:00
rustc_expand Rollup merge of #117420 - Jules-Bertholet:internal-unstable-stmt-expr-attributes, r=petrochenkov 2024-01-26 14:43:29 +01:00
rustc_feature Add feature gate 2024-01-24 23:52:03 +01:00
rustc_fluent_macro annotate-snippets: update to 0.10 2024-01-07 16:53:32 +03:00
rustc_fs_util Clean up rustc_*/Cargo.toml. 2023-10-30 08:46:02 +11:00
rustc_graphviz remove unused pub fn 2023-11-23 14:11:02 +03:00
rustc_hir Auto merge of #119968 - clubby789:unused-feature, r=compiler-errors 2024-01-26 03:18:34 +00:00
rustc_hir_analysis Remove unused features 2024-01-25 14:01:33 +00:00
rustc_hir_pretty Add PatKind::Err 2024-01-17 03:14:16 +01:00
rustc_hir_typeck Rollup merge of #119957 - Young-Flash:fix, r=fmease 2024-01-27 10:48:47 +01:00
rustc_incremental Remove unused features 2024-01-25 14:01:33 +00:00
rustc_index Rollup merge of #119800 - dev-ardi:tmp, r=wesleywiser 2024-01-26 23:15:50 +01:00
rustc_index_macros Restrict access to the private field of newtype indexes 2024-01-19 15:38:47 +00:00
rustc_infer Remove unused features 2024-01-25 14:01:33 +00:00
rustc_interface Remove unused features 2024-01-25 14:01:33 +00:00
rustc_lexer Use unescape_unicode for raw C string literals. 2024-01-25 12:28:11 +11:00
rustc_lint Rollup merge of #120360 - compiler-errors:afit-sized-lol, r=lcnr 2024-01-26 14:43:32 +01:00
rustc_lint_defs Rollup merge of #119948 - asquared31415:unsafe_op_in_unsafe_fn_fix, r=TaKO8Ki 2024-01-22 16:13:28 +01:00
rustc_llvm Revert "Auto merge of #113923 - DianQK:restore-no-builtins-lto, r=pnkfelix" 2024-01-12 18:23:04 +08:00
rustc_log rustc_log: provide a way to init logging based on the values, not names, of the env vars 2023-11-11 15:24:33 +01:00
rustc_macros Remove unused features 2024-01-25 14:01:33 +00:00
rustc_metadata Remove unused features 2024-01-25 14:01:33 +00:00
rustc_middle Rollup merge of #120386 - klensy:destruction_scopes, r=compiler-errors 2024-01-27 10:48:48 +01:00
rustc_mir_build Classify closure arguments in refutable pattern in argument error 2024-01-26 23:54:08 +08:00
rustc_mir_dataflow Remove unused features 2024-01-25 14:01:33 +00:00
rustc_mir_transform add test for GVN issue; cleanup in dataflow_const_prop 2024-01-26 10:40:29 +01:00
rustc_monomorphize Remove unused features 2024-01-25 14:01:33 +00:00
rustc_next_trait_solver Remove movability from TyKind::Coroutine 2023-12-28 16:35:01 +00:00
rustc_parse Rollup merge of #118182 - estebank:issue-118164, r=davidtwco 2024-01-27 10:48:46 +01:00
rustc_parse_format Rename the unescaping functions. 2024-01-25 12:28:11 +11:00
rustc_passes Rebase slice_group_by stabilization PR 2024-01-25 22:20:59 -08:00
rustc_pattern_analysis Rollup merge of #118803 - Nadrieril:min-exhaustive-patterns, r=compiler-errors 2024-01-26 06:36:36 +01:00
rustc_privacy Rollup merge of #120339 - petrochenkov:nameprivisit, r=michaelwoerister 2024-01-26 14:43:31 +01:00
rustc_query_impl Remove unused features 2024-01-25 14:01:33 +00:00
rustc_query_system Tweak error counting. 2024-01-22 10:14:01 +11:00
rustc_resolve Rollup merge of #120322 - compiler-errors:higher-ranked-async-closures, r=oli-obk 2024-01-26 06:36:39 +01:00
rustc_serialize Remove unused features 2024-01-25 14:01:33 +00:00
rustc_session Auto merge of #118636 - h1467792822:dev, r=michaelwoerister 2024-01-27 02:32:30 +00:00
rustc_smir Do not normalize closure signature when building FnOnce shim 2024-01-22 16:50:30 +00:00
rustc_span Rollup merge of #118803 - Nadrieril:min-exhaustive-patterns, r=compiler-errors 2024-01-26 06:36:36 +01:00
rustc_symbol_mangling Auto merge of #118636 - h1467792822:dev, r=michaelwoerister 2024-01-27 02:32:30 +00:00
rustc_target Remove unused features 2024-01-25 14:01:33 +00:00
rustc_trait_selection Auto merge of #119968 - clubby789:unused-feature, r=compiler-errors 2024-01-26 03:18:34 +00:00
rustc_traits Remove unused features 2024-01-25 14:01:33 +00:00
rustc_transmute Remove unused features 2024-01-25 14:01:33 +00:00
rustc_ty_utils Auto merge of #119968 - clubby789:unused-feature, r=compiler-errors 2024-01-26 03:18:34 +00:00
rustc_type_ir Restrict access to the private field of newtype indexes 2024-01-19 15:38:47 +00:00
stable_mir Remove unused features 2024-01-25 14:01:33 +00:00