Commit graph

149311 commits

Author SHA1 Message Date
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
Ralf Jung
e8379c9598 interpret: get rid of 'mir lifetime everywhere 2024-05-27 08:25:57 +02:00
Ralf Jung
36d36a3e1f interpret: the MIR is actually at lifetime 'tcx 2024-05-27 07:45:41 +02:00
Noah Lev
699d28f968 rustdoc: Show "const" for const-unstable if also overall unstable
If a const function is unstable overall (and thus, in all circumstances
I know of, also const-unstable), we should show the option to use it as
const. You need to enable a feature to use the function at all anyway.

If the function is stabilized without also being const-stabilized, then
we do not show the const keyword and instead show "const: unstable" in
the version info.
2024-05-26 21:06:02 -07: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
Chris Denton
f63931bc1a
Cleanup custom mingw in CI 2024-05-26 22:43:40 +00: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
bors
da6c08e865 Auto merge of #3634 - RalfJung:macro_use, r=RalfJung
avoid using macro_use

This is the Miri version of https://github.com/rust-lang/rust/pull/124914
2024-05-26 21:10:05 +00:00
Ralf Jung
38870cf09c avoid using macro_use 2024-05-26 22:56:07 +02:00
bors
b531ca7ca8 Auto merge of #3629 - devnexen:illumos_num_cpus, r=RalfJung
solarish platform: add support for available-parallelism.
2024-05-26 20:45:36 +00:00
Ralf Jung
d3974fabfd
reorder code 2024-05-26 22:43:58 +02:00
David Carlier
887c130863 solarish platform add supports for available-parallelism. 2024-05-26 20:22:36 +00: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
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
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
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
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
Chris Denton
941aa47433
Do less reinstalling in mingw CI 2024-05-26 10:52:31 +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
Ralf Jung
5fa30f7eaa make release_clock always work on the current thread 2024-05-26 10:43:25 +02:00
Noah Lev
fa7a3f9049 rustdoc: Elide const-unstable if also unstable overall
It's confusing because if a function is unstable overall, there's no
need to highlight the constness is also unstable. Technically, these
attributes (overall stability and const-stability) are separate, but in
practice, we don't even show the const-unstable's feature flag (it's
normally the same as the overall function).
2024-05-25 23:05:27 -07: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
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
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
890982e47b
Rollup merge of #121377 - pitaj:lazy_cell_fn_pointer, r=dtolnay
Stabilize `LazyCell` and `LazyLock`

Closes #109736

