1
Fork 0
Commit graph

278450 commits

Author SHA1 Message Date
Ralf Jung
675a1036ca on Windows, consistently pass ZST by-ref 2025-01-12 13:32:36 +01:00
spore
74e2e8b598 Suggest the smallest fitting type instead
Changes the behavior of the `overflowing_literals` suggestion so that it
always suggest the smallest type regardless of the original type size.
2025-01-12 20:20:39 +08:00
bors
c0f6a1ce3f Auto merge of #135262 - mrkajetanp:ci-aarch64-dist-reland, r=Kobzol
ci: Move dist-aarch64-linux to an aarch64 runner

Move the dist-aarch64-linux CI job to an aarch64 runner instead of cross-compiling it from an x86 one. This will make it possible to perform optimisations such as LTO, PGO and BOLT later on.

r? `@Kobzol`

Reland of #133809 now that the higher page sizes are fixed.

try-job: dist-aarch64-linux
try-job: dist-x86_64-linux
try-job: dist-i686-linux
2025-01-12 11:56:04 +00:00
spore
f52724c917 Add comment on case to mark the original issue 2025-01-12 19:50:01 +08:00
Matthias Krüger
2fd11d0042
Rollup merge of #135398 - matthiaskrgr:crash, r=lqd
add more crash tests

try-job: aarch64-apple
try-job: x86_64-msvc
try-job: x86_64-gnu
try-job: dist-i586-gnu-i586-i686-musl
2025-01-12 12:07:59 +01:00
Matthias Krüger
1b45dad34e
Rollup merge of #135397 - lqd:compiletest-enums, r=jieyouxu
compiletest: add erroneous variant to `string_enum`s conversions error

As requested in #135392, this adds which variant caused the string conversion failure.

r? jieyouxu
fixes #135392
2025-01-12 12:07:59 +01:00
Matthias Krüger
b53239668a
Rollup merge of #135378 - compiler-errors:unnecessary-stashing, r=chenyukang
Remove a bunch of diagnostic stashing that doesn't do anything

#121669 removed a bunch of conditional diagnostic stashing/canceling, but left around the `steal` calls which just emitted the error eagerly instead of canceling the diagnostic. I think that these no-op `steal` calls don't do much and are confusing to encounter, so let's remove them.

The net effect is:
1. We emit more duplicated errors, since stashing has the side effect of duplicating diagnostics. This is not a big deal, since outside of `-Zdeduplicate-diagnostics=no`, the errors are already being deduplicated by the compiler.
2. It changes the order of diagnostics, since we're no longer stashing and then later stealing the errors. I don't think this matters much for the changes that the UI test suite manifests, and it makes these errors less order dependent.
2025-01-12 12:07:58 +01:00
Matthias Krüger
988137c040
Rollup merge of #135377 - compiler-errors:impossible-step, r=oli-obk
Make MIR cleanup for functions with impossible predicates into a real MIR pass

It's a bit jarring to see the body of a function with an impossible-to-satisfy where clause suddenly go to a single `unreachable` terminator when looking at the MIR dump output in order, and I discovered it's because we manually replace the body outside of a MIR pass.

Let's make it into a fully flegded MIR pass so it's more clear what it's doing and when it's being applied.
2025-01-12 12:07:58 +01:00
Matthias Krüger
55503a1d0e
Rollup merge of #135374 - compiler-errors:typo-trait-method, r=fee1-dead
Suggest typo fix when trait path expression is typo'ed

When users write something like `Default::defualt()` (notice the typo), failure to resolve the erroneous `defualt` item will cause resolution + lowering to interpret this as a type-dependent path whose self type is `Default` which is a trait object without `dyn`, rather than a trait function like `<_ as Default>::default()`.

Try to provide a bit of guidance in this situation when we can detect the typo.

Fixes https://github.com/rust-lang/rust/issues/135349
2025-01-12 12:07:57 +01:00
Matthias Krüger
08968a4baf
Rollup merge of #129259 - clarfonthey:maybe_uninit_slices, r=tgross35
Add inherent versions of MaybeUninit methods for slices

This is my attempt to un-stall #63569 and #79995, by creating methods that mirror the existing `MaybeUninit` API:

```rust
impl<T> MaybeUninit<T> {
    pub fn write(&mut self, value: T) -> &mut T;
    pub fn as_bytes(&self) -> &[MaybeUninit<u8>];
    pub fn as_bytes_mut(&mut self) -> &mut [MaybeUninit<u8>];
    pub unsafe fn assume_init_drop(&mut self);
    pub unsafe fn assume_init_ref(&self) -> &T;
    pub unsafe fn assume_init_mut(&mut self) -> &mut T;
}
```

Adding these APIs:

