Commit Graph

286135 Commits

Author SHA1 Message Date
Yotam Ofek
9491242ff7 Cleanup the InstSimplify MIR transformation 2025-04-10 18:40:25 +00:00
bors
69b3959afe Auto merge of - matthiaskrgr:rollup-8ri1vid, r=matthiaskrgr
Rollup of 13 pull requests

Successful merges:

 -  (Small code improvement in rustdoc hidden stripper)
 -  (Clean up librustdoc::html::render to be better encapsulated)
 -  (Suppress missing field error when autoderef bottoms out in infer)
 -  (match ergonomics: replace `peel_off_references` with a recursive call)
 -  (compiletest: Trim whitespace from environment variable names)
 -  (Remove some dead or leftover code related to rustc-intrinsic abi removal)
 -  (fix title of offset_of_enum feature)
 -  (emit a better error message for using the macro incorrectly)
 -  (Don't use empty trait names)
 -  (Temporarily leave the review rotation)
 -  (saethlin is back from vacation)
 -  (rustdoc: Enable Markdown extensions when looking for doctests)
 -  (Tracking issue template: fine-grained information on style update status)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-10 12:18:24 +00:00
Matthias Krüger
b14671e1bd
Rollup merge of - joshtriplett:style-tracking, r=traviscross
Tracking issue template: fine-grained information on style update status

Inspired by some of the communication issues around the stabilization of
`let`-chains, give more fine-grained information about the status of
updating style for any new syntax.

This does not change the process or blockers in any way; it only
*documents* the current state in the tracking issue. For instance, in
the case of `let`-chains, we would have checked the boxes for "Style
team decision" and "(non-blocking) Formatting has been implemented", and
not checked the box for the style guide. That would have then provided
better supporting information for any decisions.
2025-04-10 11:10:20 +02:00
Matthias Krüger
d7171bc8ce
Rollup merge of - camelid:doctest-md-opts, r=notriddle
rustdoc: Enable Markdown extensions when looking for doctests

Fixes .

We should enable these to avoid misinterpreting uses of the extended
syntax as code blocks. This happens in practice with multi-paragraph
footnotes, as discovered in .
2025-04-10 11:10:19 +02:00
Matthias Krüger
e3bcfbf3cf
Rollup merge of - saethlin:vacation, r=camelid
saethlin is back from vacation
2025-04-10 11:10:19 +02:00
Matthias Krüger
c100846574
Rollup merge of - fmease:unrotate, r=fmease
Temporarily leave the review rotation

r? ghost
2025-04-10 11:10:18 +02:00
Matthias Krüger
7509b4652c
Rollup merge of - nnethercote:empty-trait-name, r=compiler-errors
Don't use empty trait names

Helps with . Details in individual commits.

r? ```@davidtwco```
2025-04-10 11:10:17 +02:00
Matthias Krüger
e8994abe52
Rollup merge of - EnzymeAD:better-autodiff-err, r=jieyouxu
emit a better error message for using the macro incorrectly

fixing: https://github.com/EnzymeAD/rust/issues/185
I feel like it's not a perfect message either, so I'm open to suggestions.
But at the end of the day users will need to read the docs anyway, and emitting
multi-line errors each time this gets triggered can probably become annoying?

r? ``@jieyouxu`` since you've reviewed my frontend work back in the days.

Tracking:

- https://github.com/rust-lang/rust/issues/124509
2025-04-10 11:10:17 +02:00
Matthias Krüger
12172ebf70
Rollup merge of - programmerjake:patch-5, r=jieyouxu
fix title of offset_of_enum feature

tracking issue 
2025-04-10 11:10:16 +02:00
Matthias Krüger
c808b20360
Rollup merge of - oli-obk:rustc-intrinsic-cleanup, r=RalfJung
Remove some dead or leftover code related to rustc-intrinsic abi removal

r? ```@RalfJung```

PR that removed the ABI: https://github.com/rust-lang/rust/pull/139455

tracking issue: https://github.com/rust-lang/rust/issues/132735
2025-04-10 11:10:16 +02:00
Matthias Krüger
2b0e47eb4c
Rollup merge of - Zalathar:trim-env-name, r=jieyouxu
compiletest: Trim whitespace from environment variable names

When a test contains a directive like `//@ exec-env: FOO=bar`, compiletest currently includes that leading space in the name of the environment variable, so it is defined as ` FOO` instead of `FOO`.

This is an annoying footgun that is pretty much never intended, especially since most other directives *do* trim whitespace. So let's get rid of it by trimming the environment variable name.

Values remain untrimmed, since there could conceivably be a use-case for values with leading space, but perhaps we'll end up trimming values too in the future.

Recently observed in https://github.com/rust-lang/rust/pull/138603#issuecomment-2783709359.

Fixes .
Supersedes .

---

try-job: test-various
2025-04-10 11:10:15 +02:00
Matthias Krüger
7f08e638c4
Rollup merge of - Nadrieril:peel-recursive, r=lcnr
match ergonomics: replace `peel_off_references` with a recursive call

This makes it imo quite a bit easier to follow how the binding mode gets calculated.

cc ```@dianne```
2025-04-10 11:10:14 +02:00
Matthias Krüger
b131828f0d
Rollup merge of - compiler-errors:field-autoderef, r=oli-obk
Suppress missing field error when autoderef bottoms out in infer

I see this error repeatedly when doing refactorings, and it's pretty misleading b/c it's not the source of the error.
2025-04-10 11:10:14 +02:00
Matthias Krüger
aecce2161d
Rollup merge of - xizheyin:issue-138567, r=GuillaumeGomez
Clean up librustdoc::html::render to be better encapsulated

Closes 
2025-04-10 11:10:13 +02:00
Matthias Krüger
070148acf1
Rollup merge of - GuillaumeGomez:rustdoc-hidden-stripper-improvement, r=camelid
Small code improvement in rustdoc hidden stripper

This is a very minor code improvement following https://github.com/rust-lang/rust/pull/137534. It doesn't change anything about the performance issue.

r? ```@notriddle```
2025-04-10 11:10:13 +02:00
bors
7d7de5bf3c Auto merge of - spastorino:ergonomic-ref-counting-2, r=nikomatsakis
Ergonomic ref counting: optimize away clones when possible

This PR build on top of https://github.com/rust-lang/rust/pull/134797. It optimizes codegen of ergonomic ref-counting when the type being `use`d is only known to be copy after monomorphization. We avoid codening a clone and generate bitwise copy instead.

RFC: https://github.com/rust-lang/rfcs/pull/3680
Tracking issue: https://github.com/rust-lang/rust/issues/132290
Project goal: https://github.com/rust-lang/rust-project-goals/issues/107

r? `@nikomatsakis`

This PR could better sit on top of https://github.com/rust-lang/rust/pull/131650 but as it did not land yet I've decided to just do minimal changes. It may be the case that doing what I'm doing regress the performance and we may need to go the full route of https://github.com/rust-lang/rust/pull/131650.
cc `@saethlin` in this regard.
2025-04-10 09:08:23 +00:00
bors
9d28fe3976 Auto merge of - compiler-errors:rigid-missing-item, r=lcnr
Rigidly project missing item due to guaranteed impossible sized predicate

This is a somewhat involved change, but it amounts to treating missing impl items due to guaranteed impossible where clauses (dyn/str/slice sized, cc ) as *rigid projections* rather than projecting to an error term, since that was preventing either reporting a proper error (in an empty param env) *or* successfully type checking the code (in the presence of trivially false where clauses).

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

r? `@lcnr` `@oli-obk`
2025-04-10 04:03:59 +00:00
bors
6813f955a6 Auto merge of - BoxyUwU:bump-boostrap, r=jieyouxu
Bump boostrap compiler to new beta

try-job: `*msvc*`
2025-04-10 00:43:25 +00:00
bors
51548ce71f Auto merge of - matthiaskrgr:rollup-kaa8aim, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 -  (Test interaction between RFC 2229 migration and use closures)
 -  (Add more ergonomic clone tests)
 -  (std: improve documentation for get_mut() methods regarding forgotten guards)
 -  (Add missing regression GUI test)
 -  (compiletest: Add directive `dont-require-annotations`)
 -  (Report higher-ranked trait error when higher-ranked projection goal fails in new solver)
 -  (triagebot: roll compiler reviewers for rustc/unstable book)
 -  (Update `u8`-to-and-from-`i8` suggestions.)
 -  (report call site of inlined scopes for large assignment lints)
 -  (Remove redundant words)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-09 21:35:22 +00:00
Michael Goulet
6cd724bb43 Make unnormalizable item ambiguous in coherence 2025-04-09 20:31:58 +00:00
Michael Goulet
830aeb6102 Use a query rather than recomputing the tail repeatedly 2025-04-09 20:26:58 +00:00
Michael Goulet
ccdfd310be Mark GAT WC as GoalSource::AliasWellFormed so that we recurse into them in error reporting 2025-04-09 20:26:57 +00:00
Michael Goulet
27836e1e57 Rigidly project missing item due to guaranteed impossible sized predicate 2025-04-09 20:26:57 +00:00
Josh Triplett
7103aea39a Tracking issue template: fine-grained information on style update status
Inspired by some of the communication issues around the stabilization of
`let`-chains, give more fine-grained information about the status of
updating style for any new syntax.

This does not change the process or blockers in any way; it only
*documents* the current state in the tracking issue. For instance, in
the case of `let`-chains, we would have checked the boxes for "Style
team decision" and "(non-blocking) Formatting has been implemented", and
not checked the box for the style guide. That would have then provided
better supporting information for any decisions.
2025-04-09 12:59:37 -07:00
Matthias Krüger
7aab307541
Rollup merge of - timesince:master, r=wesleywiser
Remove redundant words

Remove redundant words
2025-04-09 20:23:13 +02:00
Matthias Krüger
e962e52725
Rollup merge of - jogru0:121672, r=oli-obk
report call site of inlined scopes for large assignment lints

Addressed issue: 
Tracking issue: 

r? `@oli-obk`

I tried to follow your comment about what to do [here](https://github.com/rust-lang/rust/issues/121672#issuecomment-1972783675). However, I'm totally unfamiliar with the code so far (this is my first contribution touching compiler code), so I apologize in advance if I did something stupid 😅

In particular, I'm not sure I use the _correct_ source scope to look for inline data, as there is a whole `IndexVec` of them. My changes definitely did something, as can be seen by the added ui test. However, the result is not as anticipated in the issue:
```
LL |     let cell = std::cell::UnsafeCell::new(data);
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ value moved from here
```
instead of
```
LL |     let cell = std::cell::UnsafeCell::new(data);
   |                                           ^^^^ value moved from here
```
raising my suspicion that maybe I got the wrong source scope.
2025-04-09 20:23:12 +02:00
Matthias Krüger
a8b0d56f6f
Rollup merge of - bjoernager:master, r=tgross35
Update `u8`-to-and-from-`i8` suggestions.

`u8::cast_signed` and `i8::cast_unsigned` have been stabilised, but `i8::from_ne_bytes` et al. still suggest using `as i8` or `as u8`.
2025-04-09 20:23:12 +02:00
Matthias Krüger
78e59af997
Rollup merge of - jieyouxu:compiler-doc-reviewers, r=GuillaumeGomez,ehuss
triagebot: roll compiler reviewers for rustc/unstable book

r? compiler
2025-04-09 20:23:11 +02:00
Matthias Krüger
584cd13924
Rollup merge of - compiler-errors:higher-ranked-proj, r=lcnr
Report higher-ranked trait error when higher-ranked projection goal fails in new solver

~~See HACK comment inline. Not actually sure if it should be marked as a *HACK*, b/c~~ it's kinda a legitimate case we want to care about unless we're going to make the proof tree visitor *smarter* about the leak check than the actual trait solver itself.

Encountered this while battling with `NiceRegionError`s in the old solver b/c I wondered what this code ended up giving us in the *new* solver as a comparison:
```rust
trait Foo {}

impl<T: FnOnce(&())> Foo for T {}

fn baz<T: Foo>() {}

fn main() {
    baz::<fn(&'static ())>();
}
```

On master it's pretty bad:
```
error[E0271]: type mismatch resolving `<fn(&()) as FnOnce<(&(),)>>::Output == ()`
 --> <source>:8:11
  |
8 |     baz::<fn(&'static ())>();
  |           ^^^^^^^^^^^^^^^ types differ
  |
note: required for `fn(&'static ())` to implement `Foo`
 --> <source>:3:22
  |
3 | impl<T: FnOnce(&())> Foo for T {}
  |         -----------  ^^^     ^
  |         |
  |         unsatisfied trait bound introduced here
```

After this PR it's much better:
```
error[E0277]: the trait bound `fn(&'static ()): Foo` is not satisfied
 --> /home/mgx/test.rs:8:11
  |
8 |     baz::<fn(&'static ())>();
  |           ^^^^^^^^^^^^^^^ the trait `for<'a> FnOnce(&'a ())` is not implemented for `fn(&'static ())`
  |
  = note: expected a closure with arguments `(&'static (),)`
             found a closure with arguments `(&(),)`
note: required for `fn(&'static ())` to implement `Foo`
 --> /home/mgx/test.rs:3:22
  |
3 | impl<T: FnOnce(&())> Foo for T {}
  |         -----------  ^^^     ^
  |         |
  |         unsatisfied trait bound introduced here
note: required by a bound in `baz`
 --> /home/mgx/test.rs:5:11
  |
5 | fn baz<T: Foo>() {}
  |           ^^^ required by this bound in `baz`
```

r? lcnr
2025-04-09 20:23:11 +02:00
Matthias Krüger
4911635ec3
Rollup merge of - petrochenkov:noreqann, r=jieyouxu
compiletest: Add directive `dont-require-annotations`

for making matching on specific diagnostic kinds non-exhaustive.

E.g. `//@ dont-require-annotations:ERROR`, like in the examples in this PR.

cc https://github.com/rust-lang/rust/pull/139427#issuecomment-2782827583

Closes  FYI `@BoxyUwU` since you've wanted this.

r? `@jieyouxu`
2025-04-09 20:23:10 +02:00
Matthias Krüger
ac41b940f2
Rollup merge of - GuillaumeGomez:add-missing-gui-test, r=camelid
Add missing regression GUI test

Add missing GUI test for  (and also fixes the invalid CSS).

cc `@lolbinarycat`
r? `@notriddle`
2025-04-09 20:23:10 +02:00
Matthias Krüger
d5f930fe76
Rollup merge of - xizheyin:issue-139034, r=joboet
std: improve documentation for get_mut() methods regarding forgotten guards

Fixes 

This PR improves the documentation for `get_mut()` methods in `Mutex`, `RefCell`, and `RwLock` to clarify their behavior when lock guards are forgotten (e.g., via std::mem::forget).

The current documentation for these methods states that a mutable borrow "statically guarantees no locks exist", which is not entirely accurate. While a mutable borrow prevents new locks from being created, it does not clear or detect previously abandoned locks through `forget()`. This can lead to counterintuitive behavior:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=e68cefec12dcd435daf2237c16824ed3
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=81263ad652c752afd63c903113d3082c
https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=311baa4edb3abf82a25c8d7bf21a4a52

r? libs
2025-04-09 20:23:09 +02:00
Matthias Krüger
3507f359b1
Rollup merge of - spastorino:add-more-ergonomic-clone-tests, r=nikomatsakis
Add more ergonomic clone tests

I've added some extra tests.

r? `@nikomatsakis`
2025-04-09 20:23:09 +02:00
Matthias Krüger
2b28e6be5a
Rollup merge of - spastorino:test-rfc2229-and-ergonomic-clones, r=nikomatsakis
Test interaction between RFC 2229 migration and use closures

r? `@nikomatsakis`

Fixes 
2025-04-09 20:23:08 +02:00
bors
934880f586 Auto merge of - lincot:speed-up-string-push-and-string-insert, r=tgross35
speed up `String::push` and `String::insert`

Addresses the concerns described in .

The performance gain comes mainly from avoiding temporary buffers.

Complex pattern matching in `encode_utf8` (introduced in ) has been simplified to a comparison and an exhaustive `match` in the `encode_utf8_raw_unchecked` helper function. It takes a slice of `MaybeUninit<u8>` because otherwise we'd have to construct a normal slice to uninitialized data, which is not desirable, I guess.

Several functions still have that [unneeded zeroing](https://rust.godbolt.org/z/5oKfMPo7j), but a single instruction is not that important, I guess.

`@rustbot` label T-libs C-optimization A-str
2025-04-09 17:58:25 +00:00
Michael Goulet
f6faaee372 Report higher-ranked trait error when higher-ranked projection goal fails in new solver 2025-04-09 17:53:32 +00:00
Noah Lev
8b227a42fa rustdoc: Enable Markdown extensions when looking for doctests
We should enable these to avoid misinterpreting uses of the extended
syntax as code blocks. This happens in practice with multi-paragraph
footnotes, as discovered in .
2025-04-09 13:04:57 -04:00
Ben Kimock
67ff33666f
saethlin is back from vacation 2025-04-09 12:03:28 -04:00
bors
48f89e7659 Auto merge of - matthiaskrgr:rollup-d6hph16, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 -  (Try not to use verbatim paths in `Command::current_dir`)
 -  (Make `cfg_match!` a semitransparent macro)
 -  (Promise `array::from_fn` is generated in order of increasing indices)
 -  (Make the compiler suggest actual paths instead of visible paths if the visible paths are through any doc hidden path.)
 -  (Don't call `Span::with_parent` on the good path in `has_stashed_diagnostic`)
 -  (Add job summary links to post-merge report)
 -  (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-04-09 14:48:05 +00:00
Matthias Krüger
1aa6f70e3e
Rollup merge of - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2025-04-09 14:52:39 +02:00
Matthias Krüger
704d301b43
Rollup merge of - Kobzol:post-merge-links, r=marcoieni
Add job summary links to post-merge report

This should make it much easier to investigate the individual job test/duration changes.

The GitHub API handling is a bit crude, but I didn't want to include octocrab, because it more than doubles the current number of dependencies of `citool`...

Can be tested with:
```bash
$ cargo run --manifest-path src/ci/citool/Cargo.toml post-merge-report bad13a970a 1e008dd5d8
```

r? ```@marcoieni```
2025-04-09 14:52:39 +02:00
Matthias Krüger
db7e32c074
Rollup merge of - compiler-errors:has_stashed_diagnostic, r=oli-obk
Don't call `Span::with_parent` on the good path in `has_stashed_diagnostic`

More unnecessary incurred span tracking avoided by not calling `span.with_parent(None)`. This is useless on its own but makes it much easier to fix other "span tracking on the good path" issues in the future.

r? oli-obk
2025-04-09 14:52:38 +02:00
Matthias Krüger
7494bd9a4f
Rollup merge of - Kohei316:feat/doc-hidden-suggestion, r=nnethercote
Make the compiler suggest actual paths instead of visible paths if the visible paths are through any doc hidden path.

close 
Currently, when emitting a diagnostic about a valid trait, the compiler suggestes using visible paths of the trait even if they are through a doc hidden path. This PR updates the compiler to suggest actual paths in these cases.
2025-04-09 14:52:37 +02:00
Matthias Krüger
4d1a63975c
Rollup merge of - scottmcm:from_fn_docs, r=Amanieu
Promise `array::from_fn` is generated in order of increasing indices

Fixes 

I agree this needs to be documented because of the `FnMut`, either with a guarantee or to explicitly disclaim one.

I'm pretty sure this will be non-controversial (like the other "well sure you *could* do it in a different order, but why?" things were), but I couldn't find any previous libs-api decision on it so it's seemingly a new promise that will need FCP.

Basically, yes, it would be plausible to fill in the reverse order, but there's no obvious way we could ever know that that might even be a good idea, so forward seems like an easy thing to promise.  We could always add a `from_fn_rev` or something later if there's ever a strong enough need, but it seems unlikely.

Let's just do the obvious thing so it matches what `[gen(0), gen(1), …, gen(N-1)]` does.
2025-04-09 14:52:37 +02:00
Matthias Krüger
19d4d9f371
Rollup merge of - CAD97:cfg_match_semitransparent, r=dtolnay
Make `cfg_match!` a semitransparent macro

IIUC this is preferred when (potentially) stabilizing `macro` items, to avoid potentially utilizing def-site hygiene instead of mixed-site.

Tracking issue: 
2025-04-09 14:52:36 +02:00
Matthias Krüger
9e541c4673
Rollup merge of - ChrisDenton:command-curdir, r=tgross35
Try not to use verbatim paths in `Command::current_dir`

If possible, we should try not to use verbatim paths in `Command::current_dir`. It might work but it might also break code in the subprocess that assume the current directory isn't verbatim (including Windows APIs). cc ``@ehuss``

Side note: we now have a lot of ad-hoc fixes like this spread about the place. It'd be good to make a proper `WindowsPath` type that handles all this in one place. But that's a bigger job for another PR.
2025-04-09 14:52:36 +02:00
xizheyin
32c8f7dbcf
librustdoc: remove IndexItem::new, use previous fields constructor
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-09 20:51:52 +08:00
León Orell Valerian Liehr
cf68565313
Temporarily leave the review rotation 2025-04-09 13:48:39 +02:00
Boxy
5a5bda52f0 Update boostrap 2025-04-09 12:33:09 +01:00
Boxy
acf678bd4c intra-doc link 2025-04-09 12:29:59 +01:00