304366 Commits

Author SHA1 Message Date
Guillaume Gomez
2820fcc830 Revert "rustdoc: IndexItem::{stability -> is_unstable}"
This reverts commit 5e8ebd5ecd8546591a6707ac9e1a3b8a64c72f76.
2025-08-14 13:04:08 +02:00
Guillaume Gomez
1975b06583 Revert "rustdoc search: add performance note about searchIndexUnstable check"
This reverts commit fdbc8d08a63a3d34b7aebabb2f18a768462a98c4.
2025-08-14 13:02:56 +02:00
Guillaume Gomez
18fd6eab3a Revert "Correctly handle when there are no unstable items in the documented crate"
This reverts commit cd79c7189db7b611f9199fd12ba56563afa18642.
2025-08-14 13:02:40 +02:00
MarcoIeni
75b7d24a98
ci: clean windows disk space in background 2025-08-14 12:38:35 +02:00
bors
30017c36d6 Auto merge of #145388 - GuillaumeGomez:rollup-hnlt5ov, r=GuillaumeGomez
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#140434 (rustdoc: Allow multiple references to a single footnote)
 - rust-lang/rust#142372 (Improve `--remap-path-prefix` documentation)
 - rust-lang/rust#142741 (Fix unsoundness in some tests)
 - rust-lang/rust#144515 (Implement `ptr_cast_array`)
 - rust-lang/rust#144727 (Add tracing to resolve-related functions)
 - rust-lang/rust#144959 (fix(unicode-table-generator): fix duplicated unique indices)
 - rust-lang/rust#145179 (Avoid abbreviating "numerator" as "numer", to allow catching typo "numer" elsewhere)
 - rust-lang/rust#145250 (Add regression test for a former ICE involving helper attributes containing interpolated tokens)
 - rust-lang/rust#145266 (Reduce some queries around associated items)
 - rust-lang/rust#145299 (doc test: fix mpsc.rs try_send doc test)
 - rust-lang/rust#145323 (Port the `#[linkage]` attribute to the new attribute system)
 - rust-lang/rust#145361 (Suppress wrapper suggestion when expected and actual ty are the same adt and the variant is unresolved)
 - rust-lang/rust#145372 (resolve: Miscellaneous cleanups)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-14 09:56:07 +00:00
Guillaume Gomez
762b7ecdb0
Rollup merge of #145372 - petrochenkov:noresmacpath, r=jackh726
resolve: Miscellaneous cleanups

See individual commits.

All noticed when reviewing recent PRs to name resolution.
2025-08-14 11:39:41 +02:00
Guillaume Gomez
707e956946
Rollup merge of #145361 - xizheyin:145294, r=compiler-errors
Suppress wrapper suggestion when expected and actual ty are the same adt and the variant is unresolved

Fixes rust-lang/rust#145294

I initially tried the desired suggestion in this issue, but since that suggestion occurs in the expected type, it is inappropriate to suggest for expected expressions (see other suggest methods in the same file). I believe that suppressing the incorrect suggestion is the more appropriate choice here.

I opted for a slightly more general approach: when the expected type and actual type are the same ADT (e.g., both are Result in this example), we assume that code tend to compare the internal generic parameters(i.e. `Option<&str>` vs `Option<String>`, instead of `E = _` vs `Result<Option<String>>>`). When `E` is an unresolved infer type in the expected type (`_` in this example), we should not wrapp the actual type.

Two commits show the difference.

r? compiler
2025-08-14 11:39:40 +02:00
Guillaume Gomez
44d3217c20
Rollup merge of #145323 - scrabsha:push-pqwvmznzzmpr, r=jdonszelmann
Port the `#[linkage]` attribute to the new attribute system

r? `@jdonszelmann`
2025-08-14 11:39:39 +02:00
Guillaume Gomez
f493f804d7
Rollup merge of #145299 - eval-exec:exec-fix-145293, r=tgross35
doc test: fix mpsc.rs try_send doc test

This Pr want to fix the doctest, to make https://github.com/rust-lang/rust/pull/145293 's CI pass:

r? ``@Zalathar``