```rust
impl<T> [MaybeUninit<T>] {
    // replacing copy_from_slice; renamed to avoid conflict
    pub fn write_copy_of_slice(&mut self, value: &[T]) -> &mut [T] where T: Copy;

    // replacing clone_from_slice; renamed to avoid conflict
    pub fn write_clone_of_slice(&mut self, value: &[T]) -> &mut [T] where T: Clone;

    // identical to non-slice versions; no conflict
    pub fn as_bytes(&self) -> &[MaybeUninit<u8>];
    pub fn as_bytes_mut(&mut self) -> &mut [MaybeUninit<u8>];
    pub unsafe fn assume_init_drop(&mut self);
    pub unsafe fn assume_init_ref(&self) -> &[T];
    pub unsafe fn assume_init_mut(&mut self) -> &mut [T];
}
```

Since the `assume_init` methods are identical to those on non-slices, they feel pretty natural. The main issue with the write methods is naming, as discussed in #79995 among other places. My rationale:

* The term "write" should be in them somewhere, to mirror the other API, and this pretty much automatically makes them not collide with any other inherent slice methods.
* I chose `write_clone_of_slice` and `write_copy_of_slice` since `clone` and `copy` are being used as objects here, whereas they're being used as actions in `clone_from_slice` and `copy_from_slice`.

