Commit graph

277919 commits

Author SHA1 Message Date
cod10129
67f49010ad add tidy warning for unrecognized directives
This makes tidy warn on the presence of any directives it does not recognize.

There are changes in compiletest because that file used "tidy-alphabet" instead of "tidy-alphabetical".
2025-01-14 20:24:11 -06:00
bors
48a426eca9 Auto merge of #135384 - saethlin:inline-copy-from-slice, r=joboet
Add #[inline] to copy_from_slice

I'm doing cooked things to CGU partitioning for compiler-builtins (https://github.com/rust-lang/rust/pull/135395) and this was the lone symbol in my compiler-builtins rlib that wasn't an intrinsic. Adding `#[inline]` makes it go away.

Perf report indicates a marginal but chaotic effect on compile time, marginal improvement in codegen. As expected.
2025-01-12 20:16:25 +00:00
bors
627513a764 Auto merge of #135281 - onur-ozkan:build-stamps, r=jieyouxu
centralize build stamp logic

This PR brings all the stamp file handling into one place inside `build_stamp` module, which takes care of everything related to build stamps. By doing this, we cut down on duplicated code and types and keep the codebase easier to maintain and more consistent.

Main goals are:

- Make stamp handling stricter so we don't have to pass `Path`s around and manually `join` on arbitrary directories
- Keep all stamp-related logic in one place
- Make it easier to test and debug
- Avoid duplication
- Keep things simple and well-documented

Resolves #134962
2025-01-12 17:28:00 +00:00
bors
7bb9888953 Auto merge of #135402 - matthiaskrgr:rollup-cz7hs13, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #129259 (Add inherent versions of MaybeUninit methods for slices)
 - #135374 (Suggest typo fix when trait path expression is typo'ed)
 - #135377 (Make MIR cleanup for functions with impossible predicates into a real MIR pass)
 - #135378 (Remove a bunch of diagnostic stashing that doesn't do anything)
 - #135397 (compiletest: add erroneous variant to `string_enum`s conversions error)
 - #135398 (add more crash tests)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-12 14:43:10 +00: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
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
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
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
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
onur-ozkan
e3de3c767e use BuildStamp instead of std paths and strings
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:03 +03:00
onur-ozkan
58306c6a00 implement BuildStamp that is stricter impl for build stamps
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-12 08:43:00 +03:00
许杰友 Jieyou Xu (Joe)
1665b80b71 run-make-support: don't use lossy on TARGET_RPATH_DIR 2025-01-12 13:03:22 +08:00
许杰友 Jieyou Xu (Joe)
fec2e3ab1a 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`.
2025-01-12 13:03:22 +08:00
ltdk
e37daf0c86 Add inherent versions of MaybeUninit methods for slices 2025-01-11 23:57:00 -05:00
Scott McMurray
7396ec3edb Address PR feedback 2025-01-11 15:56:58 -08:00
Scott McMurray
6e34369ef6 [mir-opt] simplify Repeats that don't actually repeat the operand 2025-01-11 15:56:53 -08:00
Ben Kimock
cda566e226 Add #[inline] to copy_from_slice 2025-01-11 18:00:44 -05:00