https://github.com/rust-lang/rust/actions/runs/16903356990/job/47887354221

```bash
2025-08-12T10:19:32.3873237Z test library/std/src/thread/scoped.rs - thread::scoped::ScopedJoinHandle<'scope,T>::join (line 302) ... ok
2025-08-12T10:19:32.4370250Z test library/std/src/time.rs - time::SystemTimeError::duration (line 688) ... ok
2025-08-12T10:19:32.5121966Z test library/std/src/time.rs - time::UNIX_EPOCH (line 664) ... ok
2025-08-12T10:19:32.5122586Z
2025-08-12T10:19:32.5122738Z failures:
2025-08-12T10:19:32.5122973Z
2025-08-12T10:19:32.5123482Z ---- library/std/src/sync/mpsc.rs - sync::mpsc::SyncSender<T>::try_send (line 691) stdout ----
2025-08-12T10:19:32.5124286Z Test executable failed (exit status: 1).
2025-08-12T10:19:32.5124518Z
2025-08-12T10:19:32.5124605Z stdout:
2025-08-12T10:19:32.5124810Z message 3 received
2025-08-12T10:19:32.5125043Z message 1 received
2025-08-12T10:19:32.5125288Z the third message was never sent
2025-08-12T10:19:32.5125497Z
2025-08-12T10:19:32.5125581Z stderr:
2025-08-12T10:19:32.5125701Z
2025-08-12T10:19:32.5125935Z thread '<unnamed>' (203874) panicked at library/std/src/sync/mpsc.rs:14:25:
2025-08-12T10:19:32.5126459Z called `Result::unwrap()` on an `Err` value: SendError { .. }
2025-08-12T10:19:32.5126836Z stack backtrace:
2025-08-12T10:19:32.5127568Z ␛[0m␛[1m␛[38;5;9merror␛[0m␛[0m␛[1m: the main thread terminated without waiting for all remaining threads␛[0m
2025-08-12T10:19:32.5127971Z
2025-08-12T10:19:32.5128335Z ␛[0m␛[1m␛[38;5;10mnote␛[0m␛[0m␛[1m: set `MIRIFLAGS=-Zmiri-ignore-leaks` to disable this check␛[0m
2025-08-12T10:19:32.5128694Z
2025-08-12T10:19:32.5128943Z ␛[0m␛[1m␛[38;5;9merror␛[0m␛[0m␛[1m: aborting due to 1 previous error␛[0m
2025-08-12T10:19:32.5129519Z
2025-08-12T10:19:32.5129527Z
2025-08-12T10:19:32.5129532Z
2025-08-12T10:19:32.5129537Z
2025-08-12T10:19:32.5129631Z failures:
2025-08-12T10:19:32.5130018Z     library/std/src/sync/mpsc.rs - sync::mpsc::SyncSender<T>::try_send (line 691)
2025-08-12T10:19:32.5130396Z
2025-08-12T10:19:32.5130713Z test result: FAILED. 999 passed; 1 failed; 16 ignored; 0 measured; 344 filtered out; finished in 105.92s
```
2025-08-14 11:39:39 +02:00
Guillaume Gomez
ad21c6d898
Rollup merge of #145266 - camsteffen:reduce-queries, r=petrochenkov
Reduce some queries around associated items
2025-08-14 11:39:38 +02:00
Guillaume Gomez
952584942c
Rollup merge of #145250 - fmease:regr-test-for-attr-meta-ice, r=jdonszelmann
Add regression test for a former ICE involving helper attributes containing interpolated tokens

Add regression test for rust-lang/rust#140612 from rust-lang/rust#140601 or rather rust-lang/rust#140859 that only added it to `stable` not `master`.
Supersedes https://github.com/rust-lang/rust/pull/140584.

r? `@jdonszelmann` or anyone
2025-08-14 11:39:37 +02:00
Guillaume Gomez
c1f9e2ab50
Rollup merge of #145179 - joshtriplett:number, r=RalfJung
Avoid abbreviating "numerator" as "numer", to allow catching typo "numer" elsewhere

