Commit graph

313090 commits

Author SHA1 Message Date
Jacob Pratt
bcde603308
Rollup merge of #149874 - azhogin:azhogin/arc_weak_dyn_send_sync, r=eholk
Weak for Arc pointer is marked as DynSend/DynSync

`std::sync::Weak` (weak pointer for Arc) added to DynSend and DynSync (looks like it was missed to add there when implemented).
2025-12-13 00:55:57 -05:00
Jacob Pratt
47f1502c73
Rollup merge of #149860 - Delta17920:fix/149821-root-cause, r=petrochenkov
Fix: Prevent macro-expanded extern crates from shadowing extern arguments

prevents an ICE by fixing a logic bug in `build_reduced_graph.rs`.
the bug caused the compiler to correctly detect and report a shadowing error for a macro-expanded `extern crate` but then continue processing the invalid item, corrupting the resolver's internal state (`extern_prelude`) and leading to a crash in later resolution passes the fix adds an early return after the shadowing error is reported to ensure the invalid item is not added to the resolution graph.

Fixes rust-lang/rust#149821
2025-12-13 00:55:56 -05:00
Jacob Pratt
e7ba4a5e6d
Rollup merge of #149843 - aerooneqq:inherit-attributes-in-delegation, r=petrochenkov
Inherit attributes in delegation

This PR adds support for inheriting attributes of the original function of the delegation and is a part of rust-lang/rust#118212, for now we inherit only #[must_use] attribute, but we can add other attributes to inherit. The list of processed attributes can be found [here](https://github.com/aerooneqq/public-docs/blob/master/rust/delegation/processed_attributes.md).

r? ``@petrochenkov``
2025-12-13 00:55:56 -05:00
Jacob Pratt
d175f11e0e
Rollup merge of #149177 - chenyukang:yukang-fix-assoc-func-149038, r=estebank
Add proper suggestion for associated function with unknown field

Fixes rust-lang/rust#149038

The first commit is changing the old suggestion to verbose,
the second commit is a new added suggestion.

r? ``@estebank``
2025-12-13 00:55:55 -05:00
Jacob Pratt
b32845c61a
Rollup merge of #148837 - estebank:let-else, r=Kivooeo
Use `let...else` instead of `match foo { ... _ => return };` and `if let ... else return`
2025-12-13 00:55:55 -05:00
Jacob Pratt
397339e928
Rollup merge of #145278 - notJoon:doc/rotate-operation, r=antoyo
Update `rustc_codegen_gcc` rotate operation document

## Description

This PR resolves a TODO comment in the `rustc_codegen_gcc` backend by documenting that the rotate operations (`rotate_left` and `rotate_right`) already implement the optimized branchless algorithm from comment.

The existing implementation already uses the optimal branchless rotation pattern:
- For left rotation: `(x << n) | (x >> (-n & (width-1)))`
- For right rotation: `(x >> n) | (x << (-n & (width-1)))`

This pattern avoids branches and generates efficient machine code across different platforms, which was the goal mentioned in the original TODO.

## Changes

- Removed the TODO comment that suggested implementing the algorithm from https://blog.regehr.org/archives/1063
2025-12-13 00:55:54 -05:00
bors
dc47a69ed9 Auto merge of #149136 - BoxyUwU:mgca_explicit_anon_consts, r=oli-obk
MGCA: Syntactically distinguish anon const const args

r? oli-obk

tracking issue: rust-lang/rust#132980

This PR requires that when `feature(min_generic_const_args)` is enabled, anon const const args are *syntactically* distinguishable from other kinds of args. We use `const { ... }` in const argument position to denote an anon const:
```rust
#![feature(min_generic_const_args)]

// no longer allowed as `1 + 1` is represented via an anon const and
// there is no syntactic marker
type Foo = [(); 1 + 1];

// allowed, `const { ... }` indicates an anon const representation
type Foo = [(); const { 1 + 1 }];
```

This restriction is only placed when mgca is enabled. There should be no effect on stable. This restriction is not enforced for unbraced literals which we continue to implicitly wrap in an anon const: `tests/ui/const-generics/mgca/explicit_anon_consts_literals_hack.rs`

