Commit Graph

248905 Commits

Author SHA1 Message Date
许杰友 Jieyou Xu (Joe)
5877e7e8d2
Error on invalid compiletest directives in Rust test files 2024-03-10 13:13:09 +00:00
bors
3521a2f2f3 Auto merge of #122246 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`

`@WaffleLapkin` when this lands, setting `MIRI_TEMP` should not be needed any more on the dev desktops.
2024-03-10 09:40:39 +00:00
bors
094a6204f5 Auto merge of #122064 - Zoxc:dep-graph-encode-tweaks, r=cjgillot
Dep node encoding cleanups

This does some cleanups around dep node encoding.

Performance change with `-Zthreads=2`:

<table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th><td align="right">Memory</td><td align="right">Memory</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check:unchanged</td><td align="right">0.4337s</td><td align="right">0.4306s</td><td align="right"> -0.72%</td><td align="right">88.90 MiB</td><td align="right">89.04 MiB</td><td align="right"> 0.15%</td></tr><tr><td>🟣 <b>hyper</b>:check:unchanged</td><td align="right">0.1541s</td><td align="right">0.1528s</td><td align="right"> -0.86%</td><td align="right">51.99 MiB</td><td align="right">52.03 MiB</td><td align="right"> 0.07%</td></tr><tr><td>🟣 <b>regex</b>:check:unchanged</td><td align="right">0.3286s</td><td align="right">0.3248s</td><td align="right">💚  -1.15%</td><td align="right">71.89 MiB</td><td align="right">71.74 MiB</td><td align="right"> -0.21%</td></tr><tr><td>🟣 <b>syn</b>:check:unchanged</td><td align="right">0.6118s</td><td align="right">0.6057s</td><td align="right">💚  -1.01%</td><td align="right">106.59 MiB</td><td align="right">106.66 MiB</td><td align="right"> 0.06%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check:unchanged</td><td align="right">1.4570s</td><td align="right">1.4463s</td><td align="right"> -0.74%</td><td align="right">197.29 MiB</td><td align="right">197.33 MiB</td><td align="right"> 0.02%</td></tr><tr><td>Total</td><td align="right">2.9852s</td><td align="right">2.9601s</td><td align="right"> -0.84%</td><td align="right">516.66 MiB</td><td align="right">516.80 MiB</td><td align="right"> 0.03%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9911s</td><td align="right"> -0.89%</td><td align="right">1 byte</td><td align="right">1.00 bytes</td><td align="right"> 0.02%</td></tr></table>

r? `@cjgillot`
2024-03-10 06:27:41 +00:00
bors
5bc7b9ac8a Auto merge of #122042 - GuillaumeGomez:subtree-update_cg_gcc_2024-03-05, r=MarkSimulacrum
Subtree update cg gcc 2024 03 05

Reopening of #121390.

r? `@ghost`
2024-03-10 03:40:32 +00:00
bors
768408af12 Auto merge of #121662 - saethlin:precondition-unification, r=RalfJung
Distinguish between library and lang UB in assert_unsafe_precondition

As described in https://github.com/rust-lang/rust/pull/121583#issuecomment-1963168186, `assert_unsafe_precondition` now explicitly distinguishes between language UB (conditions we explicitly optimize on) and library UB (things we document you shouldn't do, and maybe some library internals assume you don't do).

`debug_assert_nounwind` was originally added to avoid the "only at runtime" aspect of `assert_unsafe_precondition`. Since then the difference between the macros has gotten muddied. This totally revamps the situation.

Now _all_ preconditions shall be checked with `assert_unsafe_precondition`. If you have a precondition that's only checkable at runtime, do a `const_eval_select` hack, as done in this PR.

r? RalfJung
2024-03-10 01:23:54 +00:00
Guillaume Gomez
c5c6729c88 Use full commit hash and remove libgccjit.version file 2024-03-10 01:01:53 +01:00
Guillaume Gomez
1d058a0b06 Fix cg_gcc merge 2024-03-10 01:01:52 +01:00
bors
2d24fe591f Auto merge of #122256 - Nadrieril:rollup-rc232xh, r=Nadrieril
Rollup of 8 pull requests

Successful merges:

 - #99153 (Add Read Impl for &Stdin)
 - #114655 (Make `impl<Fd: AsFd>` impl take `?Sized`)
 - #120504 (Vec::try_with_capacity)
 - #121280 (Implement MaybeUninit::fill{,_with,_from})
 - #121403 (impl From<TryReserveError> for io::Error)
 - #121526 (on the fly type casting for `build.rustc` and `build.cargo`)
 - #121584 (bump itertools to 0.12)
 - #121711 (Implement junction_point)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-09 20:51:26 +00:00
Guillaume Boisseau
13ca978f91
Rollup merge of #121711 - ChrisDenton:junction, r=Mark-Simulacrum
Implement junction_point