`typos.toml` has an exception for "numer", to avoid flagging its use as an abbreviation for "numerator". Remove the use of that abbrevation, spelling out "numerator" instead, and remove the exception, so that typo checks can find future instances of "numer" as a typo for "number".
2025-08-14 11:39:36 +02:00
Guillaume Gomez
7d91d20df1
Rollup merge of #144959 - Marcondiro:master, r=Mark-Simulacrum
fix(unicode-table-generator): fix duplicated unique indices

unicode-table-generator panicked while populating `distinct_indices` because of duplicated indices. This was introduced in rust-lang/rust#144134, where the order of `canonical_words.push(...)` and `canonical_words.len()` was swapped.

Fixes: rust-lang/rust#144134
2025-08-14 11:39:36 +02:00
Guillaume Gomez
6ac5c28412
Rollup merge of #144727 - Stypox:add-tracing-to-resolve, r=RalfJung
Add tracing to resolve-related functions

Resolve-related functions are not called often but still make up for ~3% of execution time for non-repetitive programs (as seen in the first table below, obtained from running the rust snippet at the bottom with `n=1`). On the other hand, for repetitive programs they become less relevant (I tested the same snippet but with `n=100` and got ~1.5%), and it appears that only `try_resolve` is called more often (see the last two tables).

The first table was obtained by opening the trace file in https://ui.perfetto.dev and running the following query:

```sql
select "TOTAL PROGRAM DURATION" as name, count(*), max(ts + dur) as "sum(dur)", 100.0 as "%", null as "min(dur)", null as "max(dur)", null as "avg(dur)", null as "stddev(dur)" from slices union select "TOTAL OVER ALL SPANS (excluding events)" as name, count(*), sum(dur), cast(cast(sum(dur) as float) / (select max(ts + dur) from slices) * 1000 as int) / 10.0 as "%", min(dur), max(dur), cast(avg(dur) as int) as "avg(dur)", cast(sqrt(avg(dur*dur)-avg(dur)*avg(dur)) as int) as "stddev(dur)" from slices where parent_id is null and name != "frame" and name != "step" and dur > 0 union select name, count(*), sum(dur), cast(cast(sum(dur) as float) / (select max(ts + dur) from slices) * 1000 as int) / 10.0 as "%", min(dur), max(dur), cast(avg(dur) as int) as "avg(dur)", cast(sqrt(avg(dur*dur)-avg(dur)*avg(dur)) as int) as "stddev(dur)" from slices where parent_id is null and name != "frame" and name != "step" group by name order by sum(dur) desc, count(*) desc
```

<img width="1687" height="242" alt="image" src="https://github.com/user-attachments/assets/4d4bd890-869b-40f3-a473-8e4c42b02da4" />

The following two tables show how many `resolve` spans there per subname/subcategory, and how much time is spent in each. The first is for `n=1` and the second for `n=100`. The query that was used is:

```sql
select args.string_value as name, count(*), max(dur), avg(dur), sum(dur) from slices inner join args USING (arg_set_id) where args.key = "args." || slices.name and name = "resolve" group by args.string_value
```

<img width="1688" height="159" alt="image" src="https://github.com/user-attachments/assets/a8749856-c099-492e-a86e-6d67b146af9c" />

<img width="1688" height="159" alt="image" src="https://github.com/user-attachments/assets/ce3ac1b5-5c06-47d9-85a6-9b921aea348e" />

The snippet I tested with Miri to obtain the above traces is:

```rust
fn main() {
    let n: usize = std::env::args().nth(1).unwrap().parse().unwrap();
    let mut v = (0..n).into_iter().collect::<Vec<_>>();
    for i in &mut v {
        *i += 1;
    }
}
```
2025-08-14 11:39:35 +02:00
Guillaume Gomez
31d8277abe
Rollup merge of #144515 - scottmcm:ptr_cast_array, r=Mark-Simulacrum
Implement `ptr_cast_array`

ACP: https://github.com/rust-lang/libs-team/issues/602
Tracking Issue: https://github.com/rust-lang/rust/issues/144514
2025-08-14 11:39:34 +02:00
Guillaume Gomez
4bc1eb737d
Rollup merge of #142741 - a1phyr:fix_unsoundness, r=Mark-Simulacrum
Fix unsoundness in some tests