This restriction allows us to create `DefId`s for anon consts only when actually required. When it is syntactically ambiguous whether a const argument is an anon const or not we are forced to conservatively create a `DefId` for every const argument even if it doesn't wind up needing one.

This works fine on stable but under `mgca` we can wind up with anon consts nested inside non-anon-const const arguments resulting in a broken `DefId` tree. See rust-lang/rust#148838 where an anon const arg inside of a path arg winds up with a parent of a conservatively created `DefId` that doesn't actually correspond to an anon const, resulting in an ICE.

With rust-lang/rust#149114 every field initialiser in a const argument would become a place where there could *possibly* be an anon const. This would also get worse once we support tuple constructors- now every function argument is a place where there could possibly be an anon const.

We introduce this restriction to avoid creating massive amounts of unused `DefId`s that make the parent tree significantly more complicated, and to avoid having to paper over this issue in things like `generics_of`.

Fixes rust-lang/rust#148838

It also must be syntactically clear from context whether `'_` means an inference lifetime or an elided lifetime parameter. This restriction will allow us to properly resolve `'_` in const arguments in mgca. This PR doesn't actually fix handle this, but we could do so trivially after this lands.
2025-12-12 21:35:31 +00:00
bors
fa5eda19b9 Auto merge of #149917 - GuillaumeGomez:malformed-attribute-suggestions, r=JonathanBrouwer
If there are too many suggestions for malformed attribute, do not suggest them

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

This not only covers for doc attributes but for all attributes, so don't hesitate to tell me if you want it to be limited to only doc attributes (although I think it's actually a nice improvement overall).

Also, I picked 3 as the maximum number of suggestions before it becomes noise, but it's very much open to debate.

r? `@JonathanBrouwer`
2025-12-12 18:18:14 +00:00
Esteban Küber
97c7742151 revert one change from rustc_next_trait_solver 2025-12-12 17:55:26 +00:00
Esteban Küber
a49c175380 #![deny(clippy::manual_let_else)] in some rustc modules 2025-12-12 17:53:19 +00:00
Esteban Küber
146711fc24 Use let...else instead of match foo { ... _ => return }; and if let ... else return 2025-12-12 17:52:39 +00:00
aerooneqq
0a3fd24287 Support attribute inheritance in delegation 2025-12-12 20:34:54 +03:00
delta17920
0748492e2b Fix: Prevent macro-expanded extern crates from shadowing extern arguments 2025-12-12 16:22:25 +00:00
Boxy Uwu
acc3a0e2da Syntactically distinguish anon const const args 2025-12-12 15:45:37 +00:00
Guillaume Gomez
d025cdef7d If there are too many suggestions for malformed attribute, do not suggest them 2025-12-12 14:55:17 +01:00
bors
3391c01336 Auto merge of #149909 - matthiaskrgr:rollup-596c34w, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#149655 (bootstrap: add rustc-dev install target)
 - rust-lang/rust#149789 (Cleanup in the attribute parsers)
 - rust-lang/rust#149791 (Remove uses of `cfg({any()/all()})`)
 - rust-lang/rust#149792 (Suggest `cfg(false)` instead of `cfg(FALSE)`)
 - rust-lang/rust#149883 (add regression test for `proc_macro` error subdiagnostics)
 - rust-lang/rust#149884 (Clippy subtree update)
 - rust-lang/rust#149896 (Add myself(makai410) to the review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-12 13:00:47 +00:00
Matthias Krüger
eaf470bbc3
Rollup merge of #149896 - makai410:ping-me, r=jieyouxu
Add myself(makai410) to the review rotation

Per the https://github.com/rust-lang/team/pull/2177 .
2025-12-12 12:19:12 +01:00
Matthias Krüger
e0e575cfa9
Rollup merge of #149884 - flip1995:clippy-subtree-update, r=matthiaskrgr
Clippy subtree update

r? ``````@Manishearth``````

Cargo.lock update due to Clippy version bump.
2025-12-12 12:19:11 +01:00
Matthias Krüger
1553fcc240
Rollup merge of #149883 - cyrgani:sub-err-diag, r=Kivooeo
add regression test for `proc_macro` error subdiagnostics

