rust/compiler
bors bcfea1f8d2 Auto merge of #133194 - khuey:master, r=jieyouxu
Drop debug info instead of panicking if we exceed LLVM's capability to represent it

Recapping a bit of history here:

In #128861 I made debug info correctly represent parameters to inline functions by removing a fake lexical block that had been inserted to suppress LLVM assertions and by deduplicating those parameters.

LLVM, however, expects to see a single parameter _with distinct locations_, particularly distinct inlinedAt values on the DILocations. This generally worked because no matter how deep the chain of inlines it takes two different call sites in the original function to result in the same function being present multiple times, and a function call requires a non-zero number of characters, but macros threw a wrench in that in #131944. At the time I thought the issue there was limited to proc-macros, where an arbitrary amount of code can be generated at a single point in the source text.

In #132613 I added discriminators to DILocations that would otherwise be the same to repair #131944[^1]. This works, but LLVM's capacity for discriminators is not infinite (LLVM actually only allocates 12 bits for this internally). At the time I thought it would be very rare for anyone to hit the limit, but #132900 proved me wrong. In the relatively-minimized test case it also became clear to me that the issue affects regular macros too, because the call to the inlined function will (without collapse_debuginfo on the macro) be attributed to the (repeated, if the macro is used more than once) textual callsite in the macro definition.

This PR fixes the panic by dropping debug info when we exceed LLVM's maximum discriminator value. There's also a preceding commit for a related but distinct issue: macros that use collapse_debuginfo should in fact have their inlinedAts collapsed to the macro callsite and thus not need discriminators at all (and not panic/warn accordingly when the discriminator limit is exhausted).

Fixes #132900

r? `@jieyouxu`

