Commit Graph

255965 Commits

Author SHA1 Message Date
bors
b582f807fa Auto merge of #125410 - fmease:adj-lint-diag-api, r=nnethercote
[perf] Delay the construction of early lint diag structs

Attacks some of the perf regressions from https://github.com/rust-lang/rust/pull/124417#issuecomment-2123700666.

See individual commits for details. The first three commits are not strictly necessary.
However, the 2nd one (06bc4fc671, *Remove `LintDiagnostic::msg`*) makes the main change way nicer to implement.
It's also pretty sweet on its own if I may say so myself.
2024-05-27 08:44:12 +00:00
bors
fec98b3bbc Auto merge of #125468 - BoxyUwU:remove_defid_from_regionparam, r=compiler-errors
Remove `DefId` from `EarlyParamRegion`

Currently we represent usages of `Region` parameters via the `ReEarlyParam` or `ReLateParam` variants. The `ReEarlyParam` is effectively equivalent to `TyKind::Param` and `ConstKind::Param` (i.e. it stores a `Symbol` and a `u32` index) however it also stores a `DefId` for the definition of the lifetime parameter.

This was used in roughly two places:
- Borrowck diagnostics instead of threading the appropriate `body_id` down to relevant locations. Interestingly there were already some places that had to pass down a `DefId` manually.
- Some opaque type checking logic was using the `DefId` field to track captured lifetimes

I've split this PR up into a commit for generate rote changes to diagnostics code to pass around a `DefId` manually everywhere, and another commit for the opaque type related changes which likely require more careful review as they might change the semantics of lints/errors.

Instead of manually passing the `DefId` around everywhere I previously tried to bundle it in with `TypeErrCtxt` but ran into issues with some call sites of `infcx.err_ctxt` being unable to provide a `DefId`, particularly places involved with trait solving and normalization. It might be worth investigating adding some new wrapper type to pass this around everywhere but I think this might be acceptable for now.

This pr also has the effect of reducing the size of `EarlyParamRegion` from 16 bytes -> 8 bytes. I wouldn't expect this to have any direct performance improvement however, other variants of `RegionKind` over `8` bytes are all because they contain a `BoundRegionKind` which is, as far as I know, mostly there for diagnostics. If we're ever able to remove this it would shrink the `RegionKind` type from `24` bytes to `12` (and with clever bit packing we might be able to get it to `8` bytes). I am curious what the performance impact would be of removing interning of `Region`'s if we ever manage to shrink `RegionKind` that much.

Sidenote: by removing the `DefId` the `Debug` output for `Region` has gotten significantly nicer. As an example see this opaque type debug print before vs after this PR:
`Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), [DefId(0:9 ~ impl_trait_captures[aeb9]::foo::'a)_'a/#0, T, DefId(0:9 ~ impl_trait_captures[aeb9]::foo::'a)_'a/#0])`
`Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), ['a/#0, T, 'a/#0])`

r? `@compiler-errors` (I would like someone who understands the opaque type setup to atleast review the type system commit, but the rest is likely reviewable by anyone)
2024-05-27 06:36:57 +00:00
bors
cdc509f7c0 Auto merge of #125580 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2024-05-27 02:23:10 +00:00
bors
529bb2573a Auto merge of #125593 - workingjubilee:rollup-67qk7di, r=workingjubilee
Rollup of 8 pull requests

Successful merges:

 - #124048 (Support C23's Variadics Without a Named Parameter)
 - #125046 (Only allow immutable statics with #[linkage])
 - #125466 (Don't continue probing for method if in suggestion and autoderef hits ambiguity)
 - #125469 (Don't skip out of inner const when looking for body for suggestion)
 - #125544 (Also mention my-self for other check-cfg docs changes)
 - #125559 (Simplify the `unchecked_sh[lr]` ub-checks a bit)
 - #125566 (Notify T-rustdoc for beta-accepted and stable-accepted too)
 - #125582 (Avoid a `FieldIdx::from_usize` in InstSimplify)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-27 00:17:11 +00:00
Jubilee
4ff78692db
Rollup merge of #125582 - scottmcm:less-from-usize, r=jieyouxu
Avoid a `FieldIdx::from_usize` in InstSimplify

Just a tiny cleanup I noticed in passing while looking at something unrelated.
2024-05-26 15:28:29 -07:00
Jubilee
45507e4304
Rollup merge of #125566 - camelid:notify-accepted, r=GuillaumeGomez
Notify T-rustdoc for beta-accepted and stable-accepted too

Otherwise, it's unclear when the nomination label is removed whether the backport was accepted, thus nomination removed, or if the backport was rejected, thus nomination removed.