This stabilizes the [`LazyLock`](https://doc.rust-lang.org/stable/std/sync/struct.LazyLock.html) and [`LazyCell`](https://doc.rust-lang.org/stable/std/cell/struct.LazyCell.html) types:

```rust
static HASHMAP: LazyLock<HashMap<i32, String>> = LazyLock::new(|| {
    println!("initializing");
    let mut m = HashMap::new();
    m.insert(13, "Spica".to_string());
    m.insert(74, "Hoyten".to_string());
    m
});

let lazy: LazyCell<i32> = LazyCell::new(|| {
    println!("initializing");
    92
});
```

r? libs-api
2024-05-25 22:15:16 +02:00
bors
1ba35e9bb4 Auto merge of #125515 - weihanglo:target-toml-override, r=onur-ozkan
bootstrap: support target specific config overrides

Can't find any previous discussion about not supporting this,
so I get it done.

The motivation of this is from <https://github.com/rust-lang/rust/pull/125473#issuecomment-2129954990>.
2024-05-25 20:15:11 +00:00
Mathew Horner
afa8dfc51f
Avoid clone when constructing runnable label. 2024-05-25 15:00:15 -05:00
bors
14562ddf8c Auto merge of #125502 - weihanglo:update-rustc-perf, r=Kobzol
Update rustc-perf

Just check if the latest commit works.

4f313add60...cc81f9654d

See discussion on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/tempfile.20in.20rustc-perf.20make.20it.20hard.20to.20configure.20vendor/near/440442827

r? ghost
2024-05-25 15:31:40 +00:00
Jonas Rinke
09677b03dd Formatting 2024-05-25 17:08:17 +02:00
Jonas Rinke
78fe45e273 Semicolon 2024-05-25 17:04:48 +02:00
Jonas Rinke
2315c6b764 Use correct format for setting environment variables when debugging with cpptools 2024-05-25 16:53:01 +02:00
bors
0b2f194b83 Auto merge of #125541 - matthiaskrgr:rollup-4gwt4xp, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #125271 (use posix_memalign on almost all Unix targets)
 - #125451 (Fail relating constants of different types)
 - #125478 (Bump bootstrap compiler to the latest beta compiler)
 - #125498 (Stop using the avx512er and avx512pf x86 target features)
 - #125510 (remove proof tree formatting, make em shallow)
 - #125513 (Don't eagerly monomorphize drop for types that are impossible to instantiate)
 - #125514 (Structurally resolve before `builtin_index` in EUV)
 - #125527 (Add manual Sync impl for ReentrantLockGuard)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-25 12:52:43 +00:00
Matthias Krüger
e58a0a8961
Rollup merge of #125478 - Urgau:check-cfg-config-bump-stage0, r=Mark-Simulacrum
Bump bootstrap compiler to the latest beta compiler

This PR updates the bootstrap compiler, aka stage0 to the latest beta version, since it contains rust-lang/cargo#13925.

It removes those unconditional Cargo warnings:

```
warning: [...]/rust/library/core/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: [...]/rust/library/std/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
warning: [...]/rust/library/alloc/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
```

for all contributors/users of this repository (including CI).

I don't know if that's something we do, or if it's even advisable, feel free to close.

r? `@Mark-Simulacrum`
2024-05-25 12:54:35 +02:00
bors
77d4115655 Auto merge of #125524 - weihanglo:update-cargo, r=weihanglo
Update cargo

7 commits in 84dc5dc11a9007a08f27170454da6097265e510e..a8d72c675ee52dd57f0d8f2bae6655913c15b2fb
2024-05-20 18:57:08 +0000 to 2024-05-24 03:34:17 +0000
- Improve error description when deserializing partial field struct (rust-lang/cargo#13956)
- fix: remove symlink dir on Windows (rust-lang/cargo#13910)
- Fix wrong type of rustc-flags in documentation (rust-lang/cargo#13957)
- Add more high level traces (rust-lang/cargo#13951)
- upgrade gix from 0.62 to 0.63 (rust-lang/cargo#13948)
- Use `i32` rather than `usize` as "default integer" in library template (rust-lang/cargo#13939)
- fetch specific commits even if the github fast path fails (rust-lang/cargo#13946)

r? ghost
2024-05-25 10:44:58 +00:00
Tavo Annus
6d6bef0fdf Fix data_constructor ignoring generics for struct 2024-05-25 13:09:26 +03:00
onur-ozkan
c76477d909 add change entry
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-05-25 10:37:36 +03:00
onur-ozkan
56dddd4c7e Remove deprecated field dist.missing-tools
It's been 5 months since this field was deprecated.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-05-25 10:35:07 +03:00
The Miri Cronjob Bot
1d0ad04993 Merge from rustc 2024-05-25 05:23:12 +00:00
The Miri Cronjob Bot
3cfcfbf083 Preparing for merge from rustc 2024-05-25 05:15:32 +00:00
Santiago Pastorino
41d4a95fca
Add "better" edition handling on lint-docs tool 2024-05-24 23:58:27 -03:00
Weihang Lo
2d9a4c71c8
Update cargo 2024-05-24 17:49:48 -04:00
Matthias Krüger
09047b8700
Rollup merge of #125485 - GuillaumeGomez:migrate-rmake-rustdoc, r=jieyouxu
Migrate `run-make/rustdoc-with-output-dir-option` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? `@jieyouxu`
2024-05-24 23:01:10 +02:00
Matthias Krüger
f23ebf0410
Rollup merge of #125483 - workingjubilee:move-transform-validate-to-mir-transform, r=oli-obk
compiler: validate.rs belongs next to what it validates

It's hard to find code that is deeply nested and far away from its callsites, so let's move `rustc_const_eval::transform::validate` into `rustc_mir_transform`, where all of its callers are. As `rustc_mir_transform` already depends on `rustc_const_eval`, the added visible dependency edge doesn't mean the dependency tree got any worse.

This also lets us unnest the `check_consts` module.

I did look into moving everything inside `rustc_const_eval::transform` into `rustc_mir_transform`. It turned out to be a much more complex operation, with more concerns and real edges into the `const_eval` crate, whereas this was both faster and more obvious.
2024-05-24 23:01:09 +02:00
Luuk Wester
000713898c remove nested match with and_then 2024-05-24 22:57:35 +02:00