[^1]: Editor's note: `fix` is a magic keyword in PR description that apparently will close the linked issue (it's closed already in this case, but still).
2024-11-20 02:10:50 +00:00
..
rustc Auto merge of #132282 - Noratrieb:it-is-the-end-of-serial, r=cjgillot 2024-11-12 15:14:56 +00:00
rustc_abi pointee_info_at: fix logic for recursing into enums 2024-11-08 07:35:29 +01:00
rustc_arena move strict provenance lints to new feature gate, remove old feature gates 2024-10-21 15:22:17 +01:00
rustc_ast Add MutVisitor::visit_fn_ret_ty 2024-11-18 15:49:09 -03:00
rustc_ast_ir Add sugar for &pin (const|mut) types 2024-10-07 11:15:04 -07:00
rustc_ast_lowering Introduce min_generic_const_args and directly represent paths 2024-11-19 05:07:43 +00:00
rustc_ast_passes Rollup merge of #133023 - samestep:hir-stats-total-count, r=nnethercote 2024-11-19 09:19:20 +01:00
rustc_ast_pretty fix clippy::clone_on_ref_ptr for compiler 2024-10-28 18:05:08 +03:00
rustc_attr ensure that all publicly reachable const fn have const stability info 2024-11-10 10:16:26 +01:00
rustc_baked_icu_data Delete the cfg(not(parallel)) serial compiler 2024-11-12 13:38:58 +00:00
rustc_borrowck Pass flow_inits by value. 2024-11-19 11:46:33 +11:00
rustc_builtin_macros Rollup merge of #132787 - maxcabrajac:fnctxt, r=petrochenkov 2024-11-16 21:05:46 +01:00
rustc_codegen_cranelift Explicitly disable llvm tools for cranelift 2024-11-19 20:29:54 +08:00
rustc_codegen_gcc When the required discriminator value exceeds LLVM's limits, drop the debug info for the function instead of panicking. 2024-11-19 05:19:09 -08:00
rustc_codegen_llvm When the required discriminator value exceeds LLVM's limits, drop the debug info for the function instead of panicking. 2024-11-19 05:19:09 -08:00
rustc_codegen_ssa When the required discriminator value exceeds LLVM's limits, drop the debug info for the function instead of panicking. 2024-11-19 05:19:09 -08:00
rustc_const_eval Auto merge of #133164 - RalfJung:promoted-oom, r=jieyouxu 2024-11-19 13:24:09 +00:00
rustc_data_structures Auto merge of #124780 - Mark-Simulacrum:lockless-cache, r=lcnr 2024-11-19 02:07:48 +00:00
rustc_driver
rustc_driver_impl Auto merge of #132282 - Noratrieb:it-is-the-end-of-serial, r=cjgillot 2024-11-12 15:14:56 +00:00
rustc_error_codes remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic functions instead 2024-11-08 09:16:00 +01:00
rustc_error_messages Delete the cfg(not(parallel)) serial compiler 2024-11-12 13:38:58 +00:00
rustc_errors Auto merge of #132954 - matthiaskrgr:rollup-x3rww9h, r=matthiaskrgr 2024-11-12 18:04:27 +00:00
rustc_expand Rollup merge of #132787 - maxcabrajac:fnctxt, r=petrochenkov 2024-11-16 21:05:46 +01:00
rustc_feature Introduce min_generic_const_args and directly represent paths 2024-11-19 05:07:43 +00:00
rustc_fluent_macro use tracked_path in rustc_fluent_macro 2024-10-19 22:32:38 +08:00
rustc_fs_util
rustc_graphviz
rustc_hir Rollup merge of #132144 - adetaylor:receiver-trait-itself, r=wesleywiser 2024-11-11 21:58:29 +01:00
rustc_hir_analysis Fix broken intra-doc link 2024-11-19 06:06:47 +00:00
rustc_hir_pretty compiler: Switch to rustc_abi in hir_pretty, lint_defs, and mir_build 2024-10-30 22:38:49 -07:00
rustc_hir_typeck Introduce min_generic_const_args and directly represent paths 2024-11-19 05:07:43 +00:00
rustc_incremental replace manual time convertions with std ones 2024-11-03 15:51:39 +03:00
rustc_index Rollup merge of #130625 - heiseish:issue-124028-fix, r=jieyouxu 2024-10-10 12:49:18 +02:00
rustc_index_macros Remove 'apostrophes' from rustc_parse_format 2024-10-14 23:22:51 +02:00
rustc_infer review 2024-11-18 10:50:14 +01:00
rustc_interface Rollup merge of #133023 - samestep:hir-stats-total-count, r=nnethercote 2024-11-19 09:19:20 +01:00
rustc_lexer Remove TokenKind::InvalidPrefix. 2024-11-19 18:06:22 +11:00
rustc_lint use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_lint_defs Report unexpected_cfgs lint in external macros 2024-11-18 18:52:27 +01:00
rustc_llvm PassWrapper: disable UseOdrIndicator for Asan Win32 2024-11-14 04:20:18 +08:00
rustc_log
rustc_macros give a better error for tuple structs in derive(Diagnostic) 2024-10-27 21:23:28 -04:00
rustc_metadata use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_middle Auto merge of #133205 - matthiaskrgr:rollup-xhhhp5u, r=matthiaskrgr 2024-11-19 16:31:58 +00:00
rustc_mir_build review 2024-11-18 10:50:14 +01:00
rustc_mir_dataflow use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_mir_transform use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_monomorphize use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_next_trait_solver use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_parse Auto merge of #133219 - matthiaskrgr:rollup-hnuq0zf, r=matthiaskrgr 2024-11-19 23:04:44 +00:00
rustc_parse_format Remove 'apostrophes' from rustc_parse_format 2024-10-14 23:22:51 +02:00
rustc_passes Rollup merge of #133023 - samestep:hir-stats-total-count, r=nnethercote 2024-11-19 09:19:20 +01:00
rustc_pattern_analysis use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_privacy Simplify some places that deal with generic parameter defaults 2024-11-11 21:29:18 +01:00
rustc_query_impl Delete the cfg(not(parallel)) serial compiler 2024-11-12 13:38:58 +00:00
rustc_query_system Auto merge of #124780 - Mark-Simulacrum:lockless-cache, r=lcnr 2024-11-19 02:07:48 +00:00
rustc_resolve Auto merge of #132761 - nnethercote:resolve-tweaks, r=petrochenkov 2024-11-19 19:54:35 +00:00
rustc_sanitizers use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_serialize Fix explicit_iter_loop in rustc_serialize 2024-10-16 15:44:16 +02:00
rustc_session Rollup merge of #133023 - samestep:hir-stats-total-count, r=nnethercote 2024-11-19 09:19:20 +01:00
rustc_smir use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_span Introduce min_generic_const_args and directly represent paths 2024-11-19 05:07:43 +00:00
rustc_symbol_mangling use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_target ABI checks: add support for some tier3 arches, warn on others. 2024-11-14 08:57:39 +01:00
rustc_trait_selection use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_traits use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_transmute use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_ty_utils use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_type_ir use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
rustc_type_ir_macros do not relate Abi and Safety 2024-10-22 23:13:04 +02:00
stable_mir Rollup merge of #132161 - celinval:smir-fix-indent, r=compiler-errors 2024-11-08 18:51:28 +11:00