Commit Graph

312378 Commits

Author SHA1 Message Date
Waffle Lapkin 6b4f4f57e7 bless a mir-opt and a miri tests 2025-12-26 22:02:19 +01:00
Waffle Lapkin d42f7ea7ca fixup debugger files wrt to MaybeDangling
- fixup `BTreeMap` gdb provider
- fixup `ManuallyDrop` natvis thingy

Now that `MaybeUninit` contains `ManuallyDrop` which contains
`MaybeDangling` (tbc this is the addition), we need to unwrap one more
layer.
2025-12-26 22:02:17 +01:00
Waffle Lapkin 722e3102a2 use MaybeDangling in ManuallyDrop 2025-12-17 22:26:52 +01:00
Waffle Lapkin 4ea5cac7d4 add MaybeDangling to core
Co-authored-by: Ralf Jung <post@ralfj.de>
2025-12-17 22:26:47 +01:00
bors 83e49b75e7 Auto merge of #149591 - matthiaskrgr:rollup-b3zm9ke, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#148918 (Remove an outdated test)
 - rust-lang/rust#149244 (Fix std::mem::drop rustdoc misleading statement)
 - rust-lang/rust#149532 (Rename supertrait item shadowing lints)
 - rust-lang/rust#149541 (Various never type test improvements)
 - rust-lang/rust#149590 (linker: Remove special case for `rust-lld` in `detect_self_contained_mingw`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-03 15:13:56 +00:00
Matthias Krüger 2cc93b898b Rollup merge of #149590 - petrochenkov:norlld, r=mati865
linker: Remove special case for `rust-lld` in `detect_self_contained_mingw`

`rust-lld` is supposed to live inside sysroot, so it doesn't change the behavior of the function, only removes a potential micro-optimization.

https://github.com/rust-lang/rust/pull/149178#issuecomment-3570619496
r? `@mati865`
2025-12-03 13:05:16 +01:00
Matthias Krüger a2aa4f08da Rollup merge of #149541 - WaffleLapkin:never-test, r=lcnr
Various never type test improvements

I want to make sure that the never type ui tests are actually sensible, and to do so I'm trying to clean them up. This mainly adds comments explaining test purposes and removes outdated stuff.

I imagine best reviewed commit-by-commit, I tried to write useful descriptions and group things into small commits.

cc `@lcnr` (I removed `fallback`/`nofallback` terminology in b5f82d4716d0d978b89034c902f88e2d449da636)
2025-12-03 13:05:15 +01:00
Matthias Krüger 49e31cc494 Rollup merge of #149532 - Amanieu:supertrait-shadowing-lints, r=lqd
Rename supertrait item shadowing lints

This follows the lang team decision [here](https://github.com/rust-lang/rust/pull/148605#issuecomment-3525414326) and renames:
- `supertrait_item_shadowing_definition` to `shadowing_supertrait_items`
- `supertrait_item_shadowing_usage` to `resolving_to_items_shadowing_supertrait_items`

The lint levels are left unchanged as allow-by-default until stabilization.
2025-12-03 13:05:14 +01:00
Matthias Krüger 1d3d73ee5a Rollup merge of #149244 - spastorino:fix-mem-drop-rustdoc, r=ChrisDenton
Fix std::mem::drop rustdoc misleading statement

This is a bit misleading, we were discussing this with our Rust team and some people could think that the compiler does some special magic for this specific function and that's not true or well the compiler does something special but for every function.
The reality according to my understanding is that this is a normal function that takes ownership of the given value and as with every other function mir building injects Drop Terminators , drop elaboration refines this and then we would insert the corresponding drop glue, then potentially calling Drop::drop.

Not sure if it would be best to remove the sentence as this PR does or explaining something along the lines of the previous text.
2025-12-03 13:05:13 +01:00
Matthias Krüger f6f7ddddd5 Rollup merge of #148918 - WaffleLapkin:tryfromwhattttt, r=jdonszelmann
Remove an outdated test

This... is a weird test.

It has two impls:
- `impl<T> From<Foo<T>> for Box<T>` (commented out, more on that later), and
- `impl<T> Into<Vec<T>> for Foo<T>`

The idea of that test is to show that the first impl doesn't compile, but the second does, thus `TryFrom` should be using `Into` and not `From` (because `Into` is more general, since the `From` impl doesn't compile).

