Commit Graph

291081 Commits

Author SHA1 Message Date
Ralf Jung
30c87defe6 aarch64-softfloat: forbid enabling the neon target feature 2025-05-22 12:19:25 +02:00
Jakub Beránek
7d32303574 Move dist-x86_64-linux CI job to GitHub temporarily
To make it easier to migrate off the `rust-lang-ci/rust` repository.
2025-05-22 12:09:37 +02:00
bendn
8373bb17d6 use uX::from instead of _ as uX in non - const contexts 2025-05-22 17:08:32 +07:00
Jakub Beránek
8bed64670f Enable review queue tracking 2025-05-22 11:21:24 +02:00
bors
1d679446b0 Auto merge of #140527 - GuillaumeGomez:doctest-main-fn, r=notriddle
Emit a warning if the doctest `main` function will not be run

Fixes #140310.

I think we could try to go much further like adding a "link" (ie UI annotations) on the `main` function in the doctest. However that will require some more computation, not sure if it's worth it or not. Can still be done in a follow-up if we want it.

For now, this PR does two things:
1. Pass the `DiagCtxt` to the doctest parser to emit the warning.
2. Correctly generate the `Span` to where the doctest is starting (I hope the way I did it isn't too bad either...).

cc `@fmease`
r? `@notriddle`
2025-05-22 08:40:58 +00:00
Ralf Jung
3f0c39de36 update lockfile 2025-05-22 10:13:45 +02:00
Ralf Jung
b9e69959c6 run core and alloc tests with strict provenance 2025-05-22 10:09:19 +02:00
Lukas Wirth
11afee46e3 Merge pull request #19843 from oli-obk/rust-analyzer.vs
Remove rust-analyzer.vs from other editors
2025-05-22 07:55:48 +00:00
MarcoIeni
27677ef143 ci: convert distcheck to free runner 2025-05-22 09:53:35 +02:00
Ralf Jung
2eb935d25c Merge pull request #4275 from CraftSpider/windows-file-rw
Implement file read/write/seek in Windows
2025-05-22 07:39:33 +00:00
Oli Scherer
fb181cf660 Remove rust-analyzer.vs from other editors 2025-05-22 07:37:25 +00:00
Ralf Jung
9e1f3a50e9 enable isolated-stdin test on Windows 2025-05-22 09:11:09 +02:00
Rune Tynan
1e79637050 Implement file read/write on Windows 2025-05-22 09:11:08 +02:00
Lukas Wirth
b64a934102 Merge pull request #19842 from Veykril/push-zunlmrzpnrzk
minor: Support `transmute_unchecked` intrinsic for mir-eval
2025-05-22 06:05:35 +00:00
Lukas Wirth
24a416cc57 Support transmute_unchecked intrinsic for mir-eval 2025-05-22 07:55:06 +02:00
Lukas Wirth
1c584188ff Merge pull request #19824 from ChayimFriedman2/lints-again
fix: Fix cache problems with lints level
2025-05-22 05:32:13 +00:00
bors
2cd37831b0 Auto merge of #141379 - matthiaskrgr:rollup-g1cz0ic, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #140431 (dont handle bool transmute)
 - #140868 (rustdoc: Fix links with inline code in trait impl docs)
 - #141323 (Add bors environment to CI)
 - #141337 (bump stdarch)
 - #141364 (rustdoc-json: Remove false docs and add test for inline attribute)
 - #141370 (add doc alias `replace_first` for `str::replacen`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-22 05:27:04 +00:00
Matthias Krüger
a31a39833a Rollup merge of #141370 - WaffleLapkin:hiiii, r=jhpratt
add doc alias `replace_first` for `str::replacen`

`replace_first` is a sensible name for a function, analogous to actually existing `<[_]>::split_first`, for example. (I just saw someone try to search for it)

I think it's reasonable to add such an alias for `replacen`, which replaces the first occurrence of passed a 1.
2025-05-22 07:19:04 +02:00
Matthias Krüger
79f0a97783 Rollup merge of #141364 - aDotInTheVoid:atttrdocss, r=GuillaumeGomez
rustdoc-json: Remove false docs and add test for inline attribute

The docs about how `#[inline]` was represented isn't true. Updates the comment, and adds a test.

CC #137645

r? `@GuillaumeGomez`
2025-05-22 07:19:03 +02:00
Matthias Krüger
1735f843af Rollup merge of #141337 - RalfJung:stdarch, r=Amanieu
bump stdarch

This should unblock https://github.com/rust-lang/rust/pull/135160.
r? `@Amanieu`
2025-05-22 07:19:02 +02:00
Matthias Krüger
6f58f3003f Rollup merge of #141323 - Kobzol:bors-environment, r=marcoieni
Add bors environment to CI

This will be used to access secrets once we move off rust-lang-ci. The PR configures the environment:
- Only for `rust-lang/rust`, so that it doesn't affect `rust-lang-ci/rust` before we switch (we can remove this condition later, but the environment likely won't work for forks anyway, so we might as well just keep it to make fork CI work)
- Only for the `try`/`auto` branches, so that PR CI still works.