The previous ICE was already fixed by rust-lang/rust#148188, but no test was added at that time.
Closes rust-lang/rust#145305.
2025-12-12 12:19:10 +01:00
Matthias Krüger
d952bac929
Rollup merge of #149792 - clubby789:cfg-FALSE, r=jdonszelmann
Suggest `cfg(false)` instead of `cfg(FALSE)`

Split from rust-lang/rust#149791

cc ```````@Urgau```````
2025-12-12 12:19:10 +01:00
Matthias Krüger
b826d06771
Rollup merge of #149791 - clubby789:cfg-bool-lints, r=jdonszelmann
Remove uses of `cfg({any()/all()})`

~~This implements the followup warning suggested in https://github.com/rust-lang/rfcs/pull/3695~~
~~Lint against an empty `cfg(any/all)`, suggest the boolean literal equivalents.~~
https://github.com/rust-lang/rust/pull/149791#issuecomment-3638624348

Tracking issue: https://github.com/rust-lang/rust/issues/131204
2025-12-12 12:19:09 +01:00
Matthias Krüger
c511c6088e
Rollup merge of #149789 - JonathanBrouwer:remove-lifetime-param, r=jdonszelmann
Cleanup in the attribute parsers

* Removes a bunch of unused lifetimes in the attribute parsers
* Creates two variants of `PathParser`, because we statically know which variant we're in

r? ```````@jdonszelmann```````
2025-12-12 12:19:08 +01:00
Matthias Krüger
675af3cf52
Rollup merge of #149655 - Nadrieril:install-rustc-dev, r=Kobzol
bootstrap: add rustc-dev install target

I'm entirely new to bootstrap but there seemed to be no easy way to construct a sysroot with tools and librustc_driver.so. `./x install` is the command for that but as far as I can tell it doesn't include the rustc-dev files. This is my attempt at adding that.

`./x install rustc-dev` now does what you expect (at least on my machine™). If I'm understanding correctly this also means that `./x install` will now include rustc-dev files if `build.tools` contains `"rustc-dev"`.
2025-12-12 12:19:04 +01:00
bors
2a3a62d26e Auto merge of #148477 - lqd:crater-wfcheck, r=lcnr,BoxyUwU
don't normalize where-clauses when checking well-formedness

WfCheck checks where-clauses after normalization, and we'd like to see what would break if it didn't for https://github.com/rust-lang/trait-system-refactor-initiative/issues/255

r? ghost
2025-12-12 09:45:27 +00:00
Jonathan Brouwer
aa6db80ab2
Remove lifetime param from parser functions 2025-12-12 09:02:54 +01:00
Jonathan Brouwer
86a97c41cb
Remove lifetime param from parser types 2025-12-12 08:58:16 +01:00
Jonathan Brouwer
97252d3747
Remove from MetaItemParser::from_attr 2025-12-12 08:58:10 +01:00
bors
c4dc70ee0a Auto merge of #149891 - matthiaskrgr:rollup-jh6xrhz, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#142380 (Put negative implementors first and apply same ordering logic to foreign implementors)
 - rust-lang/rust#146584 (remove duplicated columns from `rustc_error_code::error_codes!`)
 - rust-lang/rust#148717 (Point at span within local macros even when error happens in nested external macro)
 - rust-lang/rust#149565 (rustdoc: Add unstable `--merge-doctests=yes/no/auto` flag)
 - rust-lang/rust#149770 (Rename some issue-* tests)
 - rust-lang/rust#149807 (Use ubuntu:24.04 for the `x86_64-gnu-miri` job)
 - rust-lang/rust#149850 (Remove "tidy" tool for `tests/rustdoc` testsuite)
 - rust-lang/rust#149863 (Do not suggest moving expression out of for loop when hitting `break` from desugaring)
 - rust-lang/rust#149867 (only resolve main in bin crates)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-12 06:30:06 +00:00