Implements https://github.com/rust-lang/rust/issues/121709

We already had a private implementation that we use for tests so we could just make that public. Except it was very hacky as it was only ever intended for use in testing. I've made an improved version that at least handles path conversion correctly and has less need for things like the `Align8` hack. There's still room for further improvement though.
2024-03-09 21:40:09 +01:00
Guillaume Boisseau
bc3bc2ba6b
Rollup merge of #121584 - klensy:itertools-up, r=Mark-Simulacrum
bump itertools to 0.12

still depend on 0.11 (temporary dupes version):
* <del>clippy</del>, https://github.com/rust-lang/rust-clippy/pull/12346
* rustfmt, sigh, https://github.com/rust-lang/rustfmt/pull/6093

https://github.com/rust-itertools/itertools/blob/v0.12.1/CHANGELOG.md

removed unused `derive_more` dep from `rustc_middle`
2024-03-09 21:40:08 +01:00
Guillaume Boisseau
5d4e3d941f
Rollup merge of #121526 - onur-ozkan:minor-improvement, r=Mark-Simulacrum
on the fly type casting for `build.rustc` and `build.cargo`

self-explanatory
2024-03-09 21:40:08 +01:00
Guillaume Boisseau
9ccf798fff
Rollup merge of #121403 - kornelski:io-oom, r=dtolnay
impl From<TryReserveError> for io::Error

There's an obvious mapping between these two errors, and it makes I/O code less noisy.

I've chosen to use simple `ErrorKind::OutOfMemory` `io::Error`, without keeping `TryReserveError` for the `source()`, because:

* It matches current uses in libstd,
* `ErrorData::Custom` allocates, which is a risky proposition for handling OOM errors specifically.
* Currently `TryReserveError` has no public fields/methods, so it's usefulness is limited. How allocators should report errors, especially custom and verbose ones is still an open question.

Just in case I've added note in the doccomment that this may change.

The compiler forced me to declare stability of this impl. I think this implementation is simple enough that it doesn't need full-blown stabilization period, and I've marked it for the next release, but of course I can adjust the attribute if needed.
2024-03-09 21:40:07 +01:00
Guillaume Boisseau
cbd59d0f62
Rollup merge of #121280 - ajwock:maybeuninit_fill, r=Amanieu
Implement MaybeUninit::fill{,_with,_from}

ACP: rust-lang/libs-team#156
2024-03-09 21:40:07 +01:00
Guillaume Boisseau
e3c0158788
Rollup merge of #120504 - kornelski:try_with_capacity, r=Amanieu
Vec::try_with_capacity

Related to #91913

Implements try_with_capacity for `Vec`, `VecDeque`, and `String`. I can follow it up with more collections if desired.

`Vec::try_with_capacity()` is functionally equivalent to the current stable:

```rust
let mut v = Vec::new();
v.try_reserve_exact(n)?
```

However, `try_reserve` calls non-inlined `finish_grow`, which requires old and new `Layout`, and is designed to reallocate memory. There is benefit to using `try_with_capacity`, besides syntax convenience, because it generates much smaller code at the call site with a direct call to the allocator. There's codegen test included.

It's also a very desirable functionality for users of `no_global_oom_handling` (Rust-for-Linux), since it makes a very commonly used function available in that environment (`with_capacity` is used much more frequently than all `(try_)reserve(_exact)`).
2024-03-09 21:40:06 +01:00
Guillaume Boisseau
5b6d30a4a9
Rollup merge of #114655 - nbdd0121:io-safety, r=dtolnay
Make `impl<Fd: AsFd>` impl take `?Sized`

`@rustbot` labels: +T-libs-api +needs-fcp
2024-03-09 21:40:06 +01:00
Guillaume Boisseau
0a8ea93dd8
Rollup merge of #99153 - Dajamante:issue/95622, r=dtolnay
Add Read Impl for &Stdin

r? `@oli-obk`
fixes #95622
2024-03-09 21:40:05 +01:00
Ben Kimock
2a1f97f77f Explain why we don't use intrinsics::is_nonoverlapping 2024-03-09 13:36:36 -05:00
Ralf Jung
9a308d45cf update lockfile 2024-03-09 18:56:52 +01:00
bors
25ee3c6a2f Auto merge of #120985 - Kobzol:linux-update-host-llvm, r=Mark-Simulacrum
Update host LLVM on x64 Linux to LLVM 18