Context: https://github.com/rust-lang/infra-team/issues/188

r? `@marcoieni`
2025-05-22 07:19:02 +02:00
Matthias Krüger
981bbf4197 Rollup merge of #140868 - SpecificProtagonist:rustdoc-trait-impl-code-link, r=notriddle
rustdoc: Fix links with inline code in trait impl docs

Fixes #140857
2025-05-22 07:19:01 +02:00
Matthias Krüger
cc87ae85dd Rollup merge of #140431 - bend-n:dont_handle_bool_transmute, r=Nadrieril
dont handle bool transmute

removes `transmute(u8) -> bool` suggestion due to ambiguity, leave it for clippy

elaboration on ambiguity in question:
`transmute::<u8, bool>(x)` will codegen to an `assume(u8 < 2)`;
`_ == 1` or `_ != 0` or `_ % 2 == 0` would remove that assumption
`match _ { x @ (0 | 1) => x == 1, _ => std::hint::unreachable_unchecked() }` is very verbose

`@rustbot` label L-unnecessary_transmutes
2025-05-22 07:19:01 +02:00
Nicholas Nethercote
c309065ece Remove is_empty check in Ident::is_numeric.
`Ident`s can no longer be empty, so the test always succeeds.
2025-05-22 13:31:19 +10:00
Nicholas Nethercote
85d2d843c3 Remove is_empty check in filter_assoc_items_by_name_and_namespace.
It was added in #140052, but the subsequent changes in #140252 means it
is no longer necessary. (Indeed, `Ident`s cannot be empty any more.)
2025-05-22 13:25:45 +10:00
bors
6eef33bb39 Auto merge of #137198 - tgross35:cfg-match-rename, r=Amanieu
Rename `cfg_match!` to `cfg_select!`

