Commit Graph

21219 Commits

Author SHA1 Message Date
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
lucarlig
19c6815a21 Multiple bounds checking elision failures 2025-08-01 18:38:22 +01:00
lucarlig
1a64684b04 LLVM error with unsupported expression in static initializer for const pointer in array on macOS 2025-08-01 18:01:21 +01:00
bors
924a5a4b7f Auto merge of #144773 - RalfJung:rollup-uif2yyj, r=RalfJung
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#144397 (`tests/ui/issues/`: The Issues Strike Back [2/N])
 - rust-lang/rust#144410 (Make tier 3 musl targets link dynamically by default)
 - rust-lang/rust#144708 (Add tracing to step.rs and friends)
 - rust-lang/rust#144730 (Create a typed wrapper for codegen backends in bootstrap)
 - rust-lang/rust#144771 (Remove some noisy triagebot pings for myself)
 - rust-lang/rust#144772 (add unsupported_calling_conventions to lint list)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-01 10:20:07 +00:00
Ralf Jung
37ad0776ac Rollup merge of #144397 - Kivooeo:issue2, r=jieyouxu
`tests/ui/issues/`: The Issues Strike Back [2/N]

Some `tests/ui/issues/` housekeeping, to trim down number of tests directly under `tests/ui/issues/`. Part of https://github.com/rust-lang/rust/issues/133895.

r? ``@jieyouxu``
2025-08-01 09:59:03 +02:00
Jacob Pratt
400b8b6862 Rollup merge of #144700 - aDotInTheVoid:macro-rules-for-macro-fools, r=GuillaumeGomez
rustdoc-json: Move `#[macro_export]` from `Other` to it's own  variant

Followup to rust-lang/rust#142936.

cargo-semver-checks [cares about this attribute](4a0d1b0ca1/src/visibility_tracker.rs (L459-L476)), and it wasn't included in the initial PR for structured attributes CC `@obi1kenobi.`

r? `@GuillaumeGomez`
2025-08-01 00:38:20 -04:00
Jacob Pratt
c7ec9bcc6e Rollup merge of #144691 - xizheyin:suggest-confuse, r=estebank
Extend `is_case_difference` to handle digit-letter confusables

This PR extends `is_case_difference` to handle digit-letter confusables

Add support for detecting 0/O, 1/l, 5/S, 8/B, 9/g confusables in error suggestions.

r? `@estebank`
2025-08-01 00:38:20 -04:00
Jacob Pratt
e6b80f3407 Rollup merge of #143849 - lolbinarycat:rustdoc-priv-normalize-143222, r=GuillaumeGomez
rustdoc: never link to unnamable items

fixes rust-lang/rust#143222
2025-08-01 00:38:19 -04:00
Trevor Gross
24c770ba1c aarch64: Make outline-atomics a known target feature
This is a feature used by LLVM that is enabled for our `aarch64-linux`
targets, which we would like to configure on in `std`. Thus, mark
`outline-atomics` a known feature. It is left unstable for now.
2025-07-31 22:00:08 -05:00
Folkert de Vries
040f71e812 loop match: error on #[const_continue] outside #[loop_match] 2025-08-01 00:28:52 +02:00
Waffle Lapkin
5aec4379e3 detect infinite recursion with tail calls in ctfe 2025-07-31 23:59:55 +02:00
Urgau
8a3a7e625a Add lint against dangling pointers form local variables 2025-07-31 22:35:22 +02:00
Michael Goulet
e9765781b2 Remove the witness type from coroutine args 2025-07-31 17:38:28 +00:00
Michael Goulet
d525e79157 Stall coroutines based off of ty::Coroutine, not ty::CoroutineWitness 2025-07-31 17:31:51 +00:00
Kivooeo
a4a5bf5a71 comments 2025-07-31 21:25:49 +05:00
Jana Dönszelmann
e2ae91b74a Rollup merge of #144733 - Muscraft:secondary-file-sigil, r=compiler-errors
fix: Match width of ascii and unicode secondary file start

