Commit graph

253652 commits

Author SHA1 Message Date
Ralf Jung 342943bc77 windows: basic support for GetUserProfileDirectoryW 2024-04-24 08:48:59 +02:00
bors e7da0fa62f Auto merge of #124175 - Kobzol:ci-dynamic-job, r=pietroalbini
CI: dynamic jobs

This PR modifies our CI workflows to be dynamic. This means that when a GitHub event is generated, we will run a Python script (`calculate-job-matrix.py`), which decides which CI jobs should be generated. These jobs are defined in `src/ci/github-actions/jobs.yml`).

This should provide a few benefits:
- Once the migration to dynamic jobs is complete, we shouldn't need `expand-yaml-anchors` anymore.
- The job table on PRs (and also the left job column on auto/try builds) should be much cleaner and contain only the jobs that are actually relevant/executed.
- It should be much easier to support dynamic try builds, i.e. to run an arbitrary CI job on a try build.

See [this Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/job.20matrix.20re-ordered.20PR.20list) for more context.

r? `@ghost`
2024-04-24 06:40:14 +00:00
bors a3fddf2384 Auto merge of #3506 - rust-lang:rustup-2024-04-24, r=RalfJung
Automatic Rustup
2024-04-24 06:37:41 +00:00
Nicholas Nethercote 78e7c7b9f9 Whitespace fixes. 2024-04-24 16:28:49 +10:00
Nicholas Nethercote 748b0a2e35 Remove unnecessary pubs in mut_visit.rs.
This makes it clearer what is actually used outside of this crate.
2024-04-24 16:28:34 +10:00
Nicholas Nethercote 8d4655d9ec Rename NestedMetaItem::name_value_literal.
It's a highly misleading name, because it's completely different to
`MetaItem::name_value_literal`. Specifically, it doesn't match
`MetaItemKind::NameValue` (e.g. `#[foo = 3]`), it matches
`MetaItemKind::List` (e.g. `#[foo(3)]`).
2024-04-24 16:28:34 +10:00
Nicholas Nethercote d5ec9b458a Remove MetaItemKind::value_str.
`MetaItem::value_str` is good enough. And this makes
`MetaItem::value_str` more like `MetaItem::meta_item_list` and
`name_value_literal`.
2024-04-24 16:28:34 +10:00
Nicholas Nethercote 15e71b6e43 Make LazyAttrTokenStream::encode panic.
It's unreachable, because AST JSON printing support was removed some
time ago.
2024-04-24 16:28:34 +10:00
whosehang 65d7c1d2d6 chore: fix some typos in comments
Signed-off-by: whosehang <whosehang@outlook.com>
2024-04-24 13:58:51 +08:00
The Miri Cronjob Bot 7e968351aa Merge from rustc 2024-04-24 05:04:52 +00:00
The Miri Cronjob Bot b3affd3e90 Preparing for merge from rustc 2024-04-24 04:57:24 +00:00
bors 29a56a3b1c Auto merge of #122053 - erikdesjardins:alloca, r=nikic
Stop using LLVM struct types for alloca

The alloca type has no semantic meaning, only the size (and alignment, but we specify it explicitly) matter. Using `[N x i8]` is a more direct way to specify that we want `N` bytes, and avoids relying on LLVM's struct layout. It is likely that a future LLVM version will change to an untyped alloca representation.

Split out from #121577.

r? `@ghost`
2024-04-24 03:00:44 +00:00
bors c1feb3ecee Auto merge of #124312 - weihanglo:update-cargo, r=weihanglo
Update cargo