However:
1. The types are different -- `Box` vs `Vec`, which is significant b/c `Box` is fundamental
2. The commented out impl actually compiles! (which wasn't detected b/c it's commented out :\ )

Here is a table for compilation of the impls:

|        | `Vec`        | `Box`          |
|--------|--------------|----------------|
| `From` | since 1.41.0 | never          |
| `Into` | always       | not since 1.28 |

[godbolt used to test this](https://godbolt.org/z/T38E3jGKa)

Order of events:
1. in `1.28` the `incoherent_fundamental_impls` lint becomes deny by default (this is *not* mentioned in the changelog yay)
2. `1.32` changed absolutely nothing, even though this version is credited in the test
3. the test was added (I'm not exactly sure when) (see https://github.com/rust-lang/rust/pull/56796)
4. in `1.41` coherence was relaxed to allow `From`+`Vec` to compile

To conclude: since `1.41` this test does nothing (and before that it was written in a way which did not detect this change). It looks to me like today (since `1.41`) we *could* bound `TryFrom` impl with `From` (but now it'd be a useless breaking change of course).

Am I missing anything? Is there a useful version of this test that could be written?
2025-12-03 13:05:13 +01:00
bors 568b117627 Auto merge of #149555 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

14 commits in 2a7c4960677971f88458b0f8b461a866836dff59..bd979347d814dfe03bba124165dbce9554d0b4d8
2025-11-25 19:58:07 +0000 to 2025-12-02 16:03:50 +0000
- fix(completion): Put host-tuple before actual tuples (rust-lang/cargo#16327)
- fix(lints): use plural form correctly (rust-lang/cargo#16324)
- fix(completions): include `all` in `cargo tree --target` candidates (rust-lang/cargo#16322)
- fix(lints): show lint error number (rust-lang/cargo#16320)
- chore(deps): update compatible (rust-lang/cargo#16318)
- chore(deps): update crate-ci/typos action to v1.40.0 (rust-lang/cargo#16316)
- Do not lock the artifact-dir for check builds + fix uplifting (rust-lang/cargo#16307)
- Properly validate crate names in `cargo install` (rust-lang/cargo#16314)
- Support --filter-platform=host for cargo metadata rust-lang/cargo#9423 (rust-lang/cargo#16312)
- Update to mdbook 0.5 (rust-lang/cargo#16292)
- refactor(clean): Better divide old / new layout (rust-lang/cargo#16304)
- update: silent failure on non-matching package specs with --breaking (rust-lang/cargo#16276)
- fix(log): break timing-info message to multiple (rust-lang/cargo#16303)
- fix(clean): Clean hosts builds with new layout (rust-lang/cargo#16300)
2025-12-03 12:04:40 +00:00
Vadim Petrochenkov 388c42e72a linker: Remove special case for rust-lld in detect_self_contained_mingw
`rust-lld` is supposed to live in sysroot, so it doesn't change the behavior of the function, only removes a potential micro-optimization.
2025-12-03 14:10:54 +03:00
bors 8202d11051 Auto merge of #149581 - matthiaskrgr:rollup-w4dixyc, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#148937 (Remove initialized-bytes tracking from `BorrowedBuf` and `BorrowedCursor`)
 - rust-lang/rust#149553 (added default_uwtables=true to aarch64_unknown_none targets)
 - rust-lang/rust#149578 (rustdoc: Fix broken link to `Itertools::format`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-03 07:56:09 +00:00
Matthias Krüger 7432e9ed6c Rollup merge of #149578 - lapla-cogito:rustdoc_iterformat, r=notriddle
rustdoc: Fix broken link to `Itertools::format`

close rust-lang/rust#148879
2025-12-03 07:36:14 +01:00
Matthias Krüger 7029f47452 Rollup merge of #149553 - BartMassey-upstream:aarch64-none-default-uwtables, r=wesleywiser
added default_uwtables=true to aarch64_unknown_none targets

This patch adds DWARF unwinding tables by default for `aarch64-unknown-none` and `aarch64-unknown-none-softfloat` targets. By implication, the `core` library for these targets will be built with unwinding tables. These tables are often useful, and are especially needed for backtracing through `core` on embedded targets. The tables can be turned off for user compilation with `-C force-unwind-tables=no` if desired.

(I am the lead maintainer for these targets in the Rust Embedded Working Group, and have discussed this with REWG.)
2025-12-03 07:36:13 +01:00
Matthias Krüger 45b2a711b1 Rollup merge of #148937 - joshtriplett:borrowed-buf-no-init-tracking, r=Amanieu
Remove initialized-bytes tracking from `BorrowedBuf` and `BorrowedCursor`

As discussed extensively in libs-api, the initialized-bytes tracking primarily benefits calls to `read_buf` that end up initializing the buffer and calling `read`, at the expense of calls to `read_buf` that *don't* need to initialize the buffer. Essentially, this optimizes for the past at the expense of the future. If people observe performance issues using `read_buf` (or something that calls it) with a given `Read` impl, they can fix those performance issues by implementing `read_buf` for that `Read`.

Update the documentation to stop talking about initialized-but-unfilled bytes.

Remove all functions that just deal with those bytes and their tracking, and remove usage of those methods.

Remove `BorrowedCursor::advance` as there's no longer a safe case for advancing within initialized-but-unfilled bytes. Rename `BorrowedCursor::advance_unchecked` to `advance`.

Update tests.

r? ``@Amanieu``
2025-12-03 07:36:12 +01:00
lapla 8949b816ee rustdoc: Fix broken link to Itertools::format 2025-12-03 12:56:30 +09:00
bors 672388edbe Auto merge of #149577 - ehuss:update-reference, r=ehuss
Update reference

Pulls in https://github.com/rust-lang/reference/pull/2080 to fix the tests.

Closes https://github.com/rust-lang/rust/issues/149575
2025-12-03 03:30:16 +00:00
Eric Huss 880a779999 Update reference
Pulls in https://github.com/rust-lang/reference/pull/2080 to fix the tests.
2025-12-02 19:27:15 -08:00
bors a4cfac7093 Auto merge of #149560 - matthiaskrgr:rollup-lce3baq, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#146436 (Slice iter cleanup)
 - rust-lang/rust#148250 (array_chunks: slightly improve docs)
 - rust-lang/rust#148678 (Merge E0412 into E0425)
 - rust-lang/rust#149520 (also introduce Peekable::next_if_map_mut next to next_if_map)
 - rust-lang/rust#149538 (std: sys: fs: uefi: Make time in FileAttr optional)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-02 21:24:42 +00:00
Matthias Krüger 3b99d6b92e Rollup merge of #149538 - Ayush1325:uefi-fs-time-fix, r=joboet
std: sys: fs: uefi: Make time in FileAttr optional

At least on OVMF, some files copied over from linux file system seem to have invalid time (year = 1980 and everything else 0). Since Rust allows time to be optional, and we can return error, that seems to be the way to go for now.

`@rustbot` label +O-UEFI
2025-12-02 22:02:34 +01:00
Matthias Krüger c67a7790e8 Rollup merge of #149520 - jdonszelmann:new-map-if, r=joboet
also introduce Peekable::next_if_map_mut next to next_if_map

As requested in https://github.com/rust-lang/rust/pull/148941#issuecomment-3577174350 by ``@joshtriplett``
2025-12-02 22:02:31 +01:00
Matthias Krüger 02434fe718 Rollup merge of #148678 - xonx4l:EO412_replacement_with_EO425, r=Kivooeo
Merge E0412 into E0425

This PR merge E0412 into E0425  as both mean the same thing to users.

This fixes https://github.com/rust-lang/rust/issues/148558.
2025-12-02 22:02:30 +01:00
Matthias Krüger 9955b04971 Rollup merge of #148250 - hkBst:array-chunks-docs, r=joboet
array_chunks: slightly improve docs
2025-12-02 22:02:29 +01:00
Matthias Krüger 38d5d2877e Rollup merge of #146436 - hkBst:slice-iter-1, r=joboet
Slice iter cleanup
2025-12-02 22:02:28 +01:00
Weihang Lo e778ec5311 Update cargo submodule 2025-12-02 14:31:07 -05:00
xonx4l 4b000cfacd Merge E0412 into E0425 2025-12-02 18:25:13 +00:00
Bart Massey 48002fc0b2 added default_uwtables=true to aarch64_unknown_none targets 2025-12-02 09:58:45 -08:00
Amanieu d'Antras e833f244fa Rename supertrait item shadowing lints 2025-12-02 17:21:01 +00:00
bors 646a3f8c15 Auto merge of #149125 - zachs18:btreemap-eq-perf, r=workingjubilee
In `BTreeMap::eq`, do not compare the elements if the sizes are different.

Reverts rust-lang/rust#147101 in library/alloc/src/btree/

rust-lang/rust#147101 replaced some instances of code like `a.len() == b.len() && a.iter().eq(&b)` with just `a.iter().eq(&b)`, but the optimization that PR introduced only applies for `TrustedLen` iterators, and `BTreeMap`'s itertors are not `TrustedLen`, so this theoretically regressed perf for comparing large `BTreeMap`/`BTreeSet`s with unequal lengths but equal prefixes, (and also made it so that comparing two different-length `BTreeMap`/`BTreeSet`s with elements whose `PartialEq` impls that can panic now can panic, though this is not a "promised" behaviour either way (cc rust-lang/rust#149122))

Given that `TrustedLen` is an unsafe trait, I opted to not implement it for `BTreeMap`'s iterators, and instead just revert the change. If someone else wants to audit `BTreeMap`'s iterators to make sure they always return the right number of items (even in the face of incorrect user `Ord` impls) and then implement `TrustedLen` for them so that the optimization works for them, then this can be closed in favor of that (or if the perf regression is deemed too theoretical, this can be closed outright).

Example of theoretical perf regression: https://play.rust-lang.org/?version=beta&mode=release&edition=2024&gist=a37e3d61e6bf02669b251315c9a44fe2 (very rough estimates, using `Instant::elapsed`).
In release mode on stable the comparison takes ~23.68µs.
In release mode on beta/nightly the comparison takes ~48.351057ms.
2025-12-02 17:04:58 +00:00
Ayush Singh 1331c35f02 std: sys: fs: uefi: Make time in FileAttr optional
At least on OVMF, some files copied over from linux file system seem
to have invalid time (year = 1980 and everything else 0). Since Rust
allows time to be optional and we can return error, that seems to be
the way to go for now.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-12-02 22:34:47 +05:30
Waffle Lapkin cb5318d037 stop using "nofallback" revision terminology 2025-12-02 17:46:28 +01:00
Waffle Lapkin 3f606fac00 minor test improvements 2025-12-02 17:46:28 +01:00
Waffle Lapkin 7d33e7e091 clarify purposes of tests 2025-12-02 17:46:24 +01:00
Josh Triplett 1ef636d61a Update other targets for BorrowedCursor unstable API changes 2025-12-02 08:03:10 -08:00
bors eca9d93f90 Auto merge of #149529 - Muscraft:update-annotate-snippets, r=jieyouxu
chore: Update annotate-snippets to 0.12.10

This PR updates `annotate-snippets` to `0.12.10`, which [includes a fix](https://github.com/rust-lang/annotate-snippets-rs/blob/756366223cbf72b161757aec18209f21b3d19049/CHANGELOG.md#fixed) that modifies some test output.
2025-12-02 13:55:16 +00:00
Waffle Lapkin e9873435a3 merge diverging-fallback-no-leak into an existing test 2025-12-02 13:41:51 +01:00
Waffle Lapkin b1efa8e579 stylistic test changes 2025-12-02 13:41:51 +01:00
Waffle Lapkin 0104d69e4b move tests/ui/{never => never_type}/*
there are only 1 test in that directory, probably created by mistake.
2025-12-02 13:34:51 +01:00
Waffle Lapkin 109b6de8fc remove outdated tests
I don't think they are testing anything anymore
2025-12-02 13:34:51 +01:00
Waffle Lapkin 8c8d930714 delete a duplicate test
Duplicate of `from_infer_breaking_with_unit_fallback.rs` and
`question_mark_from_never.rs`
2025-12-02 13:34:51 +01:00
Waffle Lapkin 5dec6b3a56 refactor test for note on !: Tr error 2025-12-02 13:34:51 +01:00
bors a80d39a086 Auto merge of #149504 - mati865:i686-pc-windows-gnullvm, r=jieyouxu
Bring back i686-pc-windows-gnullvm target

rust-lang/rust#148751 inadvertently removed i686-pc-windows-gnullvm std build when migrating to native CI runners. Since this change was not agreed upon, we should bring back prebuilt std builds for that target.

There are a few runners that could do it: dist-aarch64-llvm-mingw, dist-x86_64-llvm-mingw, dist-various-1 and dist-various-2.
dist-x86_64-llvm-mingw already takes slightly over 2 hours, so the faster dist-aarch64-llvm-mingw is a better choice.
We can also use dist-various-x job, they don't have llvm-mingw toolchain, but it's trivial to install one.
2025-12-02 10:42:35 +00:00
Waffle Lapkin 98430c4d9d remove unused features from some tests 2025-12-02 11:07:42 +01:00
Waffle Lapkin 0cbb9e6891 expand never type gate test 2025-12-02 11:07:42 +01:00
Waffle Lapkin e6d2b2add7 refactor Box<! -> dyn Error> regression test 2025-12-02 11:07:42 +01:00
Waffle Lapkin 3432ff9a1d remove test for T -> ! coercion
We used to allow `T -> !` coercions (yes!! not `! -> T`) in unreachable
code. This was later removed during 2018 stabilization attempt, see:
- https://github.com/rust-lang/rust/issues/40800
- https://github.com/rust-lang/rust/pull/47630/commits/59688e119e1b9c2506fa9173728ae88eb196bf5e
- https://github.com/rust-lang/rust/issues/46325

I've kept `tests/ui/coercion/coerce-to-bang-cast.rs`, as that is a
reasonable test for us *not* having `-> !` coercions.
2025-12-02 11:07:42 +01:00
Waffle Lapkin 140832aa59 update readme wrt never type tests 2025-12-02 11:07:42 +01:00
Josh Triplett 382509988b Remove initialized-bytes tracking from BorrowedBuf and BorrowedCursor
As discussed extensively in libs-api, the initialized-bytes tracking
primarily benefits calls to `read_buf` that end up initializing the
buffer and calling `read`, at the expense of calls to `read_buf` that
*don't* need to initialize the buffer. Essentially, this optimizes for
the past at the expense of the future. If people observe performance
issues using `read_buf` (or something that calls it) with a given `Read`
impl, they can fix those performance issues by implementing `read_buf`
for that `Read`.

Update the documentation to stop talking about initialized-but-unfilled
bytes.

Remove all functions that just deal with those bytes and their tracking,
and remove usage of those methods.

Remove `BorrowedCursor::advance` as there's no longer a safe case for
advancing within initialized-but-unfilled bytes. Rename
`BorrowedCursor::advance_unchecked` to `advance`.

Update tests.
2025-12-02 01:32:27 -08:00
bors 47cd7120d9 Auto merge of #147634 - fmease:mv-var-to-dyn-buf-lints-next, r=jdonszelmann
Move even more early buffered lints to dyn lint diagnostics

Follow-up to https://github.com/rust-lang/rust/pull/145881 and https://github.com/rust-lang/rust/pull/145747.

I originally wanted to migrate most if not the entire rest of the early buffered lints. However, when trying to migrate the buffered lints used by check-cfg I encountered a roadblock. Namely, it depends on `TyCtxt` (well, `Option<TyCtxt>`) which makes it quite hard to migrate (see also https://github.com/rust-lang/rust/pull/147634#issuecomment-3398174584, https://github.com/rust-lang/rust/pull/147634#issuecomment-3398207128 & rust-lang/rust#149215).

So for now, I won't migrate it (maybe rust-lang/rust#149215 will find a solution), nor will I migrate the rest since it's quite tedious to migrate these. I'll leave them for future me.
2025-12-02 07:33:36 +00:00