These tests were marked uninit bytes as initilized, which is unsound. Use initialized `MaybeUninit` instead.
2025-08-14 11:39:33 +02:00
Guillaume Gomez
90a5e62b87
Rollup merge of #142372 - Urgau:improve-remap_path_prefix-doc, r=wesleywiser
Improve `--remap-path-prefix` documentation

This PR improves the `--remap-path-prefix` documentation by:
 - moving it into it's own page
 - adding a small example
 - mentioning that the remapping is best effort[^1]
 - mentioning `link.exe`/PDB issues[^2]
 - mentioning the path separator issue (textual replacement)

r? ``@wesleywiser``

[^1]: [#t-compiler > link.exe leaking paths in Windows PDB @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/link.2Eexe.20leaking.20paths.20in.20Windows.20PDB/near/523343774)
[^2]: [#t-compiler > link.exe leaking paths in Windows PDB @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/link.2Eexe.20leaking.20paths.20in.20Windows.20PDB/near/523331762)
2025-08-14 11:39:33 +02:00
Guillaume Gomez
f676dd8729
Rollup merge of #140434 - a4lg:rustdoc-multi-footnote-refs, r=fmease,GuillaumeGomez
rustdoc: Allow multiple references to a single footnote

Multiple references to a single footnote is a part of GitHub Flavored Markdown syntax (although not explicitly documented as well as regular footnotes, it is implemented in GitHub's fork of CommonMark) and not prohibited by rustdoc.

cf. <587a12bb54/test/extensions.txt (L762-L780)>

However, using it makes multiple `sup` elements with the same `id` attribute, which is invalid per the HTML specification.

Still, not only this is a valid GitHub Flavored Markdown syntax, this is helpful on certain cases and actually tested (accidentally) in `tests/rustdoc/footnote-reference-in-footnote-def.rs`.

This commit keeps track of the number of references per footnote and gives unique ID to each reference.
It also emits *all* back links from a footnote to its references as "↩" (return symbol) plus a numeric list in superscript.

As a known limitation, it assumes that all references to a footnote are rendered (this is not always true if a dangling footnote has one or more references but considered a reasonable compromise).

Also note that, this commit is designed so that no HTML changes will occur unless multiple references to a single footnote is actually used.
2025-08-14 11:39:32 +02:00
StackOverflowExcept1on
3a250b7939
rewrite test with #![no_core] 2025-08-14 12:26:51 +03:00
Timo
ca194053d1
Adjust declare_interior_mutable_const lint's category (#15454)
Per the root readme, `clippy::style` is a category with

> code that should be written in a more idiomatic way

description.

The code this lint guards from may be much worse than badly styled:

```rs
use std::sync::LazyLock;

// `const` instead of `static` causes `dbg!` to be printed 10 times
// instead of one.
const LICENSE_FILE_NAME_REGEX: LazyLock<String> = LazyLock::new(|| {
    dbg!("I am a large regex initialized in a lazy lock!");
    format!("Hello {}", "World".to_string())
});

fn main() {
    for _ in 0..10 {
        let _ = LICENSE_FILE_NAME_REGEX.split(" ");
    }
}
```

In large projects, it's unfortunate but sometimes possible to see style
lints suppressed with

```toml
[workspace.lints.clippy]
style = { level = "allow", priority = -1 }
```

effectively turning off crucial checks for the code like above.

To keep them, promote this lint to `clippy::suspicious`:

> code that is most likely wrong or useless

category that has the same, `warn` default level, thus not failing on
false-positives which lead to
https://github.com/rust-lang/rust-clippy/issues/5863

---

changelog: [`declare_interior_mutable_const`]: promote lint's category
to `clippy::suspicious`
2025-08-14 08:29:55 +00:00
Ralf Jung
2330afab63 Apply suggestions from code review
Co-authored-by: Boxy <rust@boxyuwu.dev>
2025-08-14 09:44:22 +02:00
Ralf Jung
e2cc7757e1 avoid unnecessary type sanity checks 2025-08-14 09:44:22 +02:00
Ralf Jung
dbc030e034 shrink TestBranch::Constant and PatRangeBoundary::Finite 2025-08-14 09:44:22 +02:00
Ralf Jung
a1acbfb050 change StrLit type to ty::Value as well 2025-08-14 09:44:22 +02:00
Ralf Jung
a171eaab42 use ty::Value instead of manual pairs of types and valtrees 2025-08-14 09:44:22 +02:00
Ralf Jung
d61fdbf266 pattern testing: store constants as valtrees 2025-08-14 09:44:19 +02:00
Ralf Jung
3f1e99dca4 PatKind: store constants as valtrees 2025-08-14 09:39:39 +02:00
Vadim Petrochenkov
9b797b9f7a resolve: Improve code reuse in typo candidate collection 2025-08-14 09:53:49 +03:00
Vadim Petrochenkov
d682943396 resolve: Do not show deprecated helper attributes in typo recommendations
Remove one FIXME, addressing it does not reduce the hacky-ness much, and the logic is going to be removed anyway together with the `legacy_derive_helpers` deprecation lint.
2025-08-14 09:53:49 +03:00
Vadim Petrochenkov
51eb5ed8f0 resolve: Do not call resolve_macro_path from late resolution
`maybe_resolve_path` is less precise in corner cases, but it's only used for diagnostics and error recovery, so it's good enough.
2025-08-14 09:53:46 +03:00
Josh Triplett
3ecea538cd bootstrap: Update completions for new --timings argument 2025-08-13 22:53:50 -07:00
Nicholas Nethercote
145b84721a Sometimes skip over tokens in parse_token_tree.
This sometimes avoids a lot of `bump` calls.
2025-08-14 15:31:29 +10:00
Josh Triplett
d10a8a3321 bootstrap: Support passing --timings to cargo
Useful for optimizing the sequencing of the compiler's own build.
2025-08-13 22:02:11 -07:00
Tsukasa OI
74aca53f55 rustdoc: Allow multiple references to a single footnote
Multiple references to a single footnote is a part of GitHub Flavored
Markdown syntax (although not explicitly documented as well as regular
footnotes, it is implemented in GitHub's fork of CommonMark) and not
prohibited by rustdoc.

cf. <587a12bb54/test/extensions.txt (L762-L780)>

However, using it makes multiple "sup" elements with the same "id"
attribute, which is invalid per the HTML specification.

Still, not only this is a valid GitHub Flavored Markdown syntax, this is
helpful on certain cases and actually tested (accidentally) in
tests/rustdoc/footnote-reference-in-footnote-def.rs.

This commit keeps track of the number of references per footnote and gives
unique ID to each reference.  It also emits *all* back links from a footnote
to its references as "↩" (return symbol) plus a numeric list in superscript.

As a known limitation, it assumes that all references to a footnote are
rendered (this is not always true if a dangling footnote has one or more
references but considered a reasonable compromise).

Also note that, this commit is designed so that no HTML changes will occur
unless multiple references to a single footnote is actually used.
2025-08-14 04:39:31 +00:00
bors
2c1ac85679 Auto merge of #145131 - Kobzol:bootstrap-clippy, r=jieyouxu
Enforce in bootstrap that clippy must have stage at least 1

This mostly piggybacks on the previous `x check` [rework](https://github.com/rust-lang/rust/pull/143048).

The new "rules" follow the new staging logic. So `x clippy <foo>` lints `foo` using stage0 Clippy. `x clippy --stage 2 <foo>` lints `foo` using stage1 Clippy (which is built from in-tree sources).

I had to fix some latent issues with `prepare_compiler_for_check` along the way.

Checking `rustc_private` tools should now check less compiler crates (or rather not check compiler examples/tests/etc.), potentially speeding it up slightly.

I also had to make some manual adjustments to `x clippy ci` so that it doesn't do needless work.

r? `@jieyouxu`
2025-08-14 04:23:07 +00:00
yanglsh
05c2d72abc fix: match_ref_pats FP on match scrutinee of never type 2025-08-14 11:23:31 +08:00
León Orell Valerian Liehr
8f472e8b5c
Add regression test for a former ICE involving helper attributes containing interpolated tokens
Co-authored-by: Jana Dönszelmann <jana@donsz.nl>
2025-08-14 03:39:32 +02:00
Zachary S
12b57942d6 Remove TmpLayout in layout_of_enum 2025-08-13 20:26:13 -05:00
bors
e7d8d34eae Auto merge of #144793 - petrochenkov:extprel3, r=davidtwco
resolve: Split extern prelude into two scopes

One scope for `extern crate` items and another for `--extern` options, with the former shadowing the latter.

If in a single scope some things can overwrite other things, especially with ad hoc restrictions like `MacroExpandedExternCrateCannotShadowExternArguments`, then it's not really a single scope.
So this PR splits `Scope::ExternPrelude` into two cleaner scopes.

This is similar to how https://github.com/rust-lang/rust/pull/144131 splits module scope into two scopes for globs and non-globs, but simpler.
2025-08-13 22:52:17 +00:00
bors
8e7795415a Auto merge of #144793 - petrochenkov:extprel3, r=davidtwco
resolve: Split extern prelude into two scopes

One scope for `extern crate` items and another for `--extern` options, with the former shadowing the latter.

If in a single scope some things can overwrite other things, especially with ad hoc restrictions like `MacroExpandedExternCrateCannotShadowExternArguments`, then it's not really a single scope.
So this PR splits `Scope::ExternPrelude` into two cleaner scopes.

This is similar to how https://github.com/rust-lang/rust/pull/144131 splits module scope into two scopes for globs and non-globs, but simpler.
2025-08-13 22:52:17 +00:00
antoyo
27143142de
Merge pull request #747 from GuillaumeGomez/update
Update gccjit dependency and libgccjit commit
2025-08-13 17:33:26 -04:00
sayantn
100d19ce5b
Stabilize sse4a and tbm target features
- remove some stabilized target features from `gate.rs`
2025-08-14 02:07:40 +05:30
Philipp Krones
b3faf62b28
Bump slab from 0.4.10 to 0.4.11 in /clippy_test_deps (#15471)
Bumps [slab](https://github.com/tokio-rs/slab) from 0.4.10 to 0.4.11.

changelog: none
2025-08-13 20:26:59 +00:00
bors
3672a55b7c Auto merge of #145366 - GuillaumeGomez:rollup-v0a6v3u, r=GuillaumeGomez
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#144761 (aarch64: Make `outline-atomics` a known target feature)
 - rust-lang/rust#144949 (More `Printer` cleanups)
 - rust-lang/rust#144955 (search graph: lazily update parent goals)
 - rust-lang/rust#144962 (Add aarch64_be-unknown-none-softfloat target)
 - rust-lang/rust#145153 (Handle macros with multiple kinds, and improve errors)
 - rust-lang/rust#145241 ([AVR] Changed data_layout)
 - rust-lang/rust#145341 (Install libgccjit into the compiler's sysroot when cg_gcc is enabled)
 - rust-lang/rust#145349 (Correctly handle when there are no unstable items in the documented crate)
 - rust-lang/rust#145356 (Add another example for escaped `#` character in doctest in rustdoc book)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-13 19:23:12 +00:00
Sasha Pourcelot
27beb72e87 Port the #[linkage] attribute to the new attribute system 2025-08-13 21:01:37 +02:00
Sasha Pourcelot
d435197afc Port the #[linkage] attribute to the new attribute system 2025-08-13 21:01:37 +02:00
Urgau
7b5d9efb7d Improve --remap-path-prefix documentation
Co-Authored-By: Weihang Lo <me@weihanglo.tw>
Co-Authored-By: Wesley Wiser <wwiser@gmail.com>
2025-08-13 20:20:13 +02:00
StackOverflowExcept1on
f978932903 fix(compiler/rustc_codegen_llvm): apply target-cpu attribute 2025-08-13 17:49:06 +00:00
Ada Alakbarova
e19a11f3ac
misc: import macros explicitly 2025-08-13 19:35:32 +02:00
Ada Alakbarova
bc0e43c0f2
fix borrow_as_ptr: don't lint in proc-macros 2025-08-13 19:35:31 +02:00