rust/compiler
Trevor Gross 65a846ad8a
Rollup merge of #145967 - Enselic:big-enum-debuginfo-span, r=wesleywiser
compiler: Include span of too huge enum with `-Cdebuginfo=2`

We have the ui test `tests/ui/limits/huge-enum.rs` to ensure we emit an error if we encounter too big enums. Before this fix, compiling the test with `-Cdebuginfo=2` would not include the span of the instantiation site, because the error is then emitted from a different code path that does not include the span.

Propagate the span to the error also in the debuginfo case, so the test passes regardless of debuginfo level. I'm sure we can propagate spans in more places, but let's start small.

## Test failure without the fix

Here is what the failure looks like if you run the test without the fix:

```
[ui] tests/ui/limits/huge-enum.rs#full-debuginfo ... F
.

failures:

---- [ui] tests/ui/limits/huge-enum.rs#full-debuginfo stdout ----
Saved the actual stderr to `/home/martin/src/rust/build/x86_64-unknown-linux-gnu/test/ui/limits/huge-enum.full-debuginfo/huge-enum.full-debuginfo.stderr`
diff of stderr:

1       error: values of the type `Option<TYPE>` are too big for the target architecture
-         --> $DIR/huge-enum.rs:17:9
-          |
-       LL |     let big: BIG = None;
-          |         ^^^
6
7       error: aborting due to 1 previous error
8

The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args limits/huge-enum.rs`
```

as can be seen, the `span` used to be missing with `debuginfo=2`.

## See also

This is one small step towards resolving rust-lang/rust#61117.

cc https://github.com/rust-lang/rust/pull/144499 which began running UI tests with `rust.debuginfo-level-tests=1`. This PR is part of preparing for increasing that to debuglevel 2.
2025-08-29 19:33:03 -05:00
..
rustc rename stable_mir to rustc_public, and rustc_smir to rustc_public_bridge 2025-07-14 09:25:54 +00:00
rustc_abi Rollup merge of #145387 - zachs18:remove-tmplayout, r=cjgillot 2025-08-29 12:54:10 +10:00
rustc_arena Introduce Arena::try_alloc_from_iter. 2025-04-19 01:13:18 +00:00
rustc_ast Rollup merge of #145984 - nnethercote:TokenStream-cleanups, r=chenyukang 2025-08-29 12:37:32 +02:00
rustc_ast_ir Tidy up Cargo.toml files. 2025-07-31 19:58:04 +10:00
rustc_ast_lowering Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10:00
rustc_ast_passes Add new doc(attribute = "...") attribute 2025-08-28 15:56:29 +02:00
rustc_ast_pretty Add itertools to [workspace.dependencies]. 2025-08-27 14:21:21 +10:00
rustc_attr_parsing Rollup merge of #145937 - jdonszelmann:doc-hidden-prelude, r=fmease 2025-08-28 21:41:03 +02:00
rustc_baked_icu_data Use default locale fallback data 2025-08-28 09:48:54 +00:00
rustc_borrowck Add polonius-engine to [workspace.dependencies]. 2025-08-28 20:12:16 +10:00
rustc_builtin_macros Rollup merge of #145905 - TaKO8Ki:fix-137580, r=nnethercote 2025-08-27 11:26:52 +02:00
rustc_codegen_cranelift Port the #[linkage] attribute to the new attribute system 2025-08-13 21:01:37 +02:00
rustc_codegen_gcc Fix sync conflict 2025-08-26 17:25:45 +02:00
rustc_codegen_llvm Rollup merge of #145967 - Enselic:big-enum-debuginfo-span, r=wesleywiser 2025-08-29 19:33:03 -05:00
rustc_codegen_ssa Rollup merge of #145947 - nnethercote:workspace-members-2, r=Kobzol 2025-08-29 12:54:12 +10:00
rustc_const_eval Add rustc_apfloat to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00
rustc_data_structures Add measureme to [workspace.dependencies]. 2025-08-28 20:12:14 +10:00
rustc_driver Remove recursion_limit increases. 2025-04-02 16:25:27 +11:00
rustc_driver_impl Add serde_json to [workspace.dependencies]. 2025-08-28 20:10:54 +10:00
rustc_error_codes Changes to the uitests 2025-08-27 20:25:18 +02:00
rustc_error_messages Use default locale fallback data 2025-08-28 09:48:54 +00:00
rustc_errors Rollup merge of #145947 - nnethercote:workspace-members-2, r=Kobzol 2025-08-29 12:54:12 +10:00
rustc_expand Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10:00
rustc_feature Add serde_json to [workspace.dependencies]. 2025-08-28 20:10:54 +10:00
rustc_fluent_macro Add proc-macro2 and quote to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00
rustc_fs_util Add tempfile to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00
rustc_graphviz Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_hashes Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_hir Rollup merge of #145947 - nnethercote:workspace-members-2, r=Kobzol 2025-08-29 12:54:12 +10:00
rustc_hir_analysis Add itertools to [workspace.dependencies]. 2025-08-27 14:21:21 +10:00
rustc_hir_id rustc_hir_id: Add a comment explaining why the crate exists 2025-08-20 15:04:00 -07:00
rustc_hir_pretty Propagate TraitImplHeader to hir 2025-08-11 17:05:42 -05:00
rustc_hir_typeck Rollup merge of #145740 - nnethercote:workspace-members, r=Kobzol 2025-08-27 11:26:50 +02:00
rustc_incremental Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10:00
rustc_index Update documentation. 2025-08-24 22:15:19 +00:00
rustc_index_macros Add proc-macro2 and quote to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00
rustc_infer Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10:00
rustc_interface Move NativeLibKind from rustc_session to rustc_hir 2025-08-27 20:24:59 +02:00
rustc_lexer Remove unnecessary [dependencies.unicode-properties] entries. 2025-08-28 08:08:40 +10:00
rustc_lint Rollup merge of #145941 - Urgau:int_to_ptr_transmutes-unsized, r=lcnr 2025-08-28 23:10:37 +10:00
rustc_lint_defs Migrate BuiltinLintDiag::HiddenUnicodeCodepoints to use LintDiagnostic directly 2025-08-22 03:01:35 -07:00
rustc_llvm Rollup merge of #145947 - nnethercote:workspace-members-2, r=Kobzol 2025-08-29 12:54:12 +10:00
rustc_log Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10:00
rustc_macros Add proc-macro2 and quote to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00
rustc_metadata Rollup merge of #145947 - nnethercote:workspace-members-2, r=Kobzol 2025-08-29 12:54:12 +10:00
rustc_middle Rollup merge of #145756 - okaneco:stabilize_char_boundary, r=scottmcm 2025-08-29 19:33:03 -05:00
rustc_mir_build Add rustc_apfloat to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00
rustc_mir_dataflow Add polonius-engine to [workspace.dependencies]. 2025-08-28 20:12:16 +10:00
rustc_mir_transform Add either to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00
rustc_monomorphize Add serde_json to [workspace.dependencies]. 2025-08-28 20:10:54 +10:00
rustc_next_trait_solver Auto merge of #145978 - Zalathar:rollup-0dzk72g, r=Zalathar 2025-08-29 03:40:14 +00:00
rustc_parse Improve error messages around invalid literals in attribute arguments 2025-08-28 20:05:04 +02:00
rustc_parse_format Add rustc-literal-escaper to [workspace.dependencies]. 2025-08-27 13:59:32 +10:00
rustc_passes Rollup merge of #142472 - GuillaumeGomez:doc-attribute-attribute, r=fmease 2025-08-28 21:41:00 +02:00
rustc_pattern_analysis Add rustc-hash to [workspace.dependencies]. 2025-08-28 20:11:43 +10:00
rustc_privacy Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10:00
rustc_proc_macro Add rustc-literal-escaper to [workspace.dependencies]. 2025-08-27 13:59:32 +10:00
rustc_public Add scoped-tls to [workspace.dependencies]. 2025-08-28 20:12:16 +10:00
rustc_public_bridge Remove useless lifetime parameter. 2025-07-23 23:54:37 +00:00
rustc_query_impl Add measureme to [workspace.dependencies]. 2025-08-28 20:12:14 +10:00
rustc_query_system Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10:00
rustc_resolve Rollup merge of #145947 - nnethercote:workspace-members-2, r=Kobzol 2025-08-29 12:54:12 +10:00
rustc_sanitizers Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10:00
rustc_serialize Add indexmap to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00
rustc_session Rollup merge of #145947 - nnethercote:workspace-members-2, r=Kobzol 2025-08-29 12:54:12 +10:00
rustc_span Rollup merge of #145756 - okaneco:stabilize_char_boundary, r=scottmcm 2025-08-29 19:33:03 -05:00
rustc_symbol_mangling Add rustc-demangle to [workspace.dependencies]. 2025-08-28 20:12:16 +10:00
rustc_target Add serde_json to [workspace.dependencies]. 2025-08-28 20:10:54 +10:00
rustc_thread_pool Add scoped-tls to [workspace.dependencies]. 2025-08-28 20:12:16 +10:00
rustc_trait_selection Auto merge of #145807 - zachs18:only-consider-auto-traits-empty, r=compiler-errors 2025-08-28 16:49:32 +00:00
rustc_traits Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10:00
rustc_transmute Add itertools to [workspace.dependencies]. 2025-08-27 14:21:21 +10:00
rustc_ty_utils Add itertools to [workspace.dependencies]. 2025-08-27 14:21:21 +10:00
rustc_type_ir Auto merge of #145978 - Zalathar:rollup-0dzk72g, r=Zalathar 2025-08-29 03:40:14 +00:00
rustc_type_ir_macros Add proc-macro2 and quote to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00