The current [unicode secondary file start](64ca23b623/compiler/rustc_errors/src/emitter.rs (L2991)) is only three characters, whereas the ASCII variant and normal [file start](64ca23b623/compiler/rustc_errors/src/emitter.rs (L2983-L2984)) are four characters. This slight difference caused the paths following a Unicode secondary file start to not align with other structured elements.
2025-07-31 17:19:41 +02:00
Jana Dönszelmann
edd2574848 Rollup merge of #144711 - compiler-errors:op-span, r=petrochenkov
Consider operator's span when computing binop expr span

When computing the span of a binop consisting of `lhs` and `rhs`, we previously just took the spans of `lhs.span.to(rhs.span)`. In the case that both `lhs` and `rhs` are both arguments to a macro, this can produce a wildly incorrect span.

To fix this, first compute the span between `lhs` and the binary operator, which will cause `lhs` to possibly be adjusted to a relevant macro metavar, and then compute that span extended to `rhs`, which will cause it to also be adjusted to a relevant macro metavar.

This coincidentally fixes a FIXME in `tests/ui/lint/wide_pointer_comparisons.rs` and suppresses a nonsense suggestion.
2025-07-31 17:19:39 +02:00
lcnr
a78f92be9b add tests 2025-07-31 15:39:55 +02:00
Scott Schafer
935fdb6980 fix: Match width of ascii and unicode secondary file start 2025-07-31 07:26:39 -06:00
bors
3fb1b53a9d Auto merge of #144731 - samueltardieu:rollup-36y30k2, r=samueltardieu
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#136840 (Fix linker-plugin-lto only doing thin lto)
 - rust-lang/rust#144053 (Remove install Rust script from CI)
 - rust-lang/rust#144297 (Make `libtest::ERROR_EXIT_CODE` const public to not redefine it in rustdoc)
 - rust-lang/rust#144721 (`std_detect`: Linux 6.16 support for RISC-V)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-31 12:04:04 +00:00
Samuel Tardieu
d8c09c10e5 Rollup merge of #136840 - Flakebi:linker-plugin-lto-fat, r=dianqk
Fix linker-plugin-lto only doing thin lto

When rust provides LLVM bitcode files to lld and the bitcode contains
function summaries as used for thin lto, lld defaults to using thin lto.
This prevents some optimizations that are only applied for fat lto.

We solve this by not creating function summaries when fat lto is
enabled. The bitcode for the module is just directly written out.

An alternative solution would be to set the `ThinLTO=0` module flag to
signal lld to do fat lto.
The code in clang that sets this flag is here:
560149b5e3/clang/lib/CodeGen/BackendUtil.cpp (L1150)
The code in LLVM that queries the flag and defaults to thin lto if not
set is here:
e258bca950/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp (L4441-L4446)

try-job: x86_64-gnu-debug
try-job: aarch64-gnu-debug
2025-07-31 13:12:45 +02:00
bors
64ca23b623 Auto merge of #144723 - Zalathar:rollup-f9e0rfo, r=Zalathar
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#144657 (fix: Only "close the window" when its the last annotated file)
 - rust-lang/rust#144665 (Re-block SRoA on SIMD types)
 - rust-lang/rust#144713 (`rustc_middle::ty` cleanups)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-31 08:54:41 +00:00
Stuart Cook
8cca6bce4e Rollup merge of #144665 - scottmcm:restore-sroa-simd-check, r=compiler-errors
Re-block SRoA on SIMD types

Fixes rust-lang/rust#144621
2025-07-31 18:52:10 +10:00
Stuart Cook
880113eff9 Rollup merge of #144657 - Muscraft:fix-unicode-close-window, r=fee1-dead
fix: Only "close the window" when its the last annotated file

While comparing the Unicode theme output of `rustc` and `annotate-snippets`, I found that `rustc` would ["close the window"](686bc1c5f9/compiler/rustc_errors/src/emitter.rs (L1025-L1027)) (draw a `╰╴`), even though there were other annotated files that followed the current one. This PR makes it so the emitter will only "close the window" on the last annotated file.

Before:
```
error[E0624]: method `method` is private
   ╭▸ $DIR/close_window.rs:9:7
   │
LL │     s.method();
   ╰╴      ━━━━━━ private method
   │
   ⸬ $DIR/auxiliary/close_window.rs:3:5
   │
LL │     fn method(&self) {}
   ╰╴    ──────────────── private method defined here
```

