Commit Graph

253951 Commits

Author SHA1 Message Date
Matthias Krüger
d7a8936b78
Rollup merge of #124441 - bravequickcleverfibreyarn:string.rs, r=Amanieu
String.truncate comment microfix (greater or equal)

String.truncate calls Vec.truncate, in turn, and that states "is greater or equal to". Beside common sense.
2024-05-03 06:04:20 +02:00
Matthias Krüger
9ab5cfd91e
Rollup merge of #124412 - RalfJung:io-safety, r=Amanieu
io safety: update Unix explanation to use `Arc`

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

Cc ```@jsgf```
2024-05-03 06:04:19 +02:00
Matthias Krüger
e17a222a0a
Rollup merge of #123480 - Nadrieril:impl-all-derefpures, r=compiler-errors
deref patterns: impl `DerefPure` for more std types

Context: [deref patterns](https://github.com/rust-lang/rust/issues/87121). The requirements of `DerefPure` aren't precise yet, but these types unambiguously satisfy them.

Interestingly, a hypothetical `impl DerefMut for Cow` that does a `Clone` would *not* be eligible for `DerefPure` if we allow mixing deref patterns with normal patterns. If the following is exhaustive then the `DerefMut` would cause UB:
```rust
match &mut Cow::Borrowed(&()) {
    Cow::Owned(_) => ..., // Doesn't match
    deref!(_x) if false => ..., // Causes the variant to switch to `Owned`
    Cow::Borrowed(_) => ..., // Doesn't match
    // We reach unreachable
}
```
2024-05-03 06:04:19 +02:00
bors
79734f1db8 Auto merge of #124629 - matthiaskrgr:rollup-gttvzrg, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #124138 (Ignore LLVM ABI in dlltool tests since those targets don't use dlltool)
 - #124414 (remove extraneous note on `UnableToRunDsymutil` diagnostic)
 - #124579 (Align: add bytes_usize and bits_usize)
 - #124622 (Cleanup: Rid the `rmake` test runners of `extern crate run_make_support;`)
 - #124623 (shallow resolve in orphan check)
 - #124624 (Use `tcx.types.unit` instead of `Ty::new_unit(tcx)`)
 - #124627 (interpret: hide some reexports in rustdoc)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-02 18:24:38 +00:00
Matthias Krüger
a248411a97
Rollup merge of #124627 - RalfJung:interpret-doc-no-inline, r=fmease
interpret: hide some reexports in rustdoc

Cc https://github.com/rust-lang/rust/issues/124608
2024-05-02 19:42:50 +02:00
Matthias Krüger
d6940fb43d
Rollup merge of #124624 - WaffleLapkin:old_unit, r=fmease
Use `tcx.types.unit` instead of `Ty::new_unit(tcx)`

I don't think there is any need for the function, given that we can just access the `.types`, similarly to all other primitives?
2024-05-02 19:42:50 +02:00
Matthias Krüger
fe62bc5ea5
Rollup merge of #124623 - lcnr:coherence-uwu, r=compiler-errors
shallow resolve in orphan check

r? ``@compiler-errors`` cc https://github.com/rust-lang/rust/pull/124588#pullrequestreview-2036012292
2024-05-02 19:42:49 +02:00
Matthias Krüger
6cc3959230
Rollup merge of #124622 - fmease:yeet-extern-crate-run_make_support, r=jieyouxu
Cleanup: Rid the `rmake` test runners of `extern crate run_make_support;`

`run_make_support` is part of the *extern prelude* of `rmake` test runners rendering `extern crate run_make_support` redundant:

80451a485b/src/tools/compiletest/src/runtest.rs (L3826-L3827)

~~Contains some fmt'ing changes because I've enabled format-on-save in my editor and because we don't run `x fmt` for `rmake` test runners yet (this gets addressed by #124613). I can revert those if you'd like me to.~~ (reverted)

r? jieyouxu or testing-devex(?) or boostrap(?)
2024-05-02 19:42:49 +02:00
Matthias Krüger
490c0d60f8
Rollup merge of #124579 - RalfJung:align-bytes-usize, r=fmease
Align: add bytes_usize and bits_usize

This matches `Size::bytes/bits_usize`. I recently wanted this in Miri as well.
2024-05-02 19:42:48 +02:00
Matthias Krüger
e9e2ebb051
Rollup merge of #124414 - lqd:subdiagnostics, r=davidtwco
remove extraneous note on `UnableToRunDsymutil` diagnostic

If I understand [this FIXME](1367827eac/compiler/rustc_macros/src/diagnostics/diagnostic.rs (L205)) correctly, it seems we don't yet validate subdiagnostics, so `#[note]` and co in the `#[derive(Diagnostic]` item could be out-of-sync with the fluent message, without causing compile errors.

It was the case for `rustc_codegen_ssa::errors::UnableToRunDsymutil`, causing the ICE in #124392.

I've grepped and scripted my way through most of our diagnostics structs and fluent bundles and the above was the only such extraneous `#[note]`/`#[note(name)]`/`#[help]`/`#[warning]` I could find, so hopefully there aren't many others like it.

I haven't checked if the opposite can happen, a `.note = ` in a fluent message that is lacking a corresponding `#[note]` on the struct and not causing an error, but maybe it's possible?

r? ``@davidtwco``
fixes #124392
2024-05-02 19:42:48 +02:00
Matthias Krüger
f01e99f191
Rollup merge of #124138 - mati865:ignore-llvm-abi-in-dlltool-tests, r=davidtwco
Ignore LLVM ABI in dlltool tests since those targets don't use dlltool

Otherwise those two tests fail when running `./x.py test` with this target.
2024-05-02 19:42:47 +02:00
Ralf Jung
dba1849c22 interpret: hide some reexports in rustdoc 2024-05-02 18:47:36 +02:00
bors
a8773d53be Auto merge of #124621 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? `@Manishearth`
2024-05-02 16:01:46 +00:00
León Orell Valerian Liehr
09aa77299b
Cleanup: Rid the rmake test runners of extern crate run_make_support; 2024-05-02 17:57:23 +02:00
Waffle Lapkin
1c9a61d211 Don't use Ty::new_unit in miri 2024-05-02 17:50:51 +02:00
Waffle Lapkin
698d7a031e Inline & delete Ty::new_unit, since it's just a field access 2024-05-02 17:49:23 +02:00
lcnr
c4e882fd99 shallow resolve in orphan check 2024-05-02 15:44:05 +00:00
Philipp Krones
e395dc9000
Update Cargo.lock 2024-05-02 17:27:08 +02:00
Philipp Krones
15a648510d
Merge commit '20b085d500dfba5afe0869707bf357af3afe20be' into clippy-subtree-update 2024-05-02 17:26:44 +02:00
bors
9382ba4716 Auto merge of #124617 - GuillaumeGomez:rollup-eihxh6v, r=GuillaumeGomez
Rollup of 3 pull requests

Successful merges:

 - #124568 (Adjust `#[macro_export]`/doctest help suggestion for non_local_defs lint)
 - #124582 (always print nice 'std not found' error when std is not found)
 - #124597 (Use an explicit x86-64 cpu in tests that are sensitive to it)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-02 13:58:22 +00:00
Guillaume Gomez
1b0972cc61
Rollup merge of #124597 - cuviper:x86-64-v3, r=workingjubilee
Use an explicit x86-64 cpu in tests that are sensitive to it

There are a few tests that depend on some target features **not** being
enabled by default, and usually they are correct with the default x86-64
target CPU. However, in downstream builds we have modified the default
to fit our distros -- `x86-64-v2` in RHEL 9 and `x86-64-v3` in RHEL 10
-- and the latter especially trips tests that expect not to have AVX.

These cases are few enough that we can just set them back explicitly.
2024-05-02 15:11:23 +02:00
Guillaume Gomez
871f047c4c
Rollup merge of #124582 - RalfJung:std-not-found, r=Nilstrieb
always print nice 'std not found' error when std is not found

Fixes https://github.com/rust-lang/miri/issues/3529

Arguably Miri is doing something odd by letting people create no-std sysroots for arbitrary targets -- but equally arguably, there's no good reason for rustc to special-case the host triple here. Being a non-host triple does not imply the target is a no-std target, after all.
2024-05-02 15:11:22 +02:00
Guillaume Gomez
df9f8d0153
Rollup merge of #124568 - Urgau:non-local-defs-doctest, r=michaelwoerister,GuillaumeGomez
Adjust `#[macro_export]`/doctest help suggestion for non_local_defs lint

This PR adjust the help suggestion of the `non_local_definitions` lint when encountering a `#[macro_export]` at top-level doctest.

So instead of a non-sentential help suggestion to move the `macro_rules!` up above the `rustdoc`-generated function. We now suggest users to declare their own function.

Fixes *(partially, needs backport)* #124534
2024-05-02 15:11:22 +02:00
bors
20b085d500 Auto merge of #12745 - y21:collapsible_match_or_pat, r=llogiq
Suggest collapsing nested or patterns if the MSRV allows it

Nested `or` patterns have been stable since 1.53, so we should be able to suggest `Some(1 | 2)` if the MSRV isn't set below that.

This change adds an msrv check and also moves it to `matches/mod.rs`, because it's also needed by `redundant_guards`.

changelog: [`collapsible_match`]: suggest collapsing nested or patterns if the MSRV allows it
2024-05-02 12:57:59 +00:00
bors
c36918329f Auto merge of #12743 - CBSpeir:remove-paths-vec_resize, r=y21
Remove `dead_code` paths

The following paths are `dead_code` and can be removed:

### `clippy_utils::paths::VEC_RESIZE`
* Introduced when `vec_resize_to_zero` lint added in PR https://github.com/rust-lang/rust-clippy/pull/5637
* No longer used after commit 8acc4d2f1e
### `clippy_utils::paths::SLICE_GET`
* Introduced when `get_first` lint added in PR https://github.com/rust-lang/rust-clippy/pull/8882
* No longer used after commit a8d80d531f
### `clippy_utils::paths::STR_BYTES`
* Introduced when `bytes_count_to_len` lint added in PR https://github.com/rust-lang/rust-clippy/pull/8711
* No longer used after commit ba6a459528

When the lints were moved into the `Methods` lint pass, they switched from using paths to diagnostic items.  However, the paths were never removed.  This occurred in PR https://github.com/rust-lang/rust-clippy/pull/8957.

This relates to issue https://github.com/rust-lang/rust-clippy/issues/5393

changelog: none
2024-05-02 12:47:40 +00:00
bors
a2bd02b57e Auto merge of #12515 - bend-n:🦀, r=llogiq
fix `for x in y unsafe { }`

fixes #12514

----

changelog: [`needless_for_each`]: unsafe block in for loop body suggestion
2024-05-02 12:36:42 +00:00
bors
1325425589 Auto merge of #12748 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2024-05-02 12:26:02 +00:00
Philipp Krones
d878e0e8ee
Bump nightly version -> 2024-05-02 2024-05-02 14:21:32 +02:00
Philipp Krones
76b95fd249
Bump Clippy version -> 0.1.80 2024-05-02 14:21:19 +02:00
Philipp Krones
e8492355a3
Merge remote-tracking branch 'upstream/master' into rustup 2024-05-02 14:21:00 +02:00
bors
7eb380967e Auto merge of #12746 - oli-obk:bump_ui_test, r=blyxyas
Bump ui_test to 0.23

Notable changes: more control over run/rustfix/... and other rustc-specific features. All of these can in theory now be implemented entirely out of tree

changelog: none
2024-05-02 11:55:59 +00:00
bors
80451a485b Auto merge of #124419 - WaffleLapkin:never-type-fallback-docs, r=workingjubilee
Document never type fallback in `!`'s docs

Pulled the documentation I've written for #123939.

I want a single place where never type fallback is explained, which can be referred in all the lints and migration materials.
2024-05-02 11:54:53 +00:00
Oliver Scherer
dcfc3b5de1 Bump ui_test to 0.23 2024-05-02 12:44:40 +02:00
bors
546408be41 Auto merge of #12735 - xFrednet:changelog-1-78, r=dswij
Changelog for Clippy 1.78 🪄

Roses and Violets have colors,
Red and Blue are the two,
I'm getting to the end of my masters,
what a cool goal to pursue

---

### The cat of this release is: *Shadow* submitted by `@benwh1:`

<img height=500 src="https://github.com/rust-lang/rust-clippy/assets/32911992/c56af314-4644-482a-a08e-f32f4c7d7b22" alt="The cats of this Clippy release" />

Cats for the next release can be nominated in the comments :D

---

changelog: none
2024-05-02 10:19:15 +00:00
Fridtjof Stoldt
5c23f138dd
Apply suggestions from code review <3
Co-authored-by: Timo <30553356+y21@users.noreply.github.com>
2024-05-02 12:15:08 +02:00
bors
f5efc3c286 Auto merge of #124521 - Mark-Simulacrum:bootstrap-bump, r=albertlarsan68
Bump bootstrap compiler to latest beta

https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday

This also cherry-picks d716d72586548963f32e5c8d57c41db0065fa6e0 from the beta branching, to continue to workaround #122758.

r? bootstrap
2024-05-02 09:21:43 +00:00
Waffle Maybe
e18b6e819e
fixup links in never type docs
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
2024-05-02 06:04:16 +02:00
Christopher B. Speir
5e05821af3 Remove clippy_utils::paths::{SLICE_GET, STR_BYTES}
Both clippy_utils::paths::SLICE_GET and clippy_utils::paths::STR_BYTES
are dead_code and can therefore be removed.
2024-05-01 22:23:31 -05:00
Mark Rousskov
44988e2577 Workaround rustfmt bug replacing type ascription 2024-05-01 23:23:00 -04:00
y21
790fb9396a check for matches! macro directly in redundant_guards 2024-05-02 05:05:26 +02:00
y21
272413f458 allow or patterns for a high enough MSRV in collapsible_match 2024-05-02 04:45:45 +02:00
bors
fcc06c894b Auto merge of #123939 - WaffleLapkin:never-fallback-unsafe-lint, r=compiler-errors
Add a lint against never type fallback affecting unsafe code

~~I'm not very happy with the code quality... `VecGraph` not allowing you to get predecessors is very annoying. This should work though, so there is that.~~ (ended up updating `VecGraph` to support getting predecessors)

~~First few commits are from https://github.com/rust-lang/rust/pull/123934 https://github.com/rust-lang/rust/pull/123980~~
2024-05-02 02:41:40 +00:00
Waffle Lapkin
e2eb053bba Slightly reformat !'s docs after applying github suggestions 2024-05-02 04:19:43 +02:00
Mark Rousskov
a64f941611 Step bootstrap cfgs 2024-05-01 22:19:11 -04:00
Waffle Maybe
3a40e838bf
Apply suggestions from code review
Co-authored-by: Kevin Reid <kpreid@switchb.org>
Co-authored-by: Herman Skogseth <herman.skogseth@me.com>
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
2024-05-02 04:13:57 +02:00
Waffle Lapkin
b5626172d1 Split hir_typeck_never_type_fallback_flowing_into_unsafe into 5 slugs 2024-05-02 03:49:49 +02:00
Waffle Lapkin
0df43db50c Add proper support for all kinds of unsafe ops to the lint
(never_type_fallback_flowing_into_unsafe)
2024-05-02 03:49:49 +02:00
Waffle Lapkin
3c815a644c Add UnordMap::try_insert 2024-05-02 03:49:46 +02:00
Waffle Lapkin
fe9c5e6510 Reorganize uses 2024-05-02 03:47:32 +02:00
Maybe Waffle
b63cb6fd81 Add an explanation about never type fallback 2024-05-02 03:47:32 +02:00