Commit graph

312090 commits

Author SHA1 Message Date
Zalathar
ac437169ec coverage: Store branch spans in the expansion tree 2025-11-30 18:31:55 +11:00
Zalathar
61c923b765 coverage: Store fn_sig_span and body_span in the expansion tree 2025-11-30 18:31:55 +11:00
Zalathar
a3bf870441 coverage: Test some edge cases involving macro expansion 2025-11-30 18:31:54 +11:00
bors
3ff30e7eaf Auto merge of #149462 - matthiaskrgr:rollup-vfwin7f, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#148746 (const validation: remove check for mutable refs in final value of const)
 - rust-lang/rust#148765 (std: split up the `thread` module)
 - rust-lang/rust#149454 (resolve: Identifier resolution refactorings)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-29 20:11:02 +00:00
Matthias Krüger
b35b187110
Rollup merge of #149454 - petrochenkov:openapi0, r=eholk
resolve: Identifier resolution refactorings

Mostly splitting large functions into smaller functions, including some parts from https://github.com/rust-lang/rust/pull/144131, there should be no functional changes.
See individual commits.
2025-11-29 20:54:06 +01:00
Matthias Krüger
c93801cb20
Rollup merge of #148765 - joboet:split-up-thread, r=ChrisDenton
std: split up the `thread` module

Almost all functionality in `std::thread` is currently implemented in `thread/mod.rs`, resulting in a *huge* file with more than 2000 lines and multiple, interoperating `unsafe` sections. This PR splits the file up into multiple different private modules, each implementing mostly independent parts of the functionality. The only remaining `unsafe` interplay is that of the `lifecycle` and `scope` modules, the `spawn_scoped` implementation relies on the live thread count being updated correctly by the `lifecycle` module.

This PR contains no functional changes and only moves code around for the most part, with a few notable exceptions:
* `with_current_name` is moved to the already existing `current` module and now uses the `name` method instead of calculating the name from private fields. The old code was just a reimplementation of that method anyway.
* The private `JoinInner` type used to implement both join handles now has some more methods (`is_finished`, `thread` and the `AsInner`/`IntoInner` implementations) to avoid having to expose private fields and their invariants.
* The private `spawn_unchecked_` (note the underscore) method of `Builder` is now a freestanding function in `lifecycle`.

The rest of the changes are just visibility annotations.

I realise this PR ended up quite large – let me know if there is anyway I can aid the review process.

Edit: I've simplified the diff by adding an intermediate commit that creates all the new files by duplicating `mod.rs`. The actual changes in the second commit thus appear to delete the non-relevant parts from the respective file.
2025-11-29 20:54:06 +01:00
Matthias Krüger
8e4c70f02b
Rollup merge of #148746 - RalfJung:mutable-ref-in-const, r=davidtwco
const validation: remove check for mutable refs in final value of const