r? ````@GuillaumeGomez````
2024-05-26 15:28:29 -07:00
Jubilee
25b079a1cf
Rollup merge of #125559 - scottmcm:simplify-shift-ubcheck, r=workingjubilee
Simplify the `unchecked_sh[lr]` ub-checks a bit

It can use the constant in the check, rather than passing it as a parameter.
2024-05-26 15:28:28 -07:00
Jubilee
c51fc1d02b
Rollup merge of #125544 - Urgau:check-cfg-mention-cargo-specific, r=jieyouxu
Also mention my-self for other check-cfg docs changes

This PR adds a mention for my-self for the recently added `src/doc/rustc/src/check-cfg` directory.

*I had to add a second mention just for the directory since [`Path::starts_with`](https://doc.rust-lang.org/std/path/struct.Path.html#method.starts_with) as used by [triagebot](48f29f351c/src/handlers/mentions.rs (L69)), matches on path components and so can never return true for a file and directory at the same time.*
2024-05-26 15:28:28 -07:00
Jubilee
b65b2b6ced
Rollup merge of #125469 - compiler-errors:dont-skip-inner-const-body, r=cjgillot
Don't skip out of inner const when looking for body for suggestion

Self-explanatory title, I'll point out the important logic in an inline comment.

Fixes #125370
2024-05-26 15:28:27 -07:00
Jubilee
09e75921f3
Rollup merge of #125466 - compiler-errors:dont-probe-for-ambig-in-sugg, r=jieyouxu
Don't continue probing for method if in suggestion and autoderef hits ambiguity

The title is somewhat self-explanatory. When we hit ambiguity in method autoderef steps, we previously would continue to probe for methods if we were giving a suggestion. This seems useless, and causes an ICE when we are not able to unify the receiver later on in confirmation.

Fixes #125432
2024-05-26 15:28:27 -07:00
Jubilee
5860d43af3
Rollup merge of #125046 - bjorn3:no_mutable_static_linkage, r=cjgillot
Only allow immutable statics with #[linkage]
2024-05-26 15:28:26 -07:00
Jubilee
866630d004
Rollup merge of #124048 - veera-sivarajan:bugfix-123773-c23-variadics, r=compiler-errors
Support C23's Variadics Without a Named Parameter

Fixes #123773

This PR removes the static check that disallowed extern functions
with ellipsis (varargs) as the only parameter since this is now
valid in C23.

This will not break any existing code as mentioned in the proposal
document: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2975.pdf.

Also, adds a doc comment for `check_decl_cvariadic_pos()` and
fixes the name of the function (`varadic` -> `variadic`).
2024-05-26 15:28:26 -07:00
bors
0aad3f64e2 Auto merge of #125576 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-05-26 22:08:06 +00:00
Scott McMurray
d37f456b2a Avoid a FieldIdx::from_usize in InstSimplify 2024-05-26 13:31:28 -07:00
bors
bdbbb6c6a7 Auto merge of #125546 - ChrisDenton:mingw-ci, r=Mark-Simulacrum
Try to not reinstall tools in mingw CI

Reinstalling the tools seems prone to failure (e.g. [latest](https://github.com/rust-lang/rust/pull/125529#issuecomment-2130919307)) and is more work. It also seems unnecessary as CI actually uses a vendored tarball for builds.

cc `@mati865`
2024-05-26 18:50:48 +00:00
bors
0963353634 Auto merge of #3631 - RalfJung:blocking-refactor, r=RalfJung
completely refactor how we manage blocking and unblocking threads

This hides a lot of invariants from the implementation of the synchronization primitives, and makes sure we never have to release or acquire a vector clock on another thread but the active one.
2024-05-26 18:36:10 +00:00
Ralf Jung
2e89443b93 add a macro to declare thread unblock callbacks 2024-05-26 19:15:05 +02:00
bors
b0925697fd Auto merge of #122079 - tbu-:pr_copy_file_range_probe, r=the8472
Less syscalls for the `copy_file_range` probe

If it's obvious from the actual syscall results themselves that the syscall is supported or unsupported, don't do an extra syscall with an invalid file descriptor.

CC #122052
2024-05-26 15:48:29 +00:00
bors
8e861c6c4c Auto merge of #3632 - RalfJung:readdir, r=RalfJung
unix/fs: a bit of cleanup in macos_fbsd_readdir_r
2024-05-26 15:22:18 +00:00
Ralf Jung
350f5c88db unix/fs: a bit of cleanup in macos_fbsd_readdir_r 2024-05-26 17:20:28 +02:00
bors
e09bf5694b Auto merge of #3633 - RalfJung:target, r=RalfJung
fix './miri run --dep --target _'
2024-05-26 14:39:28 +00:00
Ralf Jung
cbec1288a2 fix './miri run --dep --target _' 2024-05-26 16:37:50 +02:00
Ralf Jung
e6bb468b53 data_race: vector indices can be reused immediately when the thread is gone 2024-05-26 16:11:04 +02:00
Ralf Jung
a131243557 completely refactor how we manage blocking and unblocking threads 2024-05-26 16:11:04 +02:00
bors
785eb65377 Auto merge of #125574 - matthiaskrgr:rollup-1oljoup, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #125307 (tidy: stop special-casing tests/ui entry limit)
 - #125375 (Create a triagebot ping group for Rust for Linux)
 - #125473 (fix(opt-dist): respect existing config.toml)
 - #125508 (Stop SRoA'ing `DynMetadata` in MIR)
 - #125561 (Stabilize `slice_flatten`)
 - #125571 (f32: use constants instead of reassigning a dummy value as PI)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-26 13:09:58 +00:00
Matthias Krüger
27cdb36ec5
Rollup merge of #125571 - tesuji:dummy-pi, r=Nilstrieb
f32: use constants instead of reassigning a dummy value as PI
2024-05-26 13:43:08 +02:00
Matthias Krüger
f775fffac5
Rollup merge of #125561 - Cyborus04:stabilize-slice-flatten, r=scottmcm
Stabilize `slice_flatten`
2024-05-26 13:43:07 +02:00
Matthias Krüger
5fef6c511d
Rollup merge of #125508 - scottmcm:fix-125506, r=Nilstrieb
Stop SRoA'ing `DynMetadata` in MIR

Fixes #125506
2024-05-26 13:43:07 +02:00
Matthias Krüger
c7a17656a0
Rollup merge of #125473 - weihanglo:respect-existing-config-toml, r=Kobzol
fix(opt-dist): respect existing config.toml

This is another step toward making opt-dist work in sandboxed environments. See also <https://github.com/rust-lang/rust/pull/125465>.

opt-dist verifies the final built rustc against a subset of rustc test
suite. However it overwrote the pre-existing `config.toml` [^1],
and that results in ./vendor/ directory removed [^2].

Instead of overwriting, this patch use `--set <config-value>` to
override paths to rustc / cargo / llvm-config.

[^1]: 606afbb617/src/tools/opt-dist/src/tests.rs (L62-L77)
[^2]: 8679004993/src/bootstrap/bootstrap.py (L1057)
2024-05-26 13:43:06 +02:00
Matthias Krüger
89c3739358
Rollup merge of #125375 - Kobzol:triagebot-rfl-ping-group, r=Mark-Simulacrum
Create a triagebot ping group for Rust for Linux

Corresponding rustc-dev-guide PR [here](https://github.com/rust-lang/rustc-dev-guide/pull/1984). Discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/Testing.20Rust.20for.20Linux.20in.20our.20CI).
2024-05-26 13:43:06 +02:00
Matthias Krüger
e346404fca
Rollup merge of #125307 - workingjubilee:uproot-entry-limit, r=Mark-Simulacrum
tidy: stop special-casing tests/ui entry limit

It is genuinely more annoying to have this error, now that this value is below the general `ENTRY_LIMIT` cap, when one is trying to clean out tests from tests/ui! This code has served its purpose well, let it rest now rather than force it to continue haunting us.
2024-05-26 13:43:05 +02:00
bors
a6a017d3f3 Auto merge of #125570 - tesuji:stdout-handle, r=Nilstrieb
Use STD_OUTPUT_HANDLE instead of magic number
2024-05-26 10:57:58 +00:00
Chris Denton
941aa47433
Do less reinstalling in mingw CI 2024-05-26 10:52:31 +00:00
Lzu Tao
96a731e5b8 f32: use constants instead of reassigning a dummy value as PI 2024-05-26 09:32:39 +00:00
Lzu Tao
b06b122d8c use proper name instead of magic number 2024-05-26 09:19:18 +00:00
bors
f7ca8a6d66 Auto merge of #17296 - mathew-horner:no-clone-target, r=Veykril
Avoid clone when constructing runnable label.

I stumbled across this when reading this code. This seems like an unnecessary allocation (though likely small?)
2024-05-26 09:11:55 +00:00
bors
bd9cc02d10 Auto merge of #17295 - 0xJonas:fix_passing_env_vars_to_cpptools, r=Veykril
Use correct format for setting environment variables when debugging with cpptools

The RA VSCode extension uses an incorrect format for the environment variables in the `launch.json` when debugging with the C/C++ Extension. This extension uses a different format than CodeLLDB or NativeDebug, which means that the environment variables are not actually set for the debuggee.

What it currently looks like:
```json
"env": {
  "NAME": "VALUE"
}
```

What the C/C++ extension expects:
```json
"environment": [
  { "name": "NAME", "value": "VALUE" }
]
```

For reference: https://code.visualstudio.com/docs/cpp/launch-json-reference#_environment
2024-05-26 08:59:22 +00:00
Ralf Jung
5fa30f7eaa make release_clock always work on the current thread 2024-05-26 10:43:25 +02:00
bors
5fe5543502 Auto merge of #124661 - RalfJung:only-structural-consts-in-patterns, r=pnkfelix
Turn remaining non-structural-const-in-pattern lints into hard errors

This completes the implementation of https://github.com/rust-lang/rust/issues/120362 by turning our remaining future-compat lints into hard errors: indirect_structural_match and pointer_structural_match.

They have been future-compat lints for a while (indirect_structural_match for many years, pointer_structural_match since Rust 1.75 (released Dec 28, 2023)), and have shown up in dependency breakage reports since Rust 1.78 (just released on May 2, 2024). I don't expect a lot of code will still depend on them, but we will of course do a crater run.

A lot of cleanup is now possible in const_to_pat, but that is deferred to a later PR.

Fixes https://github.com/rust-lang/rust/issues/70861
2024-05-26 07:55:47 +00:00
Noah Lev
91b3ef5b4a Notify T-rustdoc for beta-accepted and stable-accepted too
Otherwise, it's unclear when the nomination label is removed whether the
backport was accepted, thus nomination removed, or if the backport was
rejected, thus nomination removed.
2024-05-25 23:00:15 -07:00
Cyborus
824ffd29ee
Stabilize slice_flatten 2024-05-26 01:26:24 -04:00
bors
bd184cc3e1 Auto merge of #125070 - tbu-:pr_set_extension_panic, r=jhpratt
Panic if `PathBuf::set_extension` would add a path separator

This is likely never intended and potentially a security vulnerability if it happens.

I'd guess that it's mostly literal strings that are passed to this function in practice, so I'm guessing this doesn't break anyone.

CC #125060
2024-05-26 04:14:32 +00:00
Weihang Lo
c81a40bbc0
opt-dist: dont overrwite config.toml when verifying
This is another step toward making opt-dist work in sandboxed environments

opt-dist verifies the final built rustc against a subset of rustc test
suite. However it overwrote the pre-existing `config.toml` [^1],
and that results in ./vendor/ directory removed [^2].

Instead of overwriting, this patch use `--set <config-value>` to
override paths to rustc / cargo / llvm-config.

[^1]: 606afbb617/src/tools/opt-dist/src/tests.rs (L62-L77)
[^2]: 8679004993/src/bootstrap/bootstrap.py (L1057)
2024-05-25 23:23:47 -04:00
bors
75e2c5dcd0 Auto merge of #125518 - saethlin:check-arguments-new-in-const, r=joboet
Move the checks for Arguments constructors to inline const

Thanks `@Skgland` for pointing out this opportunity: https://github.com/rust-lang/rust/pull/117804#discussion_r1612964362
2024-05-26 01:10:39 +00:00
Scott McMurray
0c84361342 Simplify the unchecked_sh[lr] ub-checks a bit 2024-05-25 15:58:26 -07:00
bors
0a59f11362 Auto merge of #125552 - matthiaskrgr:rollup-f1yybpn, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #121377 (Stabilize `LazyCell` and `LazyLock`)
 - #122986 (Fix c_char on AIX)
 - #123803 (Fix `VecDeque::shrink_to` UB when `handle_alloc_error` unwinds.)
 - #124080 (Some unstable changes to where opaque types get defined)
 - #124667 (Stabilize `div_duration`)
 - #125472 (tidy: validate LLVM component names in tests)
 - #125523 (Exit the process a short time after entering our ctrl-c handler)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-25 22:26:32 +00:00
Jonas Rinke
eb9894f3c9 Removed return 2024-05-25 22:42:39 +02:00
Matthias Krüger
0ded36f729
Rollup merge of #125523 - saethlin:ctrlc-timeout, r=bjorn3
Exit the process a short time after entering our ctrl-c handler

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

r? `@bjorn3`
2024-05-25 22:15:19 +02:00
Matthias Krüger
64730a1632
Rollup merge of #125472 - erikdesjardins:component, r=clubby789
tidy: validate LLVM component names in tests

LLVM component names are not immediately obvious (they usually omit any suffixes on the target arch name), and if they're incorrect, the test will silently never run.

This happened [here](https://github.com/rust-lang/rust/pull/125220#discussion_r1612626002), and it would be nice to prevent it.
2024-05-25 22:15:18 +02:00
Matthias Krüger
80aea305d3
Rollup merge of #124667 - newpavlov:stabilize_div_duration, r=jhpratt
Stabilize `div_duration`

Closes #63139
2024-05-25 22:15:18 +02:00