Commit Graph

248651 Commits

Author SHA1 Message Date
The Miri Cronjob Bot
9123df0300 Preparing for merge from rustc 2024-03-12 05:38:23 +00:00
bors
7a5b6eb9dc Auto merge of #3373 - tgolang:master, r=RalfJung
chore: remove repetitive word
2024-03-11 08:14:52 +00:00
tgolang
5531a80e56 chore: remove repetitive word
Signed-off-by: tgolang <seekseat@aliyun.com>
2024-03-11 15:40:39 +08:00
bors
16316a9605 Auto merge of #3371 - rust-lang:rustup-2024-03-10, r=saethlin
Automatic Rustup
2024-03-10 05:19:18 +00:00
The Miri Cronjob Bot
2ecfbaef0a fmt 2024-03-10 05:05:28 +00:00
The Miri Cronjob Bot
bca5e33727 Merge from rustc 2024-03-10 05:04:18 +00:00
Peter Jaszkowiak
83590ac069 fix legacy numeric constant diag items
- missed syms for usize/isize
- missed diag items on unsigned integers
2024-03-09 23:33:27 -07:00
The Miri Cronjob Bot
1d279f1790 Preparing for merge from rustc 2024-03-10 04:57:09 +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
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
bors
ac968d4804 Auto merge of #3369 - RalfJung:no-std, r=RalfJung
simplify no-std tests

set panic=abort so that we do not need this eh_personality thing
2024-03-09 18:20:07 +00:00
Ralf Jung
82f2f2f488 simplify no-std tests
set panic=abort so that we do not need this eh_personality thing
2024-03-09 19:10:37 +01: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
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