Updates host LLVM on Linux to `18.1.0`.
2024-03-09 17:53:30 +00:00
Ben Kimock
af49c4df0a NonZero::from_mut_unchecked is library UB 2024-03-09 12:27:11 -05:00
Guillaume Gomez
2b5b43eeb9 Merge remote-tracking branch 'upstream/master' into HEAD 2024-03-09 18:04:39 +01:00
Ben Kimock
27cf4bb985
Only enable library UB checks in const-eval/Miri when debug_assertions are enabled
Co-authored-by: Ralf Jung <post@ralfj.de>
2024-03-09 11:34:15 -05:00
Ben Kimock
50d0bea153 Improve docs 2024-03-09 10:49:26 -05:00
bors
8401645716 Auto merge of #122241 - matthiaskrgr:rollup-r8q87ok, r=matthiaskrgr
Rollup of 12 pull requests

Successful merges:

 - #121358 (Reduce alignment of TypeId to u64 alignment)
 - #121813 (Misc improvements to non local defs lint implementation)
 - #122160 (Eagerly translate `HelpUseLatestEdition` in parser diagnostics)
 - #122178 (ci: add a runner for vanilla LLVM 18)
 - #122187 (Move metadata header and version checks together)
 - #122209 (fix incorrect path resolution in tidy)
 - #122215 (Some tweaks to the parallel query cycle handler)
 - #122223 (Fix typo in `VisitorResult`)
 - #122224 (Add missing regression tests)
 - #122232 (library/core: fix a comment, and a cfg(miri) warning)
 - #122233 (miri: do not apply aliasing restrictions to Box with custom allocator)
 - #122237 (Remove `Ord` from `ClosureKind`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-09 15:37:01 +00:00
Matthias Krüger
7193ce0061
Rollup merge of #122237 - fee1-dead-contrib:rmord, r=compiler-errors
Remove `Ord` from `ClosureKind`

Using `Ord` to accomplish a meaning of subset relationship can be hard to read. The existing uses for that are easily replaced with a `match`, and in my opinion, more readable without needing to resorting to comments to explain the intention.

cc `@compiler-errors`
2024-03-09 16:21:21 +01:00
Matthias Krüger
b14e8054af
Rollup merge of #122233 - RalfJung:custom-alloc-box, r=oli-obk
miri: do not apply aliasing restrictions to Box with custom allocator

This is the Miri side of https://github.com/rust-lang/rust/pull/122018. The "intrinsics with body" made this much more pleasant. :)

Fixes https://github.com/rust-lang/miri/issues/3341.
r? `@oli-obk`
2024-03-09 16:21:20 +01:00
Matthias Krüger
2bb4b9901f
Rollup merge of #122232 - RalfJung:misc, r=jhpratt
library/core: fix a comment, and a cfg(miri) warning

Just two things I noticed while working on another PR.
2024-03-09 16:21:20 +01:00
Matthias Krüger
d1d43b840e
Rollup merge of #122224 - gurry:add-tests, r=Nadrieril
Add missing regression tests

Add tests for issues #121612 and #121424

Closes #121612
Closes #121424
2024-03-09 16:21:19 +01:00
Matthias Krüger
2894585f7e
Rollup merge of #122223 - Jarcho:visit_fix, r=oli-obk
Fix typo in `VisitorResult`

r? ```@oli-obk```
2024-03-09 16:21:19 +01:00
Matthias Krüger
dc7a9f6c7f
Rollup merge of #122215 - Zoxc:cycle-detect-names, r=oli-obk
Some tweaks to the parallel query cycle handler

This renames `deadlock` to `break_query_cycles`. The abort logic is moved next to the thread spawning and gives the thread a name.

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

r? ```@oli-obk```
2024-03-09 16:21:18 +01:00
Matthias Krüger
a5adac0ea3
Rollup merge of #122209 - onur-ozkan:fix-tidy-path-resolution, r=compiler-errors
fix incorrect path resolution in tidy

Previously, reading the current path from the environment led to failure when invoking x from outside the source root. This change fixes this issue by passing the already resolved root path into `ui_tests::check`.

Fixes #122202
2024-03-09 16:21:18 +01:00
Matthias Krüger
9ac5cc86d7
Rollup merge of #122187 - bjorn3:merge_header_version_checks, r=petrochenkov
Move metadata header and version checks together

This will make it easier to report rustc versions for older metadata formats.

Split out of https://github.com/rust-lang/rust/pull/120855
2024-03-09 16:21:17 +01:00
Matthias Krüger
577632d4d4
Rollup merge of #122178 - cuviper:ci-llvm-18, r=Kobzol
ci: add a runner for vanilla LLVM 18

For CI cost, this can be seen as replacing the llvm-15 runner we dropped in #117947.

Also, I've set `IS_NOT_LATEST_LLVM` in the llvm-17 runner, since that's not the latest anymore.
2024-03-09 16:21:16 +01:00
Matthias Krüger
985befe036
Rollup merge of #122160 - jieyouxu:eager-translate-help-use-latest-edition, r=cjgillot
Eagerly translate `HelpUseLatestEdition` in parser diagnostics

Fixes #122130.