7 commits in 80d5b607dde6ef97dfff4e23923822c01d2bb036..c9392675917adc2edab269eea27c222b5359c637
2024-04-19 18:39:22 +0000 to 2024-04-23 19:35:19 +0000
- fix(install): Don't respect MSRV for non-local installs (rust-lang/cargo#13790)
- gate some libc usages under cfg(unix), drop os_info features (rust-lang/cargo#13782)
- feat(resolver): Add default Edition2024 to resolver v3 (rust-lang/cargo#13785)
- Fix 2 tests for offline execution (rust-lang/cargo#13789)
- fix(toml): Report `_` fied variants (e.g. `dev_dependencies`) as deprecated (rust-lang/cargo#13783)
- feat(resolver): Add v3 resolver for MSRV-aware resolving (rust-lang/cargo#13776)
- Unused dependencies cleanup (rust-lang/cargo#13778)

r? ghost
2024-04-24 00:54:27 +00:00
Weihang Lo b09a97aea8
Update cargo 2024-04-23 20:50:00 -04:00
bors fee0e668bc Auto merge of #121557 - RalfJung:const-fn-call-promotion, r=oli-obk
restrict promotion of `const fn` calls

We only promote them in `const`/`static` initializers, but even that is still unfortunate -- we still cannot add promoteds to required_consts. But we should add them there to make sure it's always okay to evaluate every const we encounter in a MIR body.  That effort of not promoting things that can fail to evaluate is tracked in https://github.com/rust-lang/rust/issues/80619. These `const fn` calls are the last missing piece.

So I propose that we do not promote const-fn calls in const when that may fail without the entire const failing, thereby completing https://github.com/rust-lang/rust/issues/80619. Unfortunately we can't just reject promoting these functions outright due to backwards compatibility. So let's see if we can find a hack that makes crater happy...

For the record, this is the [crater analysis](https://github.com/rust-lang/rust/pull/80243#issuecomment-751885520) from when I tried to entirely forbid this kind of promotion. It's a tiny amount of breakage and if we had a nice alternative for code like that, we could conceivably push it through... but sadly, inline const expressions are still blocked on t-lang concerns about post-monomorphization errors and we haven't yet figured out an implementation that can resolve those concerns. So we're forced to make progress via other means, such as terrible hacks like this.

Attempt one: only promote calls on the "safe path" at the beginning of a MIR block. This is the path that starts at the start block and continues via gotos and calls, but stops at the first branch. If we had imposed this restriction before stabilizing `if` and `match` in `const`, this would have definitely been sufficient...

EDIT: Turns out that works. :)
**Here's the t-lang [nomination comment](https://github.com/rust-lang/rust/pull/121557#issuecomment-1990902440).** And here's the [FCP comment](https://github.com/rust-lang/rust/pull/121557#issuecomment-2010306165).

r? `@oli-obk`
2024-04-23 22:51:01 +00:00
Christopher B. Speir bcc4469c2b Add diagnostic item for std::iter::Enumerate 2024-04-23 16:50:10 -05:00
Ralf Jung 8436045e24 filter required_consts during inlining 2024-04-23 23:02:54 +02:00
Ralf Jung 173d1bd36b properly fill a promoted's required_consts
then we can also make all_required_consts_are_checked a constant instead of a function
2024-04-23 23:02:54 +02:00
Ralf Jung bf021ea625 interpret: sanity-check that required_consts captures all consts that can fail 2024-04-23 22:52:44 +02:00
Ralf Jung b2b617a88e compute required_consts before promotion, and add promoteds that may fail 2024-04-23 22:52:43 +02:00
Ralf Jung 7183fa09bb promotion: do not promote const-fn calls in const when that may fail without the entire const failing 2024-04-23 22:52:43 +02:00
bors 244da22fab Auto merge of #123126 - oli-obk:feed_crate_num, r=davidtwco
Enable `CrateNum` query feeding via `TyCtxt`

Instead of having a magic function that violates some `TyCtxtFeed` invariants, add a `create_def` equivalent for `CrateNum`s.

Note that this still isn't tracked by the query system (unlike `create_def`), and that feeding most `CrateNum` queries for crates other than the local one will likely cause performance regressions.

These things should be attempted on their own separately, but this PR should stand on its own
2024-04-23 20:46:48 +00:00
Vadim Petrochenkov 7b7c26f09b delegation: Support async, const, extern "ABI" and C-variadic functions
Also allow `impl Trait` in delegated functions.
The delegation item will refer to the original opaque type from the callee, fresh opaque type won't be created.
2024-04-23 23:05:39 +03:00
Vadim Petrochenkov 99b635eafa delegation: Support renaming 2024-04-23 22:38:16 +03:00
bors 40dcd796d0 Auto merge of #124302 - matthiaskrgr:rollup-2aya8n8, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #124003 (Dellvmize some intrinsics (use `u32` instead of `Self` in some integer intrinsics))
 - #124169 (Don't fatal when calling `expect_one_of` when recovering arg in `parse_seq`)
 - #124286 (Subtree sync for rustc_codegen_cranelift)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-23 18:23:46 +00:00
Matthias Krüger a760954ca9
Rollup merge of #124286 - bjorn3:sync_cg_clif-2024-04-23, r=bjorn3
Subtree sync for rustc_codegen_cranelift

This fixes a crash when compiling the standard library. In addition the Cranelift update fixes all the 128bit int abi incompatibility between cg_clif and cg_llvm.

r? ``@ghost``

``@rustbot`` label +A-codegen +A-cranelift +T-compiler
2024-04-23 20:17:52 +02:00
Matthias Krüger afb6c4681a
Rollup merge of #124169 - compiler-errors:parser-fatal, r=oli-obk
Don't fatal when calling `expect_one_of` when recovering arg in `parse_seq`

In `parse_seq`, when parsing a sequence of token-separated items, if we don't see a separator, we try to parse another item eagerly in order to give a good diagnostic and recover from a missing separator:
d1a0fa5ed3/compiler/rustc_parse/src/parser/mod.rs (L900-L901)

If parsing the item itself calls `expect_one_of`, then we will fatal because of #58903:
d1a0fa5ed3/compiler/rustc_parse/src/parser/mod.rs (L513-L516)

For `precise_capturing` feature I implemented, we do end up calling `expected_one_of`:
d1a0fa5ed3/compiler/rustc_parse/src/parser/ty.rs (L712-L714)

This leads the compiler to fatal *before* having emitted the first error, leading to absolutely no useful information for the user about what happened in the parser.

This PR makes it so that we stop doing that.

Fixes #124195
2024-04-23 20:17:51 +02:00
Matthias Krüger 918304b190
Rollup merge of #124003 - WaffleLapkin:dellvmization, r=scottmcm,RalfJung,antoyo
Dellvmize some intrinsics (use `u32` instead of `Self` in some integer intrinsics)

This implements https://github.com/rust-lang/compiler-team/issues/693 minus what was implemented in #123226.

Note: I decided to _not_ change `shl`/... builder methods, as it just doesn't seem worth it.

r? ``@scottmcm``
2024-04-23 20:17:51 +02:00
Eduardo Sánchez Muñoz 4dbc4f87e6 Fix wording in shift functions doc comments 2024-04-23 19:23:15 +02:00
Eduardo Sánchez Muñoz ed15716fe6 Configure clippy not to generate warnings about arithmetic operations on rustc_target::abi::Size 2024-04-23 18:59:53 +02:00
Eduardo Sánchez Muñoz 799a4ded54 Implement LLVM x86 AVX2 intrinsics 2024-04-23 18:59:53 +02:00
bors c2f2db79ca Auto merge of #124295 - fmease:rollup-i3apkc6, r=fmease
Rollup of 7 pull requests

Successful merges:

 - #120929 (Wrap dyn type with parentheses in suggestion)
 - #122591 (Suggest using type args directly instead of equality constraint)
 - #122598 (deref patterns: lower deref patterns to MIR)
 - #123048 (alloc::Layout: explicitly document size invariant on the type level)
 - #123993 (Do `check_coroutine_obligations` once per typeck root)
 - #124218 (Allow nesting subdiagnostics in #[derive(Subdiagnostic)])
 - #124285 (Mark ``@RUSTC_BUILTIN`` search path usage as unstable)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-23 16:11:09 +00:00
Josh Stone 899e3ae86b bootstrap: keep all cargo test files in dist rustc-src
Cargo tests use some files that we would otherwise exclude, especially
the `cargo init` tests that are meant to deal with pre-existing `.git`
and `.hg` repos and their ignore files. Keeping these in our dist
tarball doesn't take much space, and allows distro builds to run these
tests successfully.
2024-04-23 09:06:52 -07:00
León Orell Valerian Liehr 5ff1fa9921
Rollup merge of #124285 - ferrocene:unstable-L-rust-builtin, r=petrochenkov
Mark `@RUSTC_BUILTIN` search path usage as unstable

Follow up to https://github.com/rust-lang/rust/pull/121843

r? `@petrochenkov`
2024-04-23 17:25:17 +02:00
León Orell Valerian Liehr 6e423e1651
Rollup merge of #124218 - Xiretza:subsubdiagnostics, r=davidtwco
Allow nesting subdiagnostics in #[derive(Subdiagnostic)]
2024-04-23 17:25:17 +02:00
León Orell Valerian Liehr e15d6f9d85
Rollup merge of #123993 - compiler-errors:coroutine-obl, r=lcnr
Do `check_coroutine_obligations` once per typeck root

We only need to do `check_coroutine_obligations` once per typeck root, especially since the new solver can't really (easily) associate which obligations correspond to which coroutines.

This requires us to move the checks for sized coroutine fields into `mir_coroutine_witnesses`, but that's fine imo.

r? lcnr
2024-04-23 17:25:16 +02:00
León Orell Valerian Liehr 2d7d480054
Rollup merge of #123048 - RalfJung:layout, r=dtolnay
alloc::Layout: explicitly document size invariant on the type level

https://github.com/rust-lang/rust/pull/95295 added this to the constructor, but it seems worth documenting the type invariant at the type level.
2024-04-23 17:25:16 +02:00
León Orell Valerian Liehr 332cac2c6d
Rollup merge of #122598 - Nadrieril:full-derefpats, r=matthewjasper
deref patterns: lower deref patterns to MIR

This lowers deref patterns to MIR. This is a bit tricky because this is the first kind of pattern that requires storing a value in a temporary. Thanks to https://github.com/rust-lang/rust/pull/123324 false edges are no longer a problem.

The thing I'm not confident about is the handling of fake borrows. This PR ignores any fake borrows inside a deref pattern. We are guaranteed to at least fake borrow the place of the first pointer value, which could be enough, but I'm not certain.
2024-04-23 17:25:15 +02:00
León Orell Valerian Liehr 68939f7826
Rollup merge of #122591 - gurry:122162-impl-type-binding-suggestion, r=fmease
Suggest using type args directly instead of equality constraint

When type arguments are written erroneously using an equality constraint we suggest specifying them directly without the equality constraint.

Fixes #122162

Changes the diagnostic in the issue from:
```rust
error[E0229]: associated type bindings are not allowed here
9 | impl std::cmp::PartialEq<Rhs = T> for S {
  |                          ^^^^^^^ associated type not allowed here
  |
```
to
```rust
error[E0229]: associated type bindings are not allowed here
9 | impl std::cmp::PartialEq<Rhs = T> for S {
  |                          ^^^^^^^ associated type not allowed here
  |
help: to use `T` as a generic argument specify it directly
  |
  |      impl std::cmp::PartialEq<T> for S {
  |                               ~
```
2024-04-23 17:25:14 +02:00
León Orell Valerian Liehr 80f2b91b20
Rollup merge of #120929 - long-long-float:wrap-dyn-in-suggestion, r=fmease
Wrap dyn type with parentheses in suggestion

Close #120223

Fix wrong suggestion that is grammatically incorrect.
Specifically, I added parentheses to dyn types that need lifetime bound.

```
help: consider adding an explicit lifetime bound
  |
4 |     executor: impl FnOnce(T) -> (dyn Future<Output = ()>) + 'static,
  |                                 +                       +++++++++++
```
2024-04-23 17:25:14 +02:00
bjorn3 96152c7df3 Fix broken subtree sync 2024-04-23 14:56:13 +00:00
Ralf Jung 5d1654a40a CI: don't run cron-fail-notify when the job just got canceled
Doesn't seem right to prepare a PR in that case
2024-04-23 16:17:00 +02:00
bors cd90d5c035 Auto merge of #122317 - compiler-errors:fulfill-method-probe, r=lcnr
Use fulfillment in method probe, not evaluation

This PR reworks method probing to use fulfillment instead of a `for`-loop of `evaluate_predicate` calls, and moves normalization from method candidate assembly into the `consider_probe`, where it's applied to *all* candidates. This last part coincidentally fixes https://github.com/rust-lang/rust/issues/121643#issuecomment-1975371248.

Regarding *why* this large rewrite is done: In general, it's an anti-pattern to do `for o in obligations { evaluate(o); }` because it's not compatible with the way that the new solver emits alias-relate obligations which constrain variables that may show up in other predicates.

r? lcnr
2024-04-23 14:07:05 +00:00
bors 26faaa3047 Auto merge of #3504 - forcedebug:master, r=RalfJung
chore: fix some typos in comments
2024-04-23 12:43:31 +00:00
bors 579940c7e2 Auto merge of #3503 - RalfJung:win-tls, r=RalfJung
add Windows TLS bug to trophy case
2024-04-23 12:11:52 +00:00
Ralf Jung ed36dde1d2 add Windows TLS bug to trophy case 2024-04-23 14:10:07 +02:00
forcedebug 15a1b0df63 chore: fix some typos in comments
Signed-off-by: forcedebug <forcedebug@outlook.com>
2024-04-23 19:12:04 +08:00
bors ad07aa12c9 Auto merge of #124289 - matthiaskrgr:rollup-oxw52jy, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #123050 (panic_str only exists for the migration to 2021 panic macros)
 - #124067 (weak lang items are not allowed to be #[track_caller])
 - #124099 (Disallow ambiguous attributes on expressions)
 - #124284 (parser: remove unused(no reads) max_angle_bracket_count field)
 - #124288 (remove `push_trait_bound_inner`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-23 11:02:14 +00:00
Matthias Krüger 802f629cfe
Rollup merge of #124288 - fee1-dead-contrib:rm_inner, r=fmease
remove `push_trait_bound_inner`

Don't see a use for it.
2024-04-23 12:10:27 +02:00
Matthias Krüger 5d017f27d5
Rollup merge of #124284 - klensy:no-reads, r=fmease
parser: remove unused(no reads) max_angle_bracket_count field

Isn't there (clippy) lint for variables with only writes? They should be marked as dead too, probably.
Found only https://rust-lang.github.io/rust-clippy/master/index.html#/collection_is_never_read
2024-04-23 12:10:26 +02:00