304366 Commits

Author SHA1 Message Date
Abderahmane Bouziane
e41fb7ca52 similar_names stop linting for 3-char names 2025-08-16 12:36:50 -04:00
Pascal S. de Kloe
1f77424a79 fmt::DisplayInt abstraction obsolete with better macro 2025-08-16 18:33:20 +02:00
Camille GILLOT
9cd0bf27d8 Only scan each definition once. 2025-08-16 16:28:17 +00:00
Camille Gillot
a84373085e Simplify span_data_to_lines_and_cols. 2025-08-16 16:23:21 +00:00
Camille Gillot
6c15339017 Simplify decode_span. 2025-08-16 16:21:23 +00:00
binarycat
e31fed054b run spellcheck as a tidy extra check in ci 2025-08-16 09:51:44 -05:00
Deadbeef
4335405fa7 overhaul &mut suggestions in borrowck errors 2025-08-16 22:34:17 +08:00
León Orell Valerian Liehr
f8f7c27d4f
Clean up parsers related to generic bounds 2025-08-16 16:15:58 +02:00
Ada Alakbarova
8418fb8eb1
shorten expr_block 2025-08-16 15:56:22 +02:00
Ada Alakbarova
42ddaa3a38
inline ctxt; use eq_ctxt 2025-08-16 15:56:22 +02:00
Ada Alakbarova
27784f29a7
use str::ends_with 2025-08-16 15:56:22 +02:00
Ada Alakbarova
43f832d37b
use Option::is_some_and 2025-08-16 15:56:21 +02:00
Deadbeef
3450975935 remove should_render in PrintAttribute derive 2025-08-16 21:41:39 +08:00
Josh Triplett
1ae4a0cc34 library: Migrate from cfg_if to cfg_select
Migrate the standard library from using the external `cfg_if` crate to
using the now-built-in `cfg_select` macro.

This does not yet eliminate the dependency from
`library/std/Cargo.toml`, because while the standard library itself no
longer uses `cfg_if`, it also incorporates the `backtrace` crate, which
does.

Migration assisted by the following vim command (after selecting the
full `cfg_if!` invocation):

```
'<,'>s/\(cfg_if::\)\?cfg_if/cfg_select/ | '<,'>s/^\( *\)} else {/\1}\r\1_ => {/c | '<,'>s/^\( *\)} else if #\[cfg(\(.*\))\] /\1}\r\1\2 => /e | '<,'>s/if #\[cfg(\(.*\))\] {/\1 => {/e
```

This is imperfect, but substantially accelerated the process. This
prompts for confirmation on the `} else {` since that can also appear
inside one of the arms. This also requires manual intervention to handle
any multi-line conditions.
2025-08-16 05:28:31 -07:00
Urgau
e906a59ebb Fix unicode_data.rs mention message 2025-08-16 12:55:23 +02:00
bors
cdcce5a137 Auto merge of #145304 - m-ou-se:simplify-panic, r=oli-obk
Revert "Partially outline code inside the panic! macro".

This reverts https://github.com/rust-lang/rust/pull/115670

Without any tests/benchmarks that show some improvement, it's hard to know whether the change had any positive effect. (And if it did, whether that effect is still achieved today.)
2025-08-16 10:15:46 +00:00
bors
2e2642e641 Auto merge of #145304 - m-ou-se:simplify-panic, r=oli-obk
Revert "Partially outline code inside the panic! macro".

This reverts https://github.com/rust-lang/rust/pull/115670