After:
```
error[E0624]: method `method` is private
   ╭▸ $DIR/close_window.rs:9:7
   │
LL │     s.method();
   │       ━━━━━━ private method
   │
   ⸬ $DIR/auxiliary/close_window.rs:3:5
   │
LL │     fn method(&self) {}
   ╰╴    ──────────────── private method defined here
```
2025-07-31 18:52:10 +10:00
Flakebi
7a127fba65 Fix linker-plugin-lto only doing thin lto
When rust provides LLVM bitcode files to lld and the bitcode contains
function summaries as used for thin lto, lld defaults to using thin lto.
This prevents some optimizations that are only applied for fat lto.

We solve this by not creating function summaries when fat lto is
enabled. The bitcode for the module is just directly written out.

An alternative solution would be to set the `ThinLTO=0` module flag to
signal lld to do fat lto.
The code in clang that sets this flag is here:
560149b5e3/clang/lib/CodeGen/BackendUtil.cpp (L1150)
The code in LLVM that queries the flag and defaults to thin lto if not
set is here:
e258bca950/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp (L4441-L4446)
2025-07-31 10:38:34 +02:00
Scott Schafer
761c4e308c fix: Only "close the window" when its the last annotated file 2025-07-31 00:25:09 -06:00
xizheyin
7b667e7811 Extend is_case_difference to handle digit-letter confusables
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-31 13:55:59 +08:00
Stuart Cook
5c123c25e3 Rollup merge of #144663 - Zalathar:empty-span, r=petrochenkov
coverage: Re-land "Enlarge empty spans during MIR instrumentation"

This allows us to assume that coverage spans will only be discarded during codegen in very unusual situations.

---

This seemingly-simple change has a rather messy history:
- rust-lang/rust#140847
- rust-lang/rust#141650
- rust-lang/rust#144298
- rust-lang/rust#144480

Since then, a number of related changes have landed that should make it reasonable to try again:
- rust-lang/rust#144530
- rust-lang/rust#144560
- rust-lang/rust#144616

In particular, we have multiple fixes/mitigations, and a confirmed regression test for the original bug that is not triggered by re-landing the changes in this PR.
2025-07-31 15:42:00 +10:00
Stuart Cook
8628b78f24 Rollup merge of #144232 - xacrimon:explicit-tail-call, r=WaffleLapkin
Implement support for `become` and explicit tail call codegen for the LLVM backend