[`@Nemo157` pointed out](https://github.com/rust-lang/rust/issues/115585#issuecomment-2346307605) that `cfg_match!` syntax does not actually align well with match syntax, which is a possible source of confusion. The comment points out that usage is instead more similar to ecosystem `select!` macros. Rename `cfg_match!` to `cfg_select!` to match this.

Tracking issue: https://github.com/rust-lang/rust/issues/115585

[1]: https://github.com/rust-lang/rust/issues/115585#issuecomment-2346307605
2025-05-22 02:14:23 +00:00
Nicholas Nethercote
a0760cf5c0 Rename kw::Empty as sym::empty.
Because the empty string is not a keyword.
2025-05-22 11:55:22 +10:00
Nicholas Nethercote
849cabf4c4 Rename kw::Empty as sym::empty.
Because the empty string is not a keyword.
2025-05-22 11:55:22 +10:00
bors
5df0f729f5 Auto merge of #141366 - matthiaskrgr:rollup-utvtyy3, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #140526 (docs: Specify that common sort functions sort in an ascending direction)
 - #141230 (std: fix doctest and explain for `as_slices` and `as_mut_slices` in `VecDeque`)
 - #141341 (limit impls of `VaArgSafe` to just types that are actually safe)
 - #141347 (incorrectly prefer builtin `dyn` impls :3)
 - #141351 (Move -Zcrate-attr injection to just after crate root parsing)
 - #141356 (lower bodies' params to thir before the body's value)
 - #141357 (`unpretty=thir-tree`: don't require the final expr to be the body's value)
 - #141363 (Document why we allow escaping bound vars in LTA norm)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-21 23:02:09 +00:00
Jason Newcomb
a6e40fa9e9 [Perf] Optimize documentation lints **a lot** (1/2) (18% -> 10%) (#14693)
Turns out that `doc_markdown` uses a non-cheap rustdoc function to
convert from markdown ranges into source spans. And it was using it a
lot (about once every 17 lines of documentation on `tokio`, which ends
up being about 2000 times).

This ended up being about 18% of the total Clippy runtime as discovered
by lintcheck --perf in docs-heavy crates. This PR optimizes one of the
cases in which Clippy calls the function, and a future PR once
pulldown-cmark/pulldown-cmark#1034 is merged will be opened. This PR
lands the use of the function into the single-digit zone.

Note that not all crates were affected by this crate equally, those with
more docs are affected far more than those light ones.

changelog:[`clippy::doc_markdown`] has been optimized by 50%
2025-05-21 22:01:41 +00:00
blyxyas
acff5d36cc Review comments & Add testing 2025-05-21 23:44:28 +02:00
waffle
cff790c98e add doc alias replace_first for str::replacen 2025-05-21 23:43:57 +02:00
Samuel Tardieu
3da4c1033a Improve speed of cargo dev fmt (#14862)
This stops using `cargo fmt` and instead calls rustfmt directly with the
list of all files.

All `cargo fmt` does is find the crate roots and passes the edition from
`cargo.toml`. Since the edition is set in `rustfmt.toml` for the test
files and we're already iterating through all the files this is not
needed.

`--skip-children` is used since we already pass all the files, so the
automatic detection isn't buying us anything other than running slower.

~Second commit~ (part of the first commit now) is a change to only use
the `ignore` option in `rustfmt.toml` rather than having a way in `cargo
dev fmt` to ignore files.

r? @samueltardieu

changelog: none
2025-05-21 20:31:46 +00:00
Matthias Krüger
de4055f3f1 Rollup merge of #141363 - BoxyUwU:doc_lta_norm_binders, r=lcnr
Document why we allow escaping bound vars in LTA norm

r? lcnr

followup from the const normalization PR. I think I now understand why free alias norm is funny about binders
2025-05-21 22:15:02 +02:00
Matthias Krüger
2663ea3051 Rollup merge of #141357 - dianne:unhardcode-unpretty-thir-tree-body-expr, r=compiler-errors
`unpretty=thir-tree`: don't require the final expr to be the body's value

Two motivations for this:
- I couldn't find a comment motivating this hard-coding. I can imagine it might be easier to read `unpretty=thir-flat` output if the final expression in the THIR is always the body's value, but if that's the reason, that should be the justification in the source. I can also imagine it's meant to check that all expressions will be visited by the pretty-printer, but the existing check doesn't quite do that either.
- Guard patterns (#129967) contain expressions, so lowering params containing guard patterns may add more expressions to the THIR. Currently a body's params are lowered after its expression, so guard expressions in params would end up last, breaking this. As an alternative, the params could be lowered first (#141356).
2025-05-21 22:15:01 +02:00
Matthias Krüger
fea2e5c746 Rollup merge of #141356 - dianne:thir-lower-params-before-body-expr, r=compiler-errors
lower bodies' params to thir before the body's value

Two motivations for this:
- Lowering params first means errors from lowering the params are emitted before errors from lowering the body's expression. This comes up in [tests/ui/associated-consts/associated-const-type-parameter-pattern.stderr](https://github.com/rust-lang/rust/compare/master...dianne:rust:thir-lower-params-before-body-expr?expand=1#diff-acac6ea10e991af0da91633e08b2739f9f9ca0c8f826401b6ba829914d0806f2), where both the params and expression encounter errors in translating consts to patterns. This change puts the errors in the order they appear in the source file.
- Guard patterns (#129967) contain expressions, so lowering params containing guard patterns may add more expressions to the THIR. However, there's a check for `-Zunpretty=thir-tree` that the final expression in the THIR corresponds to its value [(link)](c43786c9b7/compiler/rustc_mir_build/src/builder/mod.rs (L453-L455)); lowering params last would break this. As an alternative way to get guard patterns to work, I think the pretty-printer could use the expression returned by `thir_body` and the check could be removed or changed (#141357).
2025-05-21 22:15:00 +02:00
Matthias Krüger
eff339b22c Rollup merge of #141351 - bjorn3:attr_handling_changes, r=Nadrieril
Move -Zcrate-attr injection to just after crate root parsing

This way `after_crate_root_parsing` and `-Zpretty` will see them.
2025-05-21 22:14:59 +02:00
Matthias Krüger
69b13e4cab Rollup merge of #141347 - lcnr:lets-make-it-unsound-3, r=compiler-errors
incorrectly prefer builtin `dyn` impls :3

This makes #57893 slightly more exploitable with the new solver. It's still strictly better than the old solver and the underlying unsoundness persists in the new one even without this preference.

Properly fixing #57893 is something we've been looking at more deeply recently and discussed at the [Types Meetup during the All-Hands](https://hackmd.io/rz-4ghMzTb2wXOkdLKHaHw#Dyn-traits). Whatever approach we'll end up deciding on will likely require a fairly long transition period and some significant further design work. This should not block `-Znext-solver`.

fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/183

r? `@compiler-errors` cc `@rust-lang/types`
2025-05-21 22:14:59 +02:00
Matthias Krüger
b9c6b337ce Rollup merge of #141341 - folkertdev:limit-VaArgSafe-impls, r=workingjubilee
limit impls of `VaArgSafe` to just types that are actually safe

tracking issue: https://github.com/rust-lang/rust/issues/44930

Retrieving 8- or 16-bit integer arguments from a `VaList` is not safe, because such types are subject to upcasting. See https://github.com/rust-lang/rust/issues/61275#issuecomment-2193942535 for more detail.

This PR also makes the instances of `VaArgSafe` visible in the documentation, and uses a private sealed trait to make sure users cannot create additional impls of `VaArgSafe`, which would almost certainly cause UB.

r? `@workingjubilee`
2025-05-21 22:14:58 +02:00
Matthias Krüger
b5edec2811 Rollup merge of #141230 - xizheyin:issue-141217, r=tgross35
std: fix doctest and explain for `as_slices` and `as_mut_slices` in `VecDeque`

Fixes #141217

r? libs
2025-05-21 22:14:58 +02:00
Matthias Krüger
d4b7915a59 Rollup merge of #140526 - Natr1x:sort-direction-documentation, r=dtolnay
docs: Specify that common sort functions sort in an ascending direction

From [forum discussion](https://users.rust-lang.org/t/is-there-a-way-to-sort-a-slice-in-specifically-ascending-or-descending-order/128998?u=natr1x) it seems like the sorting direction can be expected to always be ascending (in terms of `cmp::Ordering`).

If this is the case then it would be nice to have this stated in the documentation.
2025-05-21 22:14:57 +02:00
Jason Newcomb
9fa448a119 Make trivial-copy-size-limit consistently the size of the target pointer (#13319)
Fixes
https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Ambiguous.20default.20value.20for.20.60trivial-copy-size-limit.60

The current situation is

| Target width | `trivial-copy-size-limit`|
|--------|--------|
| 8-bit | 2 |
| 16-bit | 4 |
| 32-bit | 8 |
| 64-bit | 8 |

~~Since practically speaking it's almost always 8, let's go with that as
the unconditional default to make it easier to understand~~

Now defaults to `target_pointer_width`

changelog: [`trivial-copy-size-limit`] now also defaults to the size of
a target pointer (unchanged for 64-bit targets)
2025-05-21 20:05:31 +00:00
Michael Goulet
e0f8055871 Fix FnOnce impl for AsyncFn/AsyncFnMut closures in new solver 2025-05-21 20:02:29 +00:00
Michael Goulet
ca912d794d Make captures state error more precise 2025-05-21 20:02:29 +00:00
Ralf Jung
268a369424 Merge pull request #4341 from RalfJung/freebsd
run the full test suite under FreeBSD
2025-05-21 19:48:09 +00:00
Alona Enraght-Moony
8cdfabd230 rustdoc-json: Remove false docs and add test for inline attribute
The docs about how `#[inline]` was represented isn't true. Updates the
comment, and adds a test.

CC https://www.github.com/rust-lang/rust/issues/137645
2025-05-21 19:47:41 +00:00
bors
bf64d66bd5 Auto merge of #141343 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

Out of cycle sync to fix an ICE that was reported twice already: https://github.com/rust-lang/rust-clippy/issues/14828

r? `@Manishearth`
2025-05-21 19:47:01 +00:00
Boxy
4316259729 Anon consts cant appear as repeat expr elements 2025-05-21 20:38:49 +01:00
Boxy
508a9f0853 Check for element being const before resolving repeat count 2025-05-21 20:38:49 +01:00
Boxy
77a2fc60a1 GAI logic on stable too 2025-05-21 20:38:49 +01:00