Without any tests/benchmarks that show some improvement, it's hard to know whether the change had any positive effect. (And if it did, whether that effect is still achieved today.)
2025-08-16 10:15:46 +00:00
Jakub Beránek
814b8e682c
Only check std in cross-compilation instead of building it 2025-08-16 11:24:19 +02:00
Jana Dönszelmann
70e26c1b7b
take attr style into account in attr diagnostics 2025-08-16 10:51:09 +02:00
Jakub Beránek
ddf39cabf2
Avoid copying rustc rmeta artifacts into the build compiler sysroot
This helps to avoid polluting the sysroot of the build compiler.
2025-08-16 09:49:18 +02:00
Jonathan Brouwer
a69ba29a0f
Fix deprecation attribute on foreign statics & types 2025-08-16 09:44:43 +02:00
Jonathan Brouwer
e8f90b12fc
Don't show foreign types as an allowed target if the feature is not enabled 2025-08-16 09:44:39 +02:00
Mu001999
5e8c2c3aec Add parentheses for closure when suggesting calling closure 2025-08-16 15:07:38 +08:00
Mu001999
57feb7fc01 old testcase output 2025-08-16 15:01:17 +08:00
Jakub Beránek
cdea62dc44
Optimize copy_src_dirs 2025-08-16 08:57:05 +02:00
Jakub Beránek
5107ac92bb
Do not call fs::remove_file in cp_link_filtered_recurse
The target is removed by `copy_link` too, so no need to duplicate the syscall.
2025-08-16 08:56:41 +02:00
Zalathar
cf8ec6798f Remove LlvmArchiveBuilder and supporting code/bindings 2025-08-16 16:38:12 +10:00
Timo
aa8b09d468
clean-up unnecessary_unwrap a bit (#15489)
changelog: none
2025-08-16 01:24:43 +00:00
Ada Alakbarova
a8b52bacfe
clean-up unnecessary_unwrap a bit
replace multiple `if-let`s with `match`

turn the condition into a match guard

allows removing the `else` branch

replace `Vec::append` with `extend`

don't need the second vec after this operation anyway

remove `return`s
2025-08-16 03:03:53 +02:00
León Orell Valerian Liehr
eb3e0d4c8a
Properly recover from parenthesized use-bounds (precise capturing) 2025-08-16 01:21:35 +02:00
bors
1ae7c49072 Auto merge of #145475 - jhpratt:rollup-jr0wado, r=jhpratt
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#143717 (Add `Default` impls for `Pin`ned `Box`, `Rc`, `Arc`)
 - rust-lang/rust#144054 (Stabilize as_array_of_cells)
 - rust-lang/rust#144907 (fix: Reject async assoc fns of const traits/impls in ast_passes)
 - rust-lang/rust#144922 (Implement `#[derive(From)]`)
 - rust-lang/rust#144963 (Stabilize `core::iter::chain`)
 - rust-lang/rust#145436 (fix(tests/rmake/wasm-unexpected-features): change features from `WASM1` to `MVP`)
 - rust-lang/rust#145453 (Remove duplicated tracing span in bootstrap)
 - rust-lang/rust#145454 (Fix tracing debug representation of steps without arguments in bootstrap)
 - rust-lang/rust#145455 (Do not copy files in `copy_src_dirs` in dry run)
 - rust-lang/rust#145462 (Stabilize `const_exposed_provenance` feature)
 - rust-lang/rust#145466 (Enable new `[range-diff]` feature in triagebot)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-15 23:10:31 +00:00
Alan Urmancheev
9fab380839
Fix typo in doc for library/std/src/fs.rs#set_permissions
"privalage" -> "privilege"
2025-08-16 02:30:18 +04:00
Jacob Pratt
cf28e2b0d5
Rollup merge of #145466 - Urgau:triagebot-range-diff, r=Kobzol
Enable new `[range-diff]` feature in triagebot

This new feature adds a comment to triagebot range-diff feature when a PR is rebased  onto a different base/master commit.

Related to [#t-compiler > Experimental range-diff for force-push @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Experimental.20range-diff.20for.20force-push/near/534649322)

r? Kobzol
2025-08-15 18:13:33 -04:00
Jacob Pratt
2a9bb562ff
Rollup merge of #145462 - Kivooeo:stabilize-const_exposed_provenance, r=RalfJung
Stabilize `const_exposed_provenance` feature

This closes [tracking issue](https://github.com/rust-lang/rust/issues/144538) and stabilises `fn with_exposed_provenance` and `fn with_exposed_provenance_mut` in const
2025-08-15 18:13:32 -04:00
Jacob Pratt
56e9a67d16
Rollup merge of #145455 - Kobzol:bootstrap-copy-src-dirs-dry-run, r=jieyouxu
Do not copy files in `copy_src_dirs` in dry run

This reduces the time to run the current 9 dist snapshot tests from ~24s to ~2s on my PC.

r? `@jieyouxu`
2025-08-15 18:13:32 -04:00
Jacob Pratt
4fa90ef799
Rollup merge of #145454 - Kobzol:bootstrap-fix-step-debug-repr, r=jieyouxu
Fix tracing debug representation of steps without arguments in bootstrap

I was wondering why I see `lainSourceTarbal` in tracing logs...

r? `@jieyouxu`
2025-08-15 18:13:31 -04:00
Jacob Pratt
71adb87994
Rollup merge of #145453 - Kobzol:bootstrap-cmd-span, r=jieyouxu
Remove duplicated tracing span in bootstrap

`trace_cmd` is now called also in the `stream` method, so including it also here was duplicating command spans.

r? `@jieyouxu`
2025-08-15 18:13:31 -04:00
Jacob Pratt
58c08c512b
Rollup merge of #145436 - StackOverflowExcept1on:patch-1, r=alexcrichton
fix(tests/rmake/wasm-unexpected-features): change features from `WASM1` to `MVP`

missed this in rust-lang/rust#145275
since test calls `rustc` with  `-C target-cpu mvp`
try-job: `test-various`
2025-08-15 18:13:30 -04:00
Jacob Pratt
2776a21a4f
Rollup merge of #144963 - rossmacarthur-forks:stabilize-core-iter-chain, r=jhpratt
Stabilize `core::iter::chain`

Closes rust-lang/rust#125964
2025-08-15 18:13:29 -04:00
Jacob Pratt
2b1a288dfc
Rollup merge of #144922 - Kobzol:derive-from, r=nnethercote
Implement `#[derive(From)]`

Implements the `#[derive(From)]` feature ([tracking issue](https://github.com/rust-lang/rust/issues/144889), [RFC](https://github.com/rust-lang/rfcs/pull/3809)).

It allows deriving the `From` impl on structs and tuple structs with exactly one field. Some implementation notes:
- I wasn't exactly sure which spans to use in the derive generating code, so I just used `span` everywhere. I don't know if it's the Right Thing To Do. In particular the errors when `#[derive(From)]` is used on a struct with an unsized field are weirdly duplicated.
- I had to solve an import stability problem, where if I just added the unstable `macro From` to `core::convert`, previously working code like `use std::convert::From` would suddenly require an unstable feature gate, because rustc would think that you're trying to import the unstable macro. `@petrochenkov` suggested that I add the macro the the core prelude instead. This has worked well, although it only works in edition 2021+. Not sure if I botched the prelude somehow and it should live elsewhere (?).
- I had to add `Ty::AstTy`, because the `from` function receives an argument with the type of the single field, and the existing variants of the `Ty` enum couldn't represent an arbitrary type.
2025-08-15 18:13:28 -04:00
Jacob Pratt
d077146a15
Rollup merge of #144907 - ShoyuVanilla:no-const-async, r=fmease
fix: Reject async assoc fns of const traits/impls in ast_passes

Fixes rust-lang/rust#117629
2025-08-15 18:13:28 -04:00
Jacob Pratt
7a05f26a3b
Rollup merge of #144054 - jsimmons:stabilize-as-array-of-cells, r=tgross35
Stabilize as_array_of_cells

This PR stabilizes

```rust
impl<T, const N: usize> Cell<[T; N]> {
    pub const fn as_array_of_cells(&self) -> &[Cell<T>; N];
}
```

Stabilization report: https://github.com/rust-lang/rust/issues/88248#issuecomment-3082986863
Closes: https://github.com/rust-lang/rust/issues/88248
2025-08-15 18:13:27 -04:00
Jacob Pratt
41e40f3630
Rollup merge of #143717 - Jules-Bertholet:pin-default, r=dtolnay
Add `Default` impls for `Pin`ned `Box`, `Rc`, `Arc`

Fixes rust-lang/rust#143688.

`@rustbot` label T-libs-api needs-fcp

Also needs a crater run, as the `Box` impls could theoretically be breaking due to `#[fundamental]` (though a [cursory search](https://github.com/search?q=%2Fimpl%28%3C.*%3E%29%3F+Default+for+Pin%3C%2F+path%3A*.rs&type=code) suggests this is unlikely to cause issues).
2025-08-15 18:13:26 -04:00
bors
cd7cbe818e Auto merge of #142071 - lcnr:revealing-use, r=compiler-errors
`apply_member_constraints`: fix placeholder check

Checking whether the member region is *an existential region from a higher universe* is just wrong and I am pretty sure we've added that check by accident as the naming was just horribly confusing before rust-lang/rust#140466.

I've encountered this issue separately while working on rust-lang/rust#139587, but feel like it's probably easier to separately FCP this change. This allows the following code to compile
```rust
trait Proj<'a> {
    type Assoc;
}
impl<'a, 'b, F: FnOnce() -> &'b ()> Proj<'a> for F {
    type Assoc = ();
}

fn is_proj<F: for<'a> Proj<'a>>(f: F) {}
fn define<'a>() -> impl Sized + use<'a> {
    // This adds a use of `opaque::<'a>` with hidden type `&'unconstrained_b ()`.
    // 'unconstrained_b is an inference variable from a higher universe as it gets
    // created inside of the binder of `F: for<'a> Proj<'a>`. This previously
    // caused us to not apply member constraints. We now do, constraining
    // it to `'a`.
    is_proj(define::<'a>);
    &()
}

fn main() {}
```

This should not be breaking change, even in theory. Applying member constraints is incomplete in rare circumstances which means that applying them in more cases can cause spurious errors, cc rust-lang/rust#140569/rust-lang/rust#142073. However, as we always skipped these member regions in `apply_member_constraints` the skipped region is guaranteed to cause an error in `check_member_constraints` later on.
2025-08-15 18:52:12 +00:00
Michael Howell
8511e40e72 rustdoc-search: search backend with partitioned suffix tree 2025-08-15 10:26:03 -07:00
Kivooeo
b951b5dca1 stabilize strict provenance atomic ptr 2025-08-15 16:56:11 +00:00
Urgau
cd37ed50fa Enable new [range-diff] feature in triagebot 2025-08-15 18:47:48 +02:00
Kivooeo
b79ab4461d stabilize const pathbuf osstring new 2025-08-15 16:36:06 +00:00
Kivooeo
5ee2224daa stabilize const exposed provenance 2025-08-15 16:19:19 +00:00
Samuel Moelius
c3c2c23e0d Extend QueryStability to handle IntoIterator implementations
Fix adjacent code

Fix duplicate warning; merge test into `tests/ui-fulldeps/internal-lints`

Use `rustc_middle::ty::FnSig::inputs`

Address two review comments

- https://github.com/rust-lang/rust/pull/139345#discussion_r2109006991
- https://github.com/rust-lang/rust/pull/139345#discussion_r2109058588

Use `Instance::try_resolve`

Import `rustc_middle::ty::Ty` as `Ty` rather than `MiddleTy`

Simplify predicate handling

Add more `#[allow(rustc::potential_query_instability)]` following rebase

Remove two `#[allow(rustc::potential_query_instability)]` following rebase

Address review comment

Update compiler/rustc_lint/src/internal.rs

Co-authored-by: lcnr <rust@lcnr.de>
2025-08-15 12:10:54 -04:00