This check rejects code that is not necessarily UB, e.g. a mutable ref to a `static mut` that is very carefully used correctly. That led to us having to describe it in the Reference, which uncovered just how ad-hoc this check is (https://github.com/rust-lang/reference/issues/2074).

Even without this check, we still reject things like
```rust
const C: &mut i32 = &mut 0;
```
This is rejected by const checking -- the part of the frontend that looks at the source code and says whether it is allowed in const context. In the Reference, this restriction is explained [here](https://doc.rust-lang.org/nightly/reference/const_eval.html#r-const-eval.const-expr.borrows).

So, the check during validation is just a safety net. And it is already a safety net with gaping holes since we only check `&mut T`, not `&UnsafeCell<T>`, due to the fact that we promote some immutable values that have `!Freeze` type so `&!Freeze` actually can occur in the final value of a const.

So... it may be time for me to acknowledge that the "mutable ref in final value of const" check is a cure that's worth than the disease. Nobody asked for that check, I just added it because I was worried about soundness issues when we allow mutable references in constants. Originally it was much stricter, but I had to slowly relax it to its current form to prevent t from firing on code we intend to allow. In the end there are only 3 tests left that trigger this error, and they are all just constants containing references to mutable statics -- not the safest code in the world, but also not so bad that we have to spend a lot of time devising a core language limitation and associated Reference wording to prevent it from ever happening.

So... `@rust-lang/wg-const-eval` `@rust-lang/lang`  I propose that we allow code like this
```rust
static mut S: i32 = 3;
const C2: &'static mut i32 = unsafe { &mut * &raw mut S };
```
`@theemathas` would be great if you could try to poke a hole into this. ;)
2025-11-29 20:54:05 +01:00
bors
8a3a6bdb68 Auto merge of #149425 - flip1995:clippy-subtree-update, r=matthiaskrgr
Clippy subtree update

r? `@Manishearth`

1 day late. Totally forgot about this yesterday.
2025-11-29 16:51:52 +00:00
joboet
c22b819952
update type names in debuginfo tests 2025-11-29 15:59:11 +01:00
joboet
9c6e0f6f57
std: update broken links in thread module 2025-11-29 15:59:11 +01:00
joboet
912f7f9502
update references to thread implementation in tests 2025-11-29 15:59:11 +01:00
joboet
8b08da218e
std: split up the thread module 2025-11-29 15:59:11 +01:00
Vadim Petrochenkov
c91b6ca58d resolve: Split resolve_ident_in_module_unadjusted into two parts - for non-glob and glob bindings.
In preparation for introducing `Scope::Module(Non)Globs` and `ScopeSet::Module`.
2025-11-29 17:23:53 +03:00
joboet
e57df9220a
std: split up the thread module (preparation) 2025-11-29 15:12:28 +01:00
Vadim Petrochenkov
9761db07d9 resolve: Correctly mark break and continue for determinate errors
Existing but private bindings - break, everything else - continue.
2025-11-29 17:10:31 +03:00
Vadim Petrochenkov
674d287c38 resolve: Replace enum Weak with ops::ControlFlow 2025-11-29 17:05:37 +03:00
Vadim Petrochenkov
56e1e240e6 resolve: Remove some function parameters and return values that are no longer used 2025-11-29 16:47:27 +03:00
Vadim Petrochenkov
b7f6c9559c resolve: Move resolve_ident_in_module_unadjusted for real modules to a separate method 2025-11-29 16:47:27 +03:00
Vadim Petrochenkov
621d87099b resolve: Tweak top level logic and comments in resolve_ident_in_scope_set 2025-11-29 16:47:27 +03:00
Vadim Petrochenkov
47edfd386a resolve: Move ambiguity detection in resolve_ident_in_scope_set into a separate function 2025-11-29 16:47:27 +03:00
Vadim Petrochenkov
6ca6302533 resolve: Move one iteration of resolve_ident_in_scope_set into a separate function 2025-11-29 16:47:27 +03:00
Vadim Petrochenkov
97e6819e92 resolve: Use ControlFlow in fn visit_scopes callback 2025-11-29 16:47:26 +03:00
bors
0ad2cd3f13 Auto merge of #149064 - Ayush1325:uefi-fs-rmdir, r=joboet
std: sys: fs: uefi: Implement rmdir and unlink

- Implement remove_dir and remove_file.
- Tested on qemu ovmf.
2025-11-29 13:32:25 +00:00
bors
791c041c40 Auto merge of #149450 - Zalathar:rollup-xxu162q, r=Zalathar
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#144000 (Add `DefId::parent()` accessor for `rustc_public`)
 - rust-lang/rust#149409 (Test the coexistence of 'stack-protector' and 'safe-stack')
 - rust-lang/rust#149449 (Remove an unnecessary `unwrap` in `rustc_codegen_gcc`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-29 10:14:06 +00:00
Stuart Cook
3b9b370923
Rollup merge of #149449 - AudaciousAxiom:refactor/rustc-codegen-gcc-remove-unnecessary-unwrap, r=workingjubilee
Remove an unnecessary `unwrap` in `rustc_codegen_gcc`

This should hopefully unblock rust-lang/rust#149425 (I couldn't find an in-flight PR that was already doing this).
I've tested  locally with the `master` version of Clippy that `rustc_codegen_gcc` passes the lints (the syncing PR could still fail for other reasons however).

I understand that `rustc_codegen_gcc` is normally developed [outside of this repo](https://github.com/rust-lang/rustc_codegen_gcc) but my understanding is that that repo is two-way synced regularly and hopefully it is acceptable to do this tiny change here to unblock the Clippy syncing PR (is there an established process for how to unblock these syncing PRs?). Of course feel free to close if this isn't the expected process.
2025-11-29 21:12:27 +11:00
Stuart Cook
4e3b7a1e31
Rollup merge of #149409 - cezarbbb:stable_ssp, r=SparrowLii
Test the coexistence of 'stack-protector' and 'safe-stack'

This is a test to detect the coexistence of 'stack-protector' and 'safe-stack', and it's a supplement to pr rust-lang/rust#147115 . After the solution to issue rust-lang/rust#149340, I rewrote a version using minicore to circumvent the 'abi_mismatch' error.

r? `@SparrowLii` (Do you have time to review it?)
2025-11-29 21:12:26 +11:00
Stuart Cook
3a0187ec5d
Rollup merge of #144000 - jacob-greenfield:stable-defid-parent, r=celinval
Add `DefId::parent()` accessor for `rustc_public`

Adds a `parent()` method to `DefId` (the `rustc_pub` version) which exposes the parent path, ie. `foo::bar::baz` -> `foo::bar`.

This is useful for organizing/grouping definitions into a tree, and is probably simpler and less brittle than attempting to parse the fully-qualified name into path components (e.g. especially when handling path components with qualified generic parameters).
2025-11-29 21:12:25 +11:00
AudaciousAxiom
d3653e9f59 Remove an unnecessary unwrap in rustc_codegen_gcc 2025-11-29 10:34:07 +01:00
Ayush Singh
5b0fded2b3
std: sys: fs: uefi: Implement rmdir and unlink
- Implement remove_dir and remove_file.
- Tested on qemu ovmf.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-11-29 14:14:02 +05:30
cezarbbb
7c24c9a908 Test the coexistence of 'stack-protector' and 'safe-stack' 2025-11-29 14:17:58 +08:00
bors
3c5c55864f Auto merge of #149441 - jhpratt:rollup-4hmqc0z, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#147362 (Avoid suggesting constrain the associated type with unknown type)
 - rust-lang/rust#149395 (float::minimum/maximum: say which exact IEEE operation this corresponds to)
 - rust-lang/rust#149396 (Remove outdated comment)
 - rust-lang/rust#149421 (Add a regression test for issue 129865)
 - rust-lang/rust#149424 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-29 05:20:07 +00:00
Jacob Pratt
e838b66bfa
Rollup merge of #149424 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/book

2 commits in f78ab89d7545ac17780e6a367055cc089f4cd2ec..8c0eacd5c4acbb650497454f3a58c9e8083202a4
2025-11-18 15:36:41 UTC to 2025-11-18 15:33:41 UTC

- Update ch07-02-defining-modules-to-control-scope-and-privacy.md (rust-lang/book#4570)
- use AND for search terms (rust-lang/book#4573)

## rust-lang/reference

4 commits in f9f1d2a4149f02582aec2f8fcdfa5b596193b4e2..f2ac173df9906de5c03b0ee50653321ef1c4ebe8
2025-11-26 02:52:23 UTC to 2025-11-18 21:54:51 UTC

- document `cfg` conditions on inline assembly templates and operands (rust-lang/reference#2063)
- remove unused "link reference definitions" (rust-lang/reference#2092)
- Add review process overview to review-policy.md (rust-lang/reference#2088)
- Remove restriction on dereferencing pointers in const (rust-lang/reference#2090)

## rust-lang/rust-by-example

5 commits in f944161716230641605b5e3733e1c81f10047fd4..111cfae2f9c3a43f7b0ff8fa68c51cc8f930637c
2025-11-27 20:16:42 UTC to 2025-11-20 21:40:02 UTC

- Use `From::from` fn pointer to convert to boxed errors (rust-lang/rust-by-example#1906)
- link the _tuple_ page instead "TupleStruct" (rust-lang/rust-by-example#1909)
- enum_use.md: avoid an uncommon term (rust-lang/rust-by-example#1976)
- make search less surprising (rust-lang/rust-by-example#1975)
- Update documentation for `any` function in iter_any.md (rust-lang/rust-by-example#1973)
2025-11-28 21:22:26 -05:00
Jacob Pratt
0b94bc0322
Rollup merge of #149421 - ShoyuVanilla:regression-129865, r=chenyukang
Add a regression test for issue 129865

Closes rust-lang/rust#129865

Looks like the previous versions (`< 1.85.0`) failed to normalize async block's upvar types containing constants but not anymore
2025-11-28 21:22:25 -05:00
Jacob Pratt
a3173c1e62
Rollup merge of #149396 - yotamofek:pr/library/outdated-comment, r=chenyukang
Remove outdated comment

The comment was added in rust-lang/rust#136897 , but wasn't removed when the feature gate was stabilized (again).

Also, `it's` -> `its` :)
2025-11-28 21:22:24 -05:00
Jacob Pratt
010da38d00
Rollup merge of #149395 - RalfJung:float-minimum, r=scottmcm
float::minimum/maximum: say which exact IEEE operation this corresponds to

There's both `minimum` and `minimumNumber`, so this seems worth clarifying.

Also use code font for these names to make it more clear that they are technical terms.
2025-11-28 21:22:24 -05:00
Jacob Pratt
888e5da41c
Rollup merge of #147362 - chenyukang:yukang-fix-bound-147356, r=fee1-dead
Avoid suggesting constrain the associated type with unknown type

Fixes rust-lang/rust#147356
2025-11-28 21:22:23 -05:00
bors
467250ddb2 Auto merge of #144465 - orlp:system-alloc-tls, r=Mark-Simulacrum
Allow the global allocator to use thread-local storage and std:🧵:current()

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

Currently the thread-local storage implementation uses the `Global` allocator if it needs to allocate memory in some places. This effectively means the global allocator can not use thread-local variables. This is a shame as an allocator is precisely one of the locations where you'd *really* want to use thread-locals. We also see that this lead to hacks such as https://github.com/rust-lang/rust/pull/116402, where we detect re-entrance and abort.

So I've made the places where I could find allocation happening in the TLS implementation use the `System` allocator instead. I also applied this change to the storage allocated for a `Thread` handle so that it may be used care-free in the global allocator as well, for e.g. registering it to a central place or parking primitives.

r? `@joboet`
2025-11-29 02:08:53 +00:00
bors
1eb0657f78 Auto merge of #147404 - JamieCunliffe:inline-always, r=jackh726
Fix issue with callsite inline attribute not being applied sometimes.

If the calling function had more target features enabled than the callee than the attribute wasn't being applied as the arguments for the check had been swapped round. Also includes target features that are part of the global set as the warning was checking those but when adding the attribute they were not checked.

Add a codegen-llvm test to check that the attribute is actually applied as previously only the warning was being checked.

Tracking issue: rust-lang/rust#145574
2025-11-28 22:58:22 +00:00
Orson Peters
492fbc56c1 Update debuginfo test from Global to System 2025-11-28 23:35:38 +01:00
Philipp Krones
0a1fa795f7
Merge commit '92b4b68683' into clippy-subtree-update 2025-11-28 20:25:22 +01:00
Philipp Krones
92b4b68683
Rustup (#16153)
r? @ghost

changelog: none
2025-11-28 19:14:52 +00:00
Philipp Krones
397aa53a61
Update to mdbook 0.5 (#16130)
See:
https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-051

changelog: none
2025-11-28 19:12:28 +00:00
Philipp Krones
aa988c8e14
Bump nightly version -> 2025-11-28 2025-11-28 20:09:58 +01:00
Philipp Krones
181601c342
Merge remote-tracking branch 'upstream/master' into rustup 2025-11-28 20:09:43 +01:00
rustbot
d2564a990e Update books 2025-11-28 19:47:24 +01:00
bors
cc3eee7fbe Auto merge of #149419 - matthiaskrgr:rollup-v3q93fq, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#147952 (Add a timeout to the `remote-test-client` connection)
 - rust-lang/rust#149321 (Fix ICE when include_str! reads binary files)
 - rust-lang/rust#149398 (add regression test for issue rust-lang/rust#143987)
 - rust-lang/rust#149411 (Tidying up UI tests [5/N])
 - rust-lang/rust#149413 (add test for issue 143821)
 - rust-lang/rust#149415 (Remove test-float-parse from workspace list in tidy)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-28 17:26:31 +00:00
Shoyu Vanilla
c6b0f7888b Add a regression test for issue 129865 2025-11-28 23:58:50 +09:00
Matthias Krüger
3730b40500
Rollup merge of #149415 - bjorn3:tidy_update, r=clubby789
Remove test-float-parse from workspace list in tidy

It is now part of the main workspace.
2025-11-28 15:19:17 +01:00
Matthias Krüger
60e46fbbe3
Rollup merge of #149413 - Aditya-PS-05:test-issue-143821-nested-closure-ice, r=JonathanBrouwer
add test for issue 143821

closes rust-lang/rust#143821
2025-11-28 15:19:17 +01:00
Matthias Krüger
8d6e68b945
Rollup merge of #149411 - reddevilmidzy:t5, r=Kivooeo
Tidying up UI tests [5/N]

> [!NOTE]
> Intermediate commits are intended to help review, but will be squashed prior to merge.

part of rust-lang/rust#133895

merge directory

* `macro_backtrace` -> `macros`
* `missing_non_modrs_mod` -> `modules`
* `modules_and_files_visibility` -> `modules`
* `qualified` -> `typeck`
* `while` -> `for-loop-whlie`

r? Kivooeo
2025-11-28 15:19:16 +01:00