This makes me suspicious of these other two usage of  `add_to_diagnostic()`. Would they *also* crash? I haven't attempted to construct test cases for them.

```
compiler/rustc_parse/src/parser/expr.rs
3453:            errors::HelpUseLatestEdition::new().add_to_diagnostic(e);

compiler/rustc_hir_typeck/src/expr.rs
2603:            HelpUseLatestEdition::new().add_to_diagnostic(&mut err);
```

This also seems like a footgun?
2024-03-09 16:21:16 +01:00
Matthias Krüger
a979f971b4
Rollup merge of #121813 - Urgau:misc-non_local_defs-lint, r=cjgillot
Misc improvements to non local defs lint implementation

This PR is a collection of small improvements I found when I [needlessly tried](https://www.github.com/rust-lang/rust/pull/120393#issuecomment-1971787475) to fix a "perf-regression" in the lint implementation.

I recommend looking at each commit individually.
2024-03-09 16:21:15 +01:00
Matthias Krüger
a1f6191e0e
Rollup merge of #121358 - GnomedDev:lower-align-typeid, r=Mark-Simulacrum
Reduce alignment of TypeId to u64 alignment

Closes #115620
2024-03-09 16:21:14 +01:00
Deadbeef
7e1969ac13 Remove Ord from ClosureKind
Using `Ord` to accomplish a meaning of subset relationship
can be hard to read. The existing uses for that are easily
replaced with a `match`, and in my opinion, more readable
without needing to resorting to comments to explain the
intention.
2024-03-09 21:16:43 +08:00
Ralf Jung
e632e3f9a5 miri: do not apply aliasing restrictions to Box with custom allocator 2024-03-09 13:08:55 +01:00
bors
b054da8155 Auto merge of #122150 - ShoyuVanilla:replace-typewalker, r=lcnr
Replace `TypeWalker` usage with `TypeVisitor` in `wf.rs`

Resolves #121693
2024-03-09 12:02:25 +00:00
bors
0ebb78fb7b Auto merge of #3367 - rust-lang:rustup-2024-03-09, r=RalfJung
Automatic Rustup
2024-03-09 11:34:34 +00:00
Ralf Jung
862f918fa4 fix clippy lints 2024-03-09 12:33:17 +01:00
Ralf Jung
1082c36a4c fn is_align_to: move some comments closer to the cast they refer to 2024-03-09 11:54:27 +01:00
Ralf Jung
6aff1ca68c fix warning when building libcore for Miri 2024-03-09 11:11:10 +01:00
bors
9d272a1b05 Auto merge of #122102 - Urgau:optimize-symbol-integer, r=cjgillot
Optimize `Symbol::integer` by utilizing in-place formatting

This PR optimize `Symbol::integer` by utilizing `itoa` in-place formatting instead of going through a dynamically allocated `String` and the format machinery.

<details>

For some context: I was profiling `rustc --check-cfg` with callgrind and due to the way we currently setup all the targets and we end-up calling `Symbol::integer` multiple times for all the targets. Using `itoa` reduced the number of instructions.

</details>
2024-03-09 08:47:57 +00:00
bors
b0fad9accb Auto merge of #3368 - RalfJung:ui, r=RalfJung
rename tests/compiletest → tests/ui

This hasn't been `compiletest` in a while.
2024-03-09 08:16:15 +00:00
Ralf Jung
00be3525bf rename tests/compiletest → tests/ui 2024-03-09 09:13:50 +01:00
bors
cabac98df8 Auto merge of #3366 - RalfJung:tempdir, r=oli-obk
compiletest: create fresh tempdir for tests to use

Fixes https://github.com/rust-lang/miri/issues/3364
2024-03-09 07:11:10 +00:00
Gurinder Singh
b1f4657fe9 Add missing regression tests
for a couple of issues
2024-03-09 12:01:19 +05:30
bors
48a15aa2c4 Auto merge of #122095 - lukas-code:windows-shutdown-test, r=ChrisDenton
fix `close_read_wakes_up` test

On windows, `shutdown` does not interrupt `read`, even though we document that it does (see https://github.com/rust-lang/rust/issues/121594).

The `close_read_wakes_up` test has a race condition and only passes on windows if the `shutdown` happens before the `read`. This PR ignores the test on windows adds a sleep to make it more likely that the `read` happens before the `shutdown` and the test actually tests what it is supposed to test on other platforms.

I'm submitting this before any docs changes, so that we can find out on what platforms `shutdown` actually works as documented.

r? `@ChrisDenton`
2024-03-09 06:23:18 +00:00
onur-ozkan
7c13421dc0 fix incorrect path resolution in tidy
Previously, reading the current path from the environment led to failure when invoking
x from outside the source root. This change fixes this issue by passing the already
resolved root path into `ui_tests::check`.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-03-09 08:53:26 +03:00