175 Commits

Author SHA1 Message Date
Martin Nordholts 98242676d9 tests/debuginfo/basic-stepping.rs: Remove FIXME related to ZSTs
We don't consider it a bug that users can't break on initialization of
some non-zero sized types (see comment on `maximally-steppable` at the
top of the file), so it does not make sense to consider it a bug that
users can't break on initialization of some zero-sized types.
2026-04-16 06:05:12 +02:00
Jonathan Brouwer 978fb762ac Rollup merge of #153941 - Enselic:fully-steppable, r=saethlin
tests/debuginfo/basic-stepping.rs: Explain why all lines are not steppable

Some optimization passes [_improve_](https://github.com/rust-lang/compiler-team/issues/319) compile times. So we want to run some passes even with `-Copt-level=0`. That means that some debuggable lines can be optimized away. Document that as expected behavior.

Closes https://github.com/rust-lang/rust/issues/33013.

Replaces https://github.com/rust-lang/rust/pull/151426. See that PR for some discussion.
2026-04-13 20:20:00 +02:00
León Orell Valerian Liehr 357f670fde Rename #[rustc_layout] to #[rustc_dump_layout] 2026-04-10 12:13:48 +02:00
Walnut 3c52bb5527 directly point to tuple summary 2026-04-02 09:44:38 -05:00
Walnut eca09dedef fix tests 2026-03-31 05:01:25 -05:00
Martin Nordholts 686ddd3e2e tests/debuginfo/basic-stepping.rs: Explain why all lines are not steppable
Some optimization passes _improve_ compile times [1]. So we want to run
some passes even with `-Copt-level=0`. That means that some of the lines
in the test can be optimized away. To make regression testing more
robust, we also want to run the test with such passes disabled. The
solution is to use two revisions. One with default `-Copt-level=0`
passes, and one "even less optimized", with enough optimization passes
disabled to keep the maximum number of lines steppable.

[1]: https://github.com/rust-lang/compiler-team/issues/319
2026-03-16 18:39:40 +01:00
Martin Nordholts a27fdfbf01 tests/debuginfo/basic-stepping.rs: Remove ignore-aarch64
It works now.
2026-03-14 18:24:49 +01:00
Martin Nordholts 17c079625c tests/debuginfo/basic-stepping.rs: Add cdb test 2026-03-14 06:46:57 +01:00
Martin Nordholts 512d5fd676 tests/debuginfo/basic-stepping.rs: Add lldb test
Also move the FIXME to the source code to avoid duplication, and also
suppress harmless warnings that are annoying when you compile manually.
2026-03-12 20:30:21 +01:00
Jonathan Brouwer 77658bcda3 Rollup merge of #152593 - spirali:valtreekind-list, r=lcnr
Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`

This is related to trait system refactoring. It fixes the FIXME in `ValTreeKind`

```
   // FIXME(mgca): Use a `List` here instead of a boxed slice
    Branch(Box<[I::Const]>),
```

It introduces `Interner::Consts`, changes `Branch(Box<[I::Const]>)` to `Branch(I::Consts)`, and updates all relevant places.

r? lcnr
2026-03-06 18:49:47 +01:00
joboet 88cec3a1c0 update debuginfo visualizers and tests 2026-03-02 11:57:03 +01:00
Makai b6083435d8 implement debuginfo for unsafe binders 2026-02-23 23:32:56 +08:00
Ada Bohm 14b3a40c2d Test updated 2026-02-23 15:17:01 +01:00
Keith-Cancel 73a991fb9d Allow provisional mgca syntax of type const <IDENT> = <EXPR> to be reconized.
Revert, but without type const.

Update symbol for feature err, then update suggestion output, and lastly update tests that change because of those.

Update these new tests with the correct syntax, and few existing tests with the new outputs the merge with main added.

Fix for tidyfmt and some errors when manually resolving a merge conflicts.

Update these tests to use update error messages and type const syntax.

Update comments and error message to use new syntax instead of old type_const attribute.

Remove the type_const attribute

update some more tests to use the new syntax.

Update these test cases.

update feature gate test

Change gate logic for `mgca_type_const_syntax` to work also if `min_generic_const_args` is enabled.

Create a new feature gate that checks for the feature before expansion.

Make rustfmt handle the `type const` syntax correctly.

Add a convience method to check if a RhsKind is type const.

Rename `Const` discriminant to `Body` for `ConstItemRhsKind`

Give the `TraitItemKind` flag an enum instead of a simple bool to better describe what the flag is for.

Update formatting for these match statements.

Update clippy test to use type const syntax.

Update test to use type const syntax.

update rustfmt to match ast items.

Update clippy to match ast and hir items.

Few more test cases that used old attribute, instead of 'type const'

Update to match the output from the feature gate checks.

tidyfmt adjustments.

Update the is_type_const, so I can constrain record!(..) in encoder.rs

Update conditional compilation test.

Move the feature gate to after expansion to allow for cfg(...) to work.

Update some more tests to use the new syntax.

Update type const tests in associated-const-bindings to use new syntax.

Don't check based off the attribute, but the item here.

Update some tests outside of the const_generics folder that were using #[type_const]

update the tests in associated consts that use #[type_const] to use type const

Update these mgca tests with the type const syntax.

Add a flag to TraitItemKind for detecting type const for now. Maybe later change ItemConstRhs to have optional consts but that touches a lot more lines of code.

Don't need into for these now that it's a query.

Add is_type_const query to handle foreign def ids.

update this test to use type const syntax.

Fix logic here, we only want to lower if there is expression in this case.

Update built-in macros to use ConstItemRhsKind

Update more instance of the old ConstItemRhs.

Rename ConstItemKind to ConstItemRhsKind, I noticed there is a typed called ConstantItemKind, so add the Rhs to the name to avoid confusion.

Update lower to use ConstItemKind

Add an other helper method to check if the rhs kinda has an expr.

Update item parse to use ConstItemKind enum.

Felt the field name could a be little clear when editing a few other things.

Change the ConstItem struct see know if we have a type const or regular const.

Make sure this syntax is properly feature gated.
2026-02-09 07:59:24 -08:00
Jubilee Young 2b0cce040d Ignore all debuginfo tests for LLDB that we do not run in CI
We only run LLDB 1500 in CI. Any test with a min-lldb-version above that
is currently ignored. It's not clear any of these tests actually work
with that LLDB version, and they definitely don't work on LLDB ~2100.
So, ignore them until we fix debuginfo testing.
2026-02-02 18:13:43 -08:00
bors b765963267 Auto merge of #150843 - fmease:dyn-ace, r=BoxyUwU
mGCA: Make trait object types with type-level associated consts dyn compatible

Under feature `min_generic_const_args` (mGCA) (rust-lang/rust#132980), render traits with non-parametrized type-level associated constants (i.e., `#[type_const]` ones) dyn compatible but force the user to specify all type-level associated consts in the trait object type via bindings (either directly, via supertrait bounds and/or behind trait aliases) just like associated types, their sibling.

Fixes rust-lang/rust#130300 (feature request).
Fixes rust-lang/rust#136063 (bug).
Fixes rust-lang/rust#137260 (bug).
Fixes rust-lang/rust#137514 (bug).

While I'm accounting for most illegal `Self` references via const projections & params, I'm intentionally ignoring RUST-123140 (and duplicates) in this PR which is to be tackled some other time.

Additional context: Crate `rustc-demangle` had to be updated to fix v0 demangling. I've patched it in PR https://github.com/rust-lang/rustc-demangle/pull/87 which was was released in version 0.1.27 via PR https://github.com/rust-lang/rustc-demangle/pull/88.
2026-01-22 01:56:41 +00:00
León Orell Valerian Liehr 558a59258e Support debuginfo for assoc const bindings 2026-01-21 18:52:08 +01:00
Jonathan Brouwer 74ff006ce6 Rollup merge of #147426 - Enselic:better-stepping, r=saethlin
tests/debuginfo/basic-stepping.rs: Add revisions `default-mir-passes`, `no-SingleUseConsts-mir-pass`

To prevent regressions our test must cover the code both inside and outside of the `SingleUseConsts` MIR pass. Use revisions for that.

We know this use case is sensitive to regressions because it already happened at least once. See https://github.com/rust-lang/rust/issues/33013#issuecomment-3121579216.

CC https://github.com/rust-lang/rust/issues/130896
2026-01-21 16:39:39 +01:00
dianqk 5769006794 Run dummy_span.rs test with SimplifyComparisonIntegral 2026-01-14 18:57:17 +08:00
Martin Nordholts 622572f6df tests/debuginfo/basic-stepping.rs: Add revisions default-mir-passes, no-SingleUseConsts-mir-pass
To prevent regressions our test must cover the code both inside and
outside of the `SingleUseConsts` MIR pass. Use revisions for that.
2026-01-05 08:08:52 +01:00
Martin Nordholts de505d24db tests/debuginfo/basic-stepping.rs: Don't mix compile-flags with ignore-*
We want directives nice and tidy.
2026-01-05 08:08:03 +01:00
Martin Nordholts 423a8dc409 tests/debuginfo/macro-stepping.rs: Add revisions default-mir-passes, no-SingleUseConsts-mir-pass
To prevent the test from regressing both with and without
`SingleUseConsts` MIR pass.
2025-12-23 15:33:56 +01:00
Martin Nordholts b7a0f84a5a tests/debuginfo/function-arg-initialization.rs: Stop disabling SingleUseConsts MIR pass 2025-12-20 20:35:30 +01:00
Ralf Jung 18af84b138 debuginfo/macro-stepping test: extend comments 2025-12-01 22:32:36 +01:00
joboet c22b819952 update type names in debuginfo tests 2025-11-29 15:59:11 +01:00
Orson Peters 492fbc56c1 Update debuginfo test from Global to System 2025-11-28 23:35:38 +01:00
Martin Nordholts 5b57d02e9f compiletest: Use //@ prefixes also for debuginfo test directives
So that when we later add support for revisions we can use the same
syntax for revisions as elsewhere.

This also prevents people from making typos for commands since
`src/tools/compiletest/src/directives/directive_names.rs` will catch such
typos now.

Note that we one FIXME for a non-trivial change for later:
```
// FIXME(148097): Change `// cdb-checksimple_closure` to `//@ cdb-check:simple_closure`
```
2025-11-25 06:13:45 +01:00
Walnut af1c2b277d update tests 2025-11-24 00:17:53 -06:00
David Wood ff00110543 sess: default to v0 symbol mangling
Rust's current mangling scheme depends on compiler internals; loses
information about generic parameters (and other things) which makes for
a worse experience when using external tools that need to interact with
Rust symbol names; is inconsistent; and can contain `.` characters
which aren't universally supported. Therefore, Rust has defined its own
symbol mangling scheme which is defined in terms of the Rust language,
not the compiler implementation; encodes information about generic
parameters in a reversible way; has a consistent definition; and
generates symbols that only use the characters `A-Z`, `a-z`, `0-9`, and
`_`.

Support for the new Rust symbol mangling scheme has been added to
upstream tools that will need to interact with Rust symbols (e.g.
debuggers).

This commit changes the default symbol mangling scheme from the legacy
scheme to the new Rust mangling scheme.

Signed-off-by: David Wood <david.wood@huawei.com>
2025-11-19 11:55:09 +00:00
Martin Nordholts 5ad2f434dc rustc_codegen_llvm: Require opt-level >= 1 for index-based loop
To make debugger stepping intuitive with `-Copt-level=0`. See the
adjusted `basic-stepping.rs` test.

This is kind of a revert of bd0aae92dc, except we don't revert it,
we just make it conditional on `opt-level`. That commit regressed
`basic-stepping.rs`, but it was not noticed since that test did not
exist back then. I have retroactively bisected to find that out.

It seems messy to sprinkle if-cases inside of the
`write_operand_repeatedly()` so make the whole function conditional.

The test that bd0aae92dc added in
`tests/codegen/issues/issue-111603.rs` already use `-Copt-level=3`, so
we don't need to adjust the compiler flags for it to keep passing.
2025-11-13 06:29:55 +01:00
Tom Tromey 71e2e0cded Minor fixes to StdNonZeroNumberProvider for gdb
While looking at the pretty-printers, I found a few minor oddities in
StdNonZeroNumberProvider.

First, gdb.Type.fields() already returns a sequence, so there's no
need to call list().

Second, it's more idiomatic for the (somewhat misnamed) to_string
method to simply return the underlying gdb.Value.  This also lets gdb
apply whatever formats were passed to `print`, as the new test shows.

Third, there's no need to use the field's name when looking up a field
in a value, the gdb.Field itself can be used.
2025-11-05 11:42:54 -07:00
bors 35ebdf9ba1 Auto merge of #147728 - Enselic:gdbt-check-typo, r=Zalathar
tests: activate misspelled `gdb-check` in `function-arg-initialization.rs`

In 9253e1206e a bunch of `gdbr-check` (for `rust-gdb`) directives and `gdbg-check` (for plain `gdb`) directives were added. But in two places the author accidentally wrote `gdbt-check` instead (`t` is next to `r` on the keyboard). This commit fixes that typo.

rust-lang/rust#129218 later renamed `gdbr-check` to just `gdb-check` which is why we rename to `gdb-check` directly.

The test still passes locally for me after the change, but fails if I change the `gdb-check` checks to check for some other string, so the check seems to still perform its intended function.

Note that we need to add a `std::hint::black_box()` to avoid

    $4 = <optimized out>

prints on at least `aarch64-gnu-llvm-20-1`.

After this there are no more instances of the string `gdbt` in the code base:
```console
$ git grep gdbt
```

try-job: dist-i586-gnu-i586-i686-musl
2025-11-03 10:10:34 +00:00
Martin Nordholts 192f862c93 tests: activate misspelled gdb-check in function-arg-initialization.rs
In 9253e1206e a bunch of `gdbr-check` (for `rust-gdb`) and
`gdbg-check` (for plain `gdb`) was added. But in two places the author
accidentally wrote `gdbt-check` instead. This commit fixes this typo.
2025-10-28 06:21:17 +01:00
Jamesbarford a918702bca Re-enable macro-stepping test for AArch64 2025-10-27 10:26:57 +00:00
bors 2f7620a5cc Auto merge of #146414 - GuillaumeGomez:run-test-with-gcc-backend, r=Kobzol
Add a CI job that runs a subset of UI tests with the GCC backend

Part of https://github.com/rust-lang/compiler-team/issues/891.

r? `@Kobzol`
2025-10-14 09:21:23 +00:00
Guillaume Gomez 2ad443c849 Ignore failing debuginfo tests with gcc backend 2025-10-13 15:20:49 +02:00
Zalathar 10393a8052 Add LLDB commands to tests/debuginfo/basic-types-globals.rs 2025-10-12 21:44:13 +11:00
dianqk 1bd89bd42e codegen: Generate dbg_value for the ref statement 2025-10-02 14:55:51 +08:00
Caiweiran a54567e76c tests: Ignore basic-stepping.rs on riscv64 2025-08-29 08:11:48 +00:00
Jacob Pratt 561656db67 Rollup merge of #145745 - heiher:ignore-basic-stepping, r=lqd
tests: Ignore basic-stepping.rs on LoongArch
2025-08-22 22:00:58 -04:00
Jacob Pratt 5cfdbd6c08 Rollup merge of #145218 - nilptr:nilptr/feat/lldb-enum-pretty-printer, r=Mark-Simulacrum
[Debuginfo] improve enum value formatting in LLDB for better readability

> TL;DR: When debugging with CodeLLDB, I noticed enum values were often hard to read because LLDB lists every possible variant, resulting in a verbose and cluttered view, even though only one variant is actually valid. Interestingly, raw enum types display nicely. After some investigation, I found that `&enum` values get classified as `Other`, so it falls back to `DefaultSyntheticProvider`, which causes this verbose output.

## What does this PR do?

This PR contains 2 commits:

1. change the enum value formatting from showing 2 separate fields (`value` for attached data and `$discr$` for the discriminator) to a concise `<readable variant name>: <attached data>` format
2. dereference pointer types in `classify_rust_type` so that it can return more accurate type for reference type

## Self-test proof

Before:

<img width="1706" height="799" alt="before" src="https://github.com/user-attachments/assets/b66c7e22-990a-4da5-9036-34e3f9f62367" />

After:

<img width="1541" height="678" alt="after" src="https://github.com/user-attachments/assets/36db32e2-f822-4883-8f17-cb8067e509f6" />
2025-08-22 22:00:49 -04:00
WANG Rui d61353ff43 tests: Ignore basic-stepping.rs on LoongArch 2025-08-22 15:58:52 +08:00
Jacob Pratt 537d5f40a6 Rollup merge of #145297 - adwinwhite:recursive-debuginfo, r=wesleywiser
fix(debuginfo): handle false positives in overflow check

Fixes rust-lang/rust#144636.

Duplicate wrappers and normal recursive types can lead to false positives.
```rust
struct Recursive {
	a: Box<Box<Recursive>>,
}
```
The ADT stack can be:
- `Box<Recursive>`
- `Recursive`
- `Box<Box<Recursive>>` (`Box` now detected as expanding)

We can filter them out by tracing the generic arg back through the stack, as true expanding recursive types must have their expanding arg used as generic arg throughout.

r? ````@wesleywiser````
2025-08-21 01:12:16 -04:00
nilptr 12eb1a0bce feat(lldb debug info): improve enum value formatting in lldb 2025-08-17 21:15:18 +08:00
Adwin White e13e1e4c0c fix(debuginfo): handle false positives in overflow check 2025-08-12 17:13:13 +08:00
bjorn3 270c1a4d24 Revert "Embed GDB pretty printers in rlibs and dylibs"
This reverts commit b4d923cea0.
2025-08-06 18:00:58 +00:00
Sebastian Poeplau b4d923cea0 Embed GDB pretty printers in rlibs and dylibs
Instead of collecting pretty printers transitively when building
executables/staticlibs/cdylibs, let the debugger find each crate's
pretty printers via its .debug_gdb_scripts section. This covers the case
where libraries defining custom pretty printers are loaded dynamically.
2025-08-06 13:24:43 +02:00
Stuart Cook cc7c63b907 Rollup merge of #144497 - Enselic:basic-stepping, r=Mark-Simulacrum
tests: Add test for basic line-by-line stepping in a debugger

Let's wait with lldb testing until the test works properly with gdb.

This is a regression test to prevent further regressions of https://github.com/rust-lang/rust/issues/33013 which unfortunately regressed in **nightly-2023-04-24**. See https://github.com/rust-lang/rust/issues/33013#issuecomment-3121579216.
2025-08-04 11:24:37 +10:00
bjorn3 ae2f8d9216 Remove the omit_gdb_pretty_printer_section attribute
Disabling loading of pretty printers in the debugger itself is more
reliable. Before this commit the .gdb_debug_scripts section couldn't be
included in dylibs or rlibs as otherwise there is no way to disable the
section anymore without recompiling the entire standard library.
2025-08-01 20:04:59 +00:00
Daniel Paoliello cffde732ce Verify llvm-needs-components are not empty and match the --target value 2025-07-29 11:20:23 -07:00