The final "weird" thing I've done in this PR is remove a link to `Vec<T>` from `assume_init_drop` (both copies, since they're effectively copied docs), since there's no good way to link to `Vec` for something that can occur both on the page for `std/primitive.slice.html` and `std/vec/struct.Vec.html`, since the code here lives in libcore and can't use intra-doc-linking to mention `Vec`. (see: #121436)

The reason why this method shows up both on `Vec<T>` and `[T]` is because the `[T]` docs are automatically inlined on `Vec<T>`'s page, since it implements `Deref`. It's unfortunate that rustdoc doesn't have a way of dealing with this at the moment, but it is what it is, and it's a reasonable compromise for now.
2025-01-12 12:07:57 +01:00
Josh Triplett
ad550f86e5 Remove some empty expected files to fix blessing
https://github.com/rust-lang/rust/pull/134808 made --bless remove empty
expected files. Remove some empty files that were causing noise in
unrelated `--bless` invocations.
2025-01-12 12:49:24 +02:00
Matthias Krüger
ee4cca8702 add more crash tests 2025-01-12 10:11:29 +01:00
bors
1b41e8406b Auto merge of #135396 - matthiaskrgr:rollup-zublg1c, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #135266 (Remove emsdk version update from 1.84.0 relnotes)
 - #135364 (Cleanup `suggest_binding_for_closure_capture_self` diag in borrowck)
 - #135375 (allow rustdoc-js tests to be run at stage0)
 - #135379 (Make (unstable API) `UniqueRc` invariant for soundness)
 - #135389 (compiletest: include stage0-sysroot libstd dylib in recipe dylib search path)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-12 09:10:08 +00:00
Matthias Krüger
13805491b2
Rollup merge of #135389 - jieyouxu:fix-stage0-rustdoc-rmake, r=onur-ozkan
compiletest: include stage0-sysroot libstd dylib in recipe dylib search path

To fix some of the failures in `COMPILETEST_FORCE_STAGE0=1 ./x test run-make --stage 0`. Specifically,

```
COMPILETEST_FORCE_STAGE0=1 ./x test tests/run-make/rustdoc-default-output/ --stage 0
```

should now pass.

Fixes #135373. (As in, make *some* of the `run-make` tests pass, other `run-make` tests fail for various reasons against stage0, and generally `run-make` tests are not guaranteed to pass at stage 0.)

cc `@lolbinarycat`

r? bootstrap
2025-01-12 09:14:14 +01:00
Matthias Krüger
89a7282000
Rollup merge of #135379 - steffahn:uniquerc-invariant, r=Mark-Simulacrum
Make (unstable API) `UniqueRc` invariant for soundness

Add test case from https://github.com/rust-lang/rust/pull/133572#issuecomment-2543007164 (comment in review of `UniqueArc`), and fix the issue for `UniqueRc`.
2025-01-12 09:14:13 +01:00
Matthias Krüger
6fa92eaf03
Rollup merge of #135375 - lolbinarycat:bootstrap-allow-stage0-rustdoc-js, r=jieyouxu
allow rustdoc-js tests to be run at stage0

this mirrors the behavior of rustdoc-js-std tests.

previously this required COMPILETEST_FORCE_STAGE0.
2025-01-12 09:14:13 +01:00
Matthias Krüger
fcf81b8cc3
Rollup merge of #135364 - yotamofek:borrowck-diag-fix, r=compiler-errors
Cleanup `suggest_binding_for_closure_capture_self` diag in borrowck

Mostly grammar fix/improvement, but also a small cleanup to use iterators instead of for loops for collecting into a vector.
2025-01-12 09:14:12 +01:00
Matthias Krüger
a18a71b92c
Rollup merge of #135266 - kadiwa4:no_emsdk_update, r=Mark-Simulacrum
Remove emsdk version update from 1.84.0 relnotes

See [this comment](https://github.com/rust-lang/rust/issues/131467#issuecomment-2529314603). The reproducer in that comment does indeed show that rustup's `rust-std` component is still compiled with the old emscripten ABI because libc's config flag `emscripten_new_stat_abi` is not set.

#131533 presumably had no effect because the wrong CI file was modified. So nothing has changed since 1.83.0. The PR author (workingjubilee) is currently on vacation.
Also the issue #131467 should be reopened.
2025-01-12 09:14:11 +01:00
Rémy Rakic
33ce74f308 add error message to string_enum!s string conversions 2025-01-12 08:13:45 +00:00
Rémy Rakic
d19bdf9b48 add test for string_enum 2025-01-12 08:05:50 +00:00
Rémy Rakic
8ac045dd4c move out of scope precomputer code
this addresses review comments while:
- keeping the symmetry between the NLL and Polonius out of scope
  precomputers
- keeping the unstable `calculate_borrows_out_of_scope_at_location`
  function to avoid churn for consumers
2025-01-12 07:39:20 +00:00
Rémy Rakic
735013d281 remove location-insensitive ICE test 2025-01-12 07:29:03 +00:00
Rémy Rakic
0f3dd33e1d deal with naive reachability weakness
it's a bit mind-bending
2025-01-12 07:29:03 +00:00
Rémy Rakic
550cf1f4a4 handle kills in reachability 2025-01-12 07:29:03 +00:00
Rémy Rakic
67a1bb1554 replace location-insensitive analysis with location-sensitive analysis
we're in in the endgame now

set up the location-sensitive analysis end to end:
- stop recording inflowing loans and loan liveness in liveness
- replace location-insensitive liveness data with live loans computed by
  reachability
- remove equivalence between polonius scopes and NLL scopes, and only
  run one scope computation
2025-01-12 07:29:03 +00:00
Rémy Rakic
0c978bc4e6 introduce reachability to the constraint graph 2025-01-12 07:29:03 +00:00
Rémy Rakic
5055864071 disable NLL liveness optimization when using polonius
in NLLs some locals are marked live at all points if one of their
regions escapes the function but that doesn't work in a flow-sensitive
setting like polonius
2025-01-12 07:29:03 +00:00
onur-ozkan
2a4bcf597b update doc-comment of BuildStamp::add_stamp
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 10:15:36 +03:00
bors
13f3924c67 Auto merge of #135322 - scottmcm:inst-simplify-repeat-one, r=oli-obk
[mir-opt] simplify `Repeat`s that don't actually repeat the operand

Created because when I was writing this case in GVN

https://github.com/rust-lang/rust/pull/133324/files#diff-292b215fdc6b59e3f3c4173c2270b14591c5673832fbfb05cd69a05c2ef0c30eR977-R979

I happened to notice that it worked for `[x]` but not for `[x; 1]`, so figured it would be good to simplify that `Repeat` to the simpler `Aggregate`.
2025-01-12 06:22:49 +00:00
binarycat
d5f592ad58 rename run_js_doc_test to run_rustdoc_js_test 2025-01-12 00:21:31 -06:00
onur-ozkan
b03fba7ab4 rename done_stamp to lld_stamp
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:53:22 +03:00
onur-ozkan
b54d65230f rustc-dev-guide: update outdated LLVM stamp filename
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:47:57 +03:00
onur-ozkan
fae26e7ffa add change entry for renamings
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:46:58 +03:00
onur-ozkan
9611d8ea13 avoid magical AsRef<Path> implementation
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:51 +03:00
onur-ozkan
dcc001adbb refactor with_stamp as add_stamp for incrementality
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:48 +03:00
onur-ozkan
99322a5158 extend sanitizers stamp calculation
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:45 +03:00
onur-ozkan
216969b8c2 run git only inside the current directory
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:42 +03:00
onur-ozkan
ffd4c5b51c migrate lld build stamp
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:40 +03:00
onur-ozkan
bdb7518203 apply minor improvements on build_stamp
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:37 +03:00
onur-ozkan
375165259c auto label A-bootstrap-stamp
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:34 +03:00
onur-ozkan
a72068adee migrate program_out_of_date to BuildStamp::is_up_to_date
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:32 +03:00
onur-ozkan
9878d63acb add coverage for BuildStamp::with_prefix
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:29 +03:00
onur-ozkan
1fa66573cd fix an invalid prefix usage on enzyme
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:26 +03:00
onur-ozkan
9e86d76ad9 fix compiler errors
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:24 +03:00
onur-ozkan
615131b4d4 migrate generate_smart_stamp_hash
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:21 +03:00
onur-ozkan
cacb4fe93a add test coverage for build_stamp implementation
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:16 +03:00
onur-ozkan
9e1c9fd654 document build_stamp implementation
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:13 +03:00
onur-ozkan
236d5804bf migrate Builder::clear_if_dirty
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:11 +03:00
onur-ozkan
9e929754b2 migrate helper stamp functions
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:08 +03:00
onur-ozkan
c68c721b50 migrate HashStamp to BuildStamp
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:05 +03:00