Makai
5aa2c14aeb mailmap: add makai410 2025-12-12 11:14:00 +08:00
Makai
24302fd95f triagebot: add myself(makai410) to the review rotation 2025-12-12 10:42:39 +08:00
Makai
de0d961eb3 triagebot: ping makai410 for rustc_public 2025-12-12 10:42:39 +08:00
Matthias Krüger
1c937f1e7f
Rollup merge of #149867 - 21aslade:lib-crate-main, r=Kivooeo
only resolve main in bin crates

Fixes rust-lang/rust#149412
2025-12-11 22:09:58 +01:00
Matthias Krüger
eb309e5182
Rollup merge of #149863 - estebank:issue-149861, r=mati865
Do not suggest moving expression out of for loop when hitting `break` from desugaring

Fix rust-lang/rust#149861.
2025-12-11 22:09:58 +01:00
Matthias Krüger
b912391535
Rollup merge of #149850 - GuillaumeGomez:rm-tidy-rustdoc, r=yotamofek
Remove "tidy" tool for `tests/rustdoc` testsuite

As discussed in the [last rustdoc meeting](https://rust-lang.zulipchat.com/#narrow/channel/393423-t-rustdoc.2Fmeetings/topic/2025-12-08/near/562554410), it seems like the current `tidy` tool is not used much for the `rustdoc` testsuite by the rustdoc contributors as it doesn't fit nicely our needs.

Until we find something better, we decided to remove it.

r? ```@yotamofek```
2025-12-11 22:09:56 +01:00
Matthias Krüger
817c58a975
Rollup merge of #149807 - Kobzol:miri-ubuntu-24.04, r=marcoieni
Use ubuntu:24.04 for the `x86_64-gnu-miri` job

Ralf asked for this in https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/Adding.20a.20C.2B.2B.20dependency.20to.20Miri.3F/with/560654845.
2025-12-11 22:09:55 +01:00
Matthias Krüger
17940e27c8
Rollup merge of #149770 - GrigorenkoPV:tests/consts, r=WaffleLapkin
Rename some issue-* tests

Also fixes one incorrect issue number: https://github.com/rust-lang/rust/pull/100168#issuecomment-3622946835
2025-12-11 22:09:54 +01:00
Matthias Krüger
0dfc23839b
Rollup merge of #149565 - jyn514:force-doctest-merge, r=notriddle
rustdoc: Add unstable `--merge-doctests=yes/no/auto` flag

This is useful for changing the *default* for whether doctests are merged or not. Currently, that default is solely controlled by `edition = 2024`, which adds a high switching cost to get doctest merging. This flag allows opting in even on earlier editions.

Unlike the `edition = 2024` default, `--merge-doctests=yes` gives a hard error if merging fails instead of falling back to running standalone tests. The user has explicitly said they want merging, so we shouldn't silently do something else.

`--merge-doctests=auto` is equivalent to the current 2024 edition behavior, but available on earlier editions.

Helps with https://github.com/rust-lang/rust/issues/141240. ``@epage`` said in that issue he would like a per-doctest opt-in, and that seems useful to me in addition to this flag, but I think it's a separate use case from changing the default.
2025-12-11 22:09:54 +01:00
Matthias Krüger
215d7b661e
Rollup merge of #148717 - estebank:macro-spans-2, r=petrochenkov
Point at span within local macros even when error happens in nested external macro

Address issue noticed at https://users.rust-lang.org/t/error-message-does-not-specify-where-in-macro/135157/1. On errors occurring within a macro expansion, point at the innermost local macro expansion point.

```
error[E0308]: mismatched types
  --> $DIR/macro-span-caller-replacement.rs:5:17
   |
LL |             s = format!("{arg}");
   |                 ^^^^^^^^^^^^^^^^ expected `&str`, found `String`
...
LL |     macro_with_format!();
   |     -------------------- in this macro invocation
   |
   = note: this error originates in the macro `format` which comes from the expansion of the macro `macro_with_format` (in Nightly builds, run with -Z macro-backtrace for more info)
```
2025-12-11 22:09:53 +01:00
Matthias Krüger
bf399241fe
Rollup merge of #146584 - cyrgani:error-codes-macro, r=GuillaumeGomez
remove duplicated columns from `rustc_error_code::error_codes!`

Possible because of rust-lang/rust#146308 ~~, but currently still blocked on the next stage0 bump~~.
2025-12-11 22:09:52 +01:00
Matthias Krüger
52cadc06f1
Rollup merge of #142380 - GuillaumeGomez:neg-implementors, r=yotamofek
Put negative implementors first and apply same ordering logic to foreign implementors

Fixes rust-lang/rust#51129.

This PR changeda surprisingly small amount of things to put negative trait impls before the others: basically just adding a new information in the generated JS file for foreign implementors and a "negative marker" DOM element to know where to insert negative impls.

I also used this occasion to make the foreign implementors sort the same as the local ones by using `compare_names`.

You can test it [here](https://rustdoc.crud.net/imperio/neg-implementors/core/marker/trait.Sync.html#implementors).

r? ```@notriddle```
2025-12-11 22:09:51 +01:00
bors
5b150d238f Auto merge of #149645 - GuillaumeGomez:doc-attr-based, r=jdonszelmann,jonathanbrouwer
Port `doc` attributes to new attribute API

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

This PR ports the `doc` attributes to the new attribute API. However, there are things that will need to be fixed in a follow-up:

* Some part of `cfg_old.rs` are likely unused now, so they should be removed.
* Not all error/lints are emitted at the same time anymore, making them kinda less useful considering that you need to run and fix rustc/rustdoc multiple times to get through all of them.
* For coherency with the other attribute errors, I didn't modify the default output too much, meaning that we have some new messages now. I'll likely come back to that to check if the previous ones were better in a case-by-case approach.
* `doc(test(attr(...)))` is handled in a horrifying manner currently. Until we can handle it correctly with the `Attribute` system, it'll remain that thing we're all very ashamed of. 😈
* A type in rustdoc got its size increased, I'll check the impact on performance. But in any case, I plan to improve it in a follow-up so should be "ok".
* Because of error reporting, some fields of `Doc` are suboptimal, like `inline` which instead of being an `Option` is a `ThinVec` because we report the error later on. Part of the things I'm not super happy about but can be postponed to future me.
* In `src/librustdoc/clean/cfg.rs`, the `pub(crate) fn parse(cfg: &MetaItemInner) -> Result<Cfg, InvalidCfgError> {` function should be removed once `cfg_trace` has been ported to new `cfg` API.
* Size of type `DocFragment` went from 32 to 48. Would be nice to get it back to 32.
* ``malformed `doc` attribute input`` wasn't meant for so many candidates, should be improved.
* See how many of the checks in `check_attr` we can move to attribute parsing
* Port target checking to be in the attribute parser completely
* Fix target checking for `doc(alias)` on fields & patterns

And finally, once this PR is merged, I plan to finally stabilize `doc_cfg` feature. :)

cc `@jdonszelmann`
r? `@JonathanBrouwer`
2025-12-11 21:08:19 +00:00
Jamie Hill-Daniel
0349359792 Suggest cfg(false) instead of cfg(FALSE) 2025-12-11 18:23:04 +00:00
Philipp Krones
26c164f60c
Update Cargo.lock 2025-12-11 19:16:53 +01:00
cyrgani
43fa2a95c9 add regression test for proc_macro error subdiagnostics 2025-12-11 18:15:15 +00:00
Philipp Krones
39877b17b6
Merge commit '9e3e9649cb' into clippy-subtree-update 2025-12-11 19:13:34 +01:00
Philipp Krones
9e3e9649cb
Rustup (#16217)
r? @ghost

changelog: none
2025-12-11 18:00:44 +00:00
Philipp Krones
1ff4682590
Bump Clippy version -> 0.1.94 2025-12-11 18:48:15 +01:00
Philipp Krones
42c8b68ee9
Bump nightly version -> 2025-12-11 2025-12-11 18:48:10 +01:00
Philipp Krones
de365c057e
Merge remote-tracking branch 'upstream/master' into rustup 2025-12-11 18:48:00 +01:00
Esteban Küber
c60ed211d1 Do not suggest moving expression out of for loop when hitting break from desugaring 2025-12-11 15:00:48 +00:00