This PR implements codegen of explicit tail calls via `become` in `rustc_codegen_ssa` and support within the LLVM backend. Completes a task on (https://github.com/rust-lang/rust/issues/112788). This PR implements all the necessary bits to make explicit tail calls usable, other backends have received stubs for now and will ICE if you use `become` on them. I suspect there is some bikeshedding to be done on how we should go about implementing this for other backends, but it should be relatively straightforward for GCC after this is merged.

During development I also put together a POC bytecode VM based on tail call dispatch to test these changes out and analyze the codegen to make sure it generates expected assembly. That is available [here](https://github.com/xacrimon/tcvm).
2025-07-31 15:42:00 +10:00
Stuart Cook
f478bec907 Rollup merge of #143672 - beepster4096:box_drop_flags_again, r=oli-obk
Fix Box allocator drop elaboration

New version of rust-lang/rust#131146.

Clearing Box's drop flag after running its destructor can cause it to skip dropping its allocator, so just don't. Its cleared by the drop ladder code afterwards already.

Unlike the last PR this also handles other types with destructors properly, in the event that we can have open drops on them in the future (by partial initialization or DerefMove or something).

Finally, I also added tests for the interaction with async drop here but I discovered rust-lang/rust#143658, so one of the tests has a `knownbug` annotation. Not sure if it should be in this PR at all though.

Fixes rust-lang/rust#131082

r? wesleywiser - prev. reviewer
2025-07-31 15:41:59 +10:00
Michael Goulet
51cd9b564f Consider operator's span when computing binop expr span 2025-07-31 02:28:11 +00:00
bors
32e7a4b92b Auto merge of #144405 - lcnr:hir-typeck-uniquify, r=BoxyUwU
uniquify root goals during HIR typeck

We need to rely on region identity to deal with hangs such as https://github.com/rust-lang/trait-system-refactor-initiative/issues/210 and to keep the current behavior of `fn try_merge_responses`.

This is a problem as borrowck starts by replacing each *occurrence* of a region with a unique inference variable. This frequently splits a single region during HIR typeck into multiple distinct regions. As we assume goals to always succeed during borrowck, relying on two occurances of a region being identical during HIR typeck causes ICE. See the now fixed examples in https://github.com/rust-lang/trait-system-refactor-initiative/issues/27 and rust-lang/rust#139409.

We've previously tried to avoid this issue by always *uniquifying* regions when canonicalizing goals. This prevents caching subtrees during canonicalization which resulted in hangs for very large types. People rely on such types in practice, which caused us to revert our attempt to reinstate `#[type_length_limit]` in https://github.com/rust-lang/rust/pull/127670. The complete list of changes here:
- rust-lang/rust#107981
- rust-lang/rust#110180
- rust-lang/rust#114117
- rust-lang/rust#130821

After more consideration, all occurrences of such large types need to happen outside of typeck/borrowck. We know this as we already walk over all types in the MIR body when replacing their regions with nll vars.

This PR therefore enables us to rely on region identity inside of the trait solver by exclusively **uniquifying root goals during HIR typeck**. These are the only goals we assume to hold during borrowck. This is insufficient as type inference variables may "hide" regions we later uniquify. Because of this, we now stash proven goals which depend on inference variables in HIR typeck and reprove them after writeback. This closes https://github.com/rust-lang/trait-system-refactor-initiative/issues/127.

This was originally part of rust-lang/rust#144258 but I've moved it into a separate PR. While I believe we need to rely on region identity to fix the performance issues in some way, I don't know whether rust-lang/rust#144258 is the best approach to actually do so. Regardless of how we deal with the hangs however, this change is necessary and desirable regardless.

r? `@compiler-errors` or `@BoxyUwU`
2025-07-31 00:32:55 +00:00
Scott Schafer
4643d9ad6d test: Check close window rendering 2025-07-30 16:25:24 -06:00
David Tenty
ee0118f8a1 [test][AIX] ignore extern_weak linkage test
The AIX linkage model doesn't support ELF style extern_weak semantic, so just skip this test, like other platforms that don't have it.
2025-07-30 16:45:17 -04:00
Alona Enraght-Moony
a33e084afe rustdoc-json: Move #[macro_export] from Other to it's own variant 2025-07-30 19:57:32 +00:00
Alona Enraght-Moony
1a515e6949 rustdoc-json: Add test for #[macro_use] attribute 2025-07-30 19:54:23 +00:00
Samuel Tardieu
61760fbda4 Rollup merge of #144308 - GuillaumeGomez:merged-doctest-times, r=lolbinarycat
[rustdoc] Display total time and compilation time of merged doctests

Fixes rust-lang/rust#144270.

Does it look good to you `@kpreid?`

<img width="908" height="263" alt="image" src="https://github.com/user-attachments/assets/cd5d082d-c4e0-42ed-91dd-bd263b413dcd" />
2025-07-30 19:49:02 +02:00
Samuel Tardieu
b38ece9021 Rollup merge of #143465 - kornelski:extern-name, r=petrochenkov
Support multiple crate versions in --extern-html-root-url

Rustdoc's `--extern-html-root-url` used to use `tcx.crate_name()` to identify crates, but that used crates' internal names from their metadata, instead of names given to them in `--extern`. That was confusing, because both `--extern…` arguments seem related and use similar syntax. Crucially, this didn't work correctly with Cargo's package aliases or multiple versions of crates.

`sess.opts.externs` lacks `CrateNum`, and `Resolver.extern_prelude` gets destroyed before `rustdoc` has a chance to see it, so I've had to save this mapping in `CStore`.

Just in case, I've kept the previous mapping by crate name as a fallback for crates that weren't matched by their extern name.

Fixes rust-lang/rust#76296
2025-07-30 19:49:01 +02:00
lcnr
b6cbe33aeb handle region dependent goals due to infer vars 2025-07-30 14:01:37 +02:00
Eduard Stefes
02ac116e53 Fix tests for big-endian
The tests fail on s390x and presumably other big-endian systems,
due to print of raw values and padding bytes.

To fix the tests remove the raw output values in the error note
with `normalize-stderr`.
2025-07-30 13:53:04 +02:00
Stuart Cook
3682d8c1ce Rollup merge of #144668 - daltenty:daltenty/runmake-llvm-components, r=jieyouxu
[test][run-make] add needs-llvm-components

Add some constraints to run-make tests that require specific target support and will fail without them.
2025-07-30 17:59:40 +10:00
Stuart Cook
08e26fc678 Rollup merge of #144666 - compiler-errors:correct-late, r=lqd
Make sure to account for the right item universal regions in borrowck

Fixes https://github.com/rust-lang/rust/issues/144608.

The ICE comes from a mismatch between the liberated late bound regions (i.e. "`ReLateParam`"s) that come from promoting closure outlives, and the regions we have in our region vid mapping from `UniversalRegions`.

When building `UniversalRegions`, we end up using the liberated regions from the binder of the closure's signature:

c8bb4e8a12/compiler/rustc_borrowck/src/universal_regions.rs (L521)

Notably, this signature may be anonymized if the closure signature being deduced comes from an external constraints:

c8bb4e8a12/compiler/rustc_hir_typeck/src/closure.rs (L759-L762)

This is true in the test file I committed, where the signature is influenced by the `impl FnMut(&mut ())` RPIT.

However, when promoting a type outlives constraint we end up creating a late bound lifetime mapping that disagrees with those liberated late bound regions we constructed in `UniversalRegions`:

c8bb4e8a12/compiler/rustc_borrowck/src/universal_regions.rs (L299)

Specifically, in `for_each_late_bound_region_in_item` (which is called by `for_each_late_bound_region_in_recursive_scope`), we were using `tcx.late_bound_vars` which uses the late bound regions *from the HIR*. This query both undercounts the late bound regions (e.g. those that end up being deduced from bounds), and also doesn't account for the fact that we anonymize them in the signature as mentioned above.

c8bb4e8a12/compiler/rustc_borrowck/src/universal_regions.rs (L977)

This PR fixes that function to use the *correct signature*, which properly considers the bound vars that come from deducing the signature of the closure, and which comes from the closure's args from the `type_of` query.
2025-07-30 17:59:40 +10:00
Stuart Cook
38e7615e78 Rollup merge of #144411 - Kivooeo:remove-world, r=jieyouxu
Remove `hello_world` directory

Move `tests/ui/hello_world/main.rs` and retire the single-file `tests/ui/hello_world/` directory.

Part of https://github.com/rust-lang/rust/issues/133895.

r? `@jieyouxu`
2025-07-30 17:59:39 +10:00
Stuart Cook
b6ac83d372 Rollup merge of #144042 - dpaoliello:verifyllvmcomp, r=jieyouxu
Verify llvm-needs-components are not empty and match the --target value

I recently discovered a test with an empty `llvm-needs-components` entry (fixed in rust-lang/rust#143979) which meant that it didn't work correctly when building Rust with a limited set of LLVM targets.

This change makes a pair of improvements to prevent this issue from creeping in again:
* When parsing directives with values, `compiletest` will now raise an error if there is an empty value.
* Improved the `target_specific_tests` tidy checker to map targets to LLVM components, to verify that any existing `llvm-needs-components` contains the target being used.

I also fixed all the issues flagged by the improved tidy checker.
2025-07-30 17:59:37 +10:00
Scott McMurray
4220587c22 AlignmentEnum should just be repr(usize) now
Since it's cfg'd instead of type-aliased
2025-07-30 00:09:01 -07:00
Ralf Jung
ba5b6b9ec4 const-eval: full support for pointer fragments 2025-07-30 08:13:58 +02:00
David Tenty
21af154998 [test][run-make] add needs-llvm-components
Add some constraints to run-make tests that require specific target support and will fail without them.
2025-07-30 00:39:43 -04:00
Michael Goulet
98d08ff014 Make sure to account for the right item universal regions in borrowck 2025-07-30 04:07:19 +00:00
Scott McMurray
fe08ba0bae Re-block SRoA on SIMD types
Fixes 144621
2025-07-29 20:41:34 -07:00
Zalathar
2e6f4a5922 coverage: Re-land "Enlarge empty spans during MIR instrumentation"
This allows us to assume that coverage spans will only be discarded during
codegen in very unusual situations.
2025-07-30 13:17:05 +10:00