rust/compiler/rustc_codegen_llvm/src
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
..
back Move ___asan_globals_registered export 2025-08-28 19:36:51 +00:00
builder Rename llvm::Bool aliases to standard const case 2025-08-24 23:09:54 +10:00
coverageinfo coverage: Remove all unstable support for MC/DC instrumentation 2025-08-06 22:38:52 +10:00
debuginfo compiler: Include span of too huge enum with -Cdebuginfo=2 2025-08-28 20:37:09 +02:00
llvm Auto merge of #145877 - nikic:capture-address, r=tmiasko 2025-08-28 00:01:22 +00:00
abi.rs Use captures(address) instead of captures(none) for indirect args 2025-08-26 16:16:23 +02:00
allocator.rs Rename llvm::Bool aliases to standard const case 2025-08-24 23:09:54 +10:00
asm.rs Replace the llvm::Bool typedef with a proper newtype 2025-08-24 23:09:54 +10:00
attributes.rs Auto merge of #144086 - clubby789:alloc-zeroed, r=nikic 2025-08-20 17:16:34 +00:00
base.rs Port the #[linkage] attribute to the new attribute system 2025-08-13 21:01:37 +02:00
builder.rs Rename llvm::Bool aliases to standard const case 2025-08-24 23:09:54 +10:00
callee.rs remove rustc_attr_data_structures 2025-07-31 14:19:27 +02:00
common.rs Rename llvm::Bool aliases to standard const case 2025-08-24 23:09:54 +10:00
consts.rs Port the #[linkage] attribute to the new attribute system 2025-08-13 21:01:37 +02:00
context.rs Rename llvm::Bool aliases to standard const case 2025-08-24 23:09:54 +10:00
declare.rs make more builder functions generic 2025-07-18 16:23:54 -07:00
errors.rs Use the object crate rather than LLVM for extracting bitcode sections 2025-07-25 11:21:28 +00:00
intrinsic.rs remove an as cast in prefetch codegen 2025-08-21 11:28:10 +02:00
lib.rs Directly raise fatal errors inside the codegen backends 2025-08-24 11:20:41 +00:00
llvm_util.rs Rollup merge of #145076 - ZhongyaoChen:feature/add-tier3-riscv64a23-target, r=davidtwco 2025-08-26 16:34:10 +02:00
mono_item.rs Replace the llvm::Bool typedef with a proper newtype 2025-08-24 23:09:54 +10:00
type_.rs Rename llvm::Bool aliases to standard const case 2025-08-24 23:09:54 +10:00
type_of.rs rename BackendRepr::Vector → SimdVector 2025-02-28 17:17:45 +01:00
va_arg.rs Auto merge of #143182 - xdoardo:more-addrspace, r=workingjubilee 2025-07-07 17:28:14 +00:00
value.rs Add warn(unreachable_pub) to rustc_codegen_llvm. 2024-08-16 08:46:57 +10:00