Commit graph

249267 commits

Author SHA1 Message Date
Guillaume Gomez 1d058a0b06 Fix cg_gcc merge 2024-03-10 01:01:52 +01:00
Daniel Sedlak 58f6aaa710 Improve diagnostics for parenthesized type arguments 2024-03-09 22:15:50 +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
Ben Kimock 11f8866ca8 Detect truncated incr comp files 2024-03-09 15:43:50 -05: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
kirandevraj 6f1156a9ff fixing mir pass name to text comment 2024-03-10 01:24:35 +05:30
Ralf Jung bf47df8b0b interpret: do not call machine read hooks during validation 2024-03-09 20:00:24 +01:00
Ben Kimock 2a1f97f77f Explain why we don't use intrinsics::is_nonoverlapping 2024-03-09 13:36:36 -05:00
许杰友 Jieyou Xu (Joe) ff1459a370
Add test to check unused_lifetimes don't duplicate "parameter is never used" error 2024-03-09 18:24:45 +00: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
erikdesjardins 549eac374f
once byval abi is computed, the target abi isn't used further
Co-authored-by: Ralf Jung <post@ralfj.de>
2024-03-09 12:49:35 -05:00
Tomás Vallotton 092a1ab001 fix: remove memory leak due to missing drop implementation for local waker. Also, fix some
of the stability attributes of LocalWaker's methods.
2024-03-09 14:38:58 -03:00
Ben Kimock af49c4df0a NonZero::from_mut_unchecked is library UB 2024-03-09 12:27:11 -05:00
Erik Desjardins 38324a1f4f improve byval abi docs 2024-03-09 12:08:48 -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
Ben Kimock aa6cfb2669 Sink ptrtoint for RMW ops on pointers to cg_llvm 2024-03-09 10:08:53 -05:00
Nadrieril 594cf1de61 review 2024-03-09 15:28:26 +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 574e23ec50 Auto merge of #16794 - HKalbasi:test-explorer, r=lnicola
Some minor changes in the test explorer lsp extension

followup #16662

cc `@nemethf` `@ShuiRuTian`
2024-03-09 10:01:41 +00: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