Commit graph

259253 commits

Author SHA1 Message Date
bors f92a6c41e6 Auto merge of #127176 - fee1-dead-contrib:fx-requires-next-solver, r=compiler-errors
Make `feature(effects)` require `-Znext-solver`

Per https://github.com/rust-lang/rust/pull/120639#pullrequestreview-2144804638

I made this a hard error because otherwise it should be a lint and that seemed more complicated. Not sure if this is the best place to put the error though.

r? project-const-traits
2024-07-01 04:21:13 +00:00
bors ad12a2a5fc Auto merge of #127082 - GuillaumeGomez:help-gui-test, r=notriddle
Add back `help-page.goml` rustdoc GUI test

Since https://github.com/rust-lang/rust/pull/127010 was merged, let's see if we can revert https://github.com/rust-lang/rust/pull/126445...

r? `@notriddle`
2024-07-01 00:52:41 +00:00
bors b8d7dd8d69 Auto merge of #127026 - Urgau:cleanup-bootstrap-check-cfg, r=Kobzol
Cleanup bootstrap check-cfg

This PR cleanup many custom `check-cfg` in bootstrap that have been accumulated over the years.

As well as updating some outdated comments.
2024-06-30 22:27:29 +00:00
bors 6868c831a1 Auto merge of #127174 - matthiaskrgr:rollup-q87j6cn, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #126018 (Remove the `box_pointers` lint.)
 - #126895 (Fix simd_gather documentation)
 - #126981 (Replace some magic booleans in match-lowering with enums)
 - #127038 (Update test comment)
 - #127053 (Update the LoongArch target documentation)
 - #127069 (small correction to fmt::Pointer impl)
 - #127157 (coverage: Avoid getting extra unexpansion info when we don't need it)
 - #127160 (Add a regression test for #123630)
 - #127161 (Improve `run-make-support` library `args` API)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-30 20:14:40 +00:00
Deadbeef daff015314 Migrate tests to use -Znext-solver 2024-06-30 17:08:45 +00:00
Deadbeef 34ae56de35 Make feature(effects) require -Znext-solver 2024-06-30 17:08:10 +00:00
Matthias Krüger 4037197353
Rollup merge of #127161 - GuillaumeGomez:improve-run-make-args, r=Kobzol
Improve `run-make-support` library `args` API

It allows to pass both `Vec` and slices, which makes it much better (for me at least 😉).

r? ``@Kobzol``
2024-06-30 18:25:35 +02:00
Matthias Krüger 6335b83703
Rollup merge of #127160 - pacak:123630-test, r=Nadrieril
Add a regression test for #123630

Fixes #123630

compiler should not suggest nonsensical signatures, original suggestion was

```
error[E0308]: mismatched types
 --> src/lib.rs:3:31
  |
3 | fn select<F, I>(filter: F) -> Select<F, I> {
  |    ------                     ^^^^^^^^^^^^ expected `Select<F, I>`, found `()`
  |    |
  |    implicitly returns `()` as its body has no tail or `return` expression
  |
  = note: expected struct `Select<F, I>`
          found unit type `()`

error[E0282]: type annotations needed for `Select<{closure@src/lib.rs:8:22: 8:25}, I>`
 --> src/lib.rs:8:9
  |
8 |     let lit = select(|x| match x {
  |         ^^^
  |
help: consider giving `lit` an explicit type, where the type for type parameter `I` is specified
  |
8 |     let lit: Select<{closure@src/lib.rs:8:22: 8:25}, I> = select(|x| match x {
  |            ++++++++++++++++++++++++++++++++++++++++++++

Some errors have detailed explanations: E0282, E0308. For more information about an error, try `rustc --explain E0282`.
```
2024-06-30 18:25:35 +02:00
Matthias Krüger b2aebc1b76
Rollup merge of #127157 - Zalathar:unexpand, r=cjgillot
coverage: Avoid getting extra unexpansion info when we don't need it

Several callers of `unexpand_into_body_span_with_visible_macro` would immediately discard the additional macro-related information, which is wasteful. We can avoid this by having them instead call a simpler method that just returns the span they care about.

This PR also moves the relevant functions out of `coverage::spans::from_mir` and into a new submodule `coverage::unexpand`, so that calling them from `coverage::mappings` is less awkward.

There should be no actual changes to coverage-instrumentation output, as demonstrated by the absence of test updates.
2024-06-30 18:25:34 +02:00
Matthias Krüger 7a43417c36
Rollup merge of #127069 - Sky9x:fmt-pointer-use-addr, r=Nilstrieb
small correction to fmt::Pointer impl

~~The `addr` method does not require `T: Sized`, and is preferred for use over `expose_provenance`.~~
`expose_provenance` does not require `T: Sized`.
2024-06-30 18:25:34 +02:00
Matthias Krüger 7e05bc3854
Rollup merge of #127053 - xen0n:update-loong-docs, r=Nilstrieb,heiher
Update the LoongArch target documentation

The docs for the LoongArch targets are a bit dated since their introduction, and the prose has some room for improvement as well. Streamline a bit, referring to the neighboring targets' docs, and provide up-to-date information as much as I can come up with.

cc fellow target maintainer `@heiher` for review of target-specific bits
2024-06-30 18:25:33 +02:00
Matthias Krüger 1fac8de919
Rollup merge of #127038 - BoxyUwU:reword_comment, r=camelid
Update test comment

r? `@camelid`

Rewrote this comment since it mixed up a/b in one place and was generally a bit confusing
2024-06-30 18:25:33 +02:00
Matthias Krüger d404ce7015
Rollup merge of #126981 - Zalathar:enums, r=Nadrieril
Replace some magic booleans in match-lowering with enums

This PR takes some boolean arguments used by the match-lowering code, and replaces them with dedicated enums that more clearly express their effect, while also making it much easier to find how each value is ultimately used.
2024-06-30 18:25:32 +02:00
Matthias Krüger 5f43a89815
Rollup merge of #126895 - betelgeuse:improve_simd_gather_documentation, r=Amanieu
Fix simd_gather documentation

There is no idx in the function signature.
2024-06-30 18:25:32 +02:00
Matthias Krüger 6f5765599e
Rollup merge of #126018 - nnethercote:rm-box_pointers-lint, r=lcnr
Remove the `box_pointers` lint.

As the comment says, this lint "is mostly historical, and not particularly useful". It's not worth keeping it around.

r? ``@estebank``
2024-06-30 18:25:31 +02:00
bors ef3d6fd700 Auto merge of #127162 - bjorn3:sync_cg_clif-2024-06-30, r=bjorn3
Subtree sync for rustc_codegen_cranelift

The main highlight this time is support for arm64 macOS in cg_clif. A future PR will enable distributing it as rustup component.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler
2024-06-30 16:23:04 +00:00
Boxy f79bf19a7a Update test comment 2024-06-30 15:16:11 +01:00
bors 6c3485512f Auto merge of #127156 - matthiaskrgr:rollup-jjfd464, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #126705 (Updated docs on `#[panic_handler]` in `library/core/src/lib.rs`)
 - #126876 (Add `.ignore` file to make `config.toml` searchable in vscode)
 - #126906 (Small fixme in core now that split_first has no codegen issues)
 - #127023 (CI: rename Rust for Linux CI job)
 - #127131 (Remove unused `rustc_trait_selection` dependencies)
 - #127134 (Print `TypeId` as a `u128` for `Debug`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-30 13:22:17 +00:00
bjorn3 9ec6a02ab3 Merge commit '49cd5dd454d0115cfbe9e39102a8b3ba4616aa40' into sync_cg_clif-2024-06-30 2024-06-30 11:28:14 +00:00
bjorn3 49cd5dd454 Rustup to rustc 1.81.0-nightly (ba1d7f4a0 2024-06-29) 2024-06-30 11:20:49 +00:00
Michael Baikov 8a0e1ab565 Add a regression test for #123630
compiler should not suggest nonsensical signatures, original suggestion was

error[E0308]: mismatched types
 --> src/lib.rs:3:31
  |
3 | fn select<F, I>(filter: F) -> Select<F, I> {
  |    ------                     ^^^^^^^^^^^^ expected `Select<F, I>`, found `()`
  |    |
  |    implicitly returns `()` as its body has no tail or `return` expression
  |
  = note: expected struct `Select<F, I>`
          found unit type `()`

error[E0282]: type annotations needed for `Select<{closure@src/lib.rs:8:22: 8:25}, I>`
 --> src/lib.rs:8:9
  |
8 |     let lit = select(|x| match x {
  |         ^^^
  |
help: consider giving `lit` an explicit type, where the type for type parameter `I` is specified
  |
8 |     let lit: Select<{closure@src/lib.rs:8:22: 8:25}, I> = select(|x| match x {
  |            ++++++++++++++++++++++++++++++++++++++++++++

Some errors have detailed explanations: E0282, E0308.
For more information about an error, try `rustc --explain E0282`.
2024-06-30 07:12:26 -04:00
bors 2975a21b5d Auto merge of #127024 - cjgillot:jump-prof, r=oli-obk
Avoid cloning jump threading state when possible

The current implementation of jump threading passes most of its time cloning its state. This PR attempts to avoid such clones by special-casing the last predecessor when recursing through a terminator.

This is not optimal, but a first step while I refactor the state data structure to be sparse.

The two other commits are drive-by.
Fixes https://github.com/rust-lang/rust/issues/116721

r? `@oli-obk`
2024-06-30 11:09:53 +00:00
Guillaume Gomez 4b516f599b Improve run-make-support library args API 2024-06-30 12:40:24 +02:00
Zalathar 6c33149055 coverage: Avoid getting extra unexpansion info when we don't need it
These particular callers don't actually use the returned macro information, so
they can use a simpler span-unexpansion function that doesn't return it.
2024-06-30 19:05:14 +10:00
Zalathar ed07712e96 Replace a magic boolean with enum ScheduleDrops 2024-06-30 19:02:25 +10:00
Zalathar 3b22589cfa Replace a magic boolean with enum EmitStorageLive
The previous boolean used `true` to indicate that storage-live should _not_ be
emitted, so all occurrences of `Yes` and `No` should be the logical opposite of
the previous value.
2024-06-30 18:55:39 +10:00
Zalathar ad575b093b Replace a magic boolean with enum DeclareLetBindings
The new enum `DeclareLetBindings` has three variants:
- `Yes`: Declare `let` bindings as normal, for `if` conditions.
- `No`: Don't declare bindings, for match guards and let-else.
- `LetNotPermitted`: Assert that `let` expressions should not occur.
2024-06-30 18:55:39 +10:00
Matthias Krüger f2c287f744
Rollup merge of #127134 - tgross35:typeid-debug, r=Nilstrieb
Print `TypeId` as a `u128` for `Debug`

Since <https://github.com/rust-lang/rust/pull/121358>, `TypeId` is represented as a `(u64, u64)`. This also made the debug implementation a lot larger, which is especially apparent with pretty formatting.

Change this to convert the inner value back to a `u128` and then print as a tuple struct to make this less noisy.

Current:

    TypeId { t: (1403077013027291752, 4518903163082958039) }
    TypeId {
        t: (
            1403077013027291752,
            4518903163082958039,
        ),
    }

New:

    TypeId(25882202575019293479932656973818029271)
    TypeId(
        25882202575019293479932656973818029271,
    )
2024-06-30 10:39:48 +02:00
Matthias Krüger 515d17cd15
Rollup merge of #127131 - Kobzol:remove-unused-deps, r=compiler-errors
Remove unused `rustc_trait_selection` dependencies

Found using `cargo-machete`. The `bitflags` and `derivative` crates were added for the new trait solver, but weren't removed when the next trait solver code was uplifted to a separate crate.
2024-06-30 10:39:48 +02:00
Matthias Krüger 0d99942aec
Rollup merge of #127023 - Kobzol:ci-rfl-rename, r=Mark-Simulacrum
CI: rename Rust for Linux CI job

The `rfl` name was not very [descriptive](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/Testing.20Rust.20for.20Linux.20in.20our.20CI/near/447408854).

try-job: x86_64-rust-for-linux
2024-06-30 10:39:47 +02:00
Matthias Krüger fe1f83ccd7
Rollup merge of #126906 - GrigorenkoPV:fixme-split_at_first, r=Mark-Simulacrum
Small fixme in core now that split_first has no codegen issues

https://github.com/rust-lang/rust/issues/109328#issuecomment-1677366881

BTW, I have a crate implementing exactly this kind of an iterator: https://github.com/GrigorenkoPV/head-tail-iter and I was wondering if it would be worthwhile to try and make an ACP for it to get it included in std (or maybe itertools). My only doubt is that it kinda incentives writing O(n^2) algorithms and is not the hard to replace with a `while let` loop (just as in this PR).
2024-06-30 10:39:47 +02:00
Matthias Krüger c7aee65edd
Rollup merge of #126876 - WaffleLapkin:unignoreconfigtoml, r=Mark-Simulacrum
Add `.ignore` file to make `config.toml` searchable in vscode

Based on this answer on [Stack Overflow](https://stackoverflow.com/a/72059075).
2024-06-30 10:39:47 +02:00
Matthias Krüger b2d46036c5
Rollup merge of #126705 - safinaskar:panic, r=Mark-Simulacrum
Updated docs on `#[panic_handler]` in `library/core/src/lib.rs`
2024-06-30 10:39:46 +02:00
Zalathar 617de8cfb5 coverage: Move span unexpansion into its own submodule 2024-06-30 17:44:19 +10:00
bors 716752ebe6 Auto merge of #127133 - matthiaskrgr:rollup-jxkp3yf, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #123237 (Various rustc_codegen_ssa cleanups)
 - #126960 (Improve error message in tidy)
 - #127002 (Implement `x perf` as a separate tool)
 - #127081 (Add a run-make test that LLD is not being used by default on the x64 beta/stable channel)
 - #127106 (Improve unsafe extern blocks diagnostics)
 - #127110 (Fix a error suggestion for E0121 when using placeholder _ as return types on function signature.)
 - #127114 (fix: prefer `(*p).clone` to `p.clone` if the `p` is a raw pointer)
 - #127118 (Show `used attribute`'s kind for user when find it isn't applied to a `static` variable.)
 - #127122 (Remove uneccessary condition in `div_ceil`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-30 02:20:01 +00:00
bors bf750f5db5 Auto merge of #126869 - matthiaskrgr:kaboom, r=jieyouxu
crashes: add more tests
2024-06-30 00:06:27 +00:00
Trevor Gross 682e7c1174 Print TypeId as a u128 for Debug
Since <https://github.com/rust-lang/rust/pull/121358>, `TypeId` is
represented as a `(u64, u64)`. This also made the debug implementation a
lot larger, which is especially apparent with pretty formatting.

Make this less noisy by converting the inner value back to a `u128` then
printing as a tuple struct.

Current:

    TypeId { t: (1403077013027291752, 4518903163082958039) }
    TypeId {
        t: (
            1403077013027291752,
            4518903163082958039,
        ),
    }

New:

    TypeId(25882202575019293479932656973818029271)
    TypeId(
        25882202575019293479932656973818029271,
    )
2024-06-29 16:39:48 -04:00
Matthias Krüger c79e08d3a6
Rollup merge of #127122 - TDecking:div_ceil, r=Nilstrieb
Remove uneccessary condition in `div_ceil`

Previously, `div_ceil` for unsigned integers had a `rhs > 0` for rounding. That condition however is always fulfilled, since `rhs == 0` would mean a division by zero earlier.
2024-06-29 22:10:59 +02:00
Matthias Krüger 5ea1a03cca
Rollup merge of #127118 - surechen:fix_126789, r=jieyouxu
Show `used attribute`'s kind for user when find it isn't applied to a `static` variable.

For example :
```rust
extern "C" {
    #[used] //~ ERROR attribute must be applied to a `static` variable
    static FOO: i32; // show the kind of this item to help user understand why the error is reported.
}
```

fixes #126789
2024-06-29 22:10:59 +02:00
Matthias Krüger 9879b4606c
Rollup merge of #127114 - linyihai:issue-126863, r=Nadrieril
fix: prefer `(*p).clone` to `p.clone` if the `p` is a raw pointer

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

I wonder if there is a better way to solve the regression problem of this test case:
`tests/ui/borrowck/issue-20801.rs`.
It's okay to drop the dereference symbol in this scenario.

But it's not correct in https://github.com/rust-lang/rust/issues/126863

```
help: consider removing the dereference here
  |
5 -         let inner: String = *p;
5 +         let inner: String = p;
```

I haven't found out how to tell if clone pointer is allowed, i.e. no type mismatch occurs
2024-06-29 22:10:58 +02:00
Matthias Krüger 80cf576f59
Rollup merge of #127110 - surechen:fix_125488_06, r=compiler-errors
Fix a error suggestion for E0121 when using placeholder _ as return types on function signature.

Recommit after refactoring based on comment:
https://github.com/rust-lang/rust/pull/126017#issuecomment-2189149361

But when changing return type's lifetime to `ReError` will affect the subsequent borrow check process and cause test11 in typeck_type_placeholder_item.rs to lost E0515 message.
```rust
fn test11(x: &usize) -> &_ {
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types
    &x //~ ERROR cannot return reference to function parameter(this E0515 msg will disappear)
}
```

fixes #125488

r? ``@pnkfelix``
2024-06-29 22:10:58 +02:00
Matthias Krüger 77152955b8
Rollup merge of #127106 - spastorino:improve-unsafe-extern-blocks-diagnostics, r=compiler-errors
Improve unsafe extern blocks diagnostics

Closes #126327

For this code:

```rust
extern {
    pub fn foo();
    pub safe fn bar();
}
```

We get ...

```
error: items in unadorned `extern` blocks cannot have safety qualifiers
 --> test.rs:3:5
  |
3 |     pub safe fn bar();
  |     ^^^^^^^^^^^^^^^^^^
  |
help: add unsafe to this `extern` block
  |
1 | unsafe extern {
  | ++++++

error[E0658]: `unsafe extern {}` blocks and `safe` keyword are experimental
 --> test.rs:3:9
  |
3 |     pub safe fn bar();
  |         ^^^^
  |
  = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information
  = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
```

And then making the extern block unsafe, we get ...

```
error: extern block cannot be declared unsafe
 --> test.rs:1:1
  |
1 | unsafe extern {
  | ^^^^^^
  |
  = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information
  = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable

error: items in unadorned `extern` blocks cannot have safety qualifiers
 --> test.rs:3:5
  |
3 |     pub safe fn bar();
  |     ^^^^^^^^^^^^^^^^^^

error[E0658]: `unsafe extern {}` blocks and `safe` keyword are experimental
 --> test.rs:3:9
  |
3 |     pub safe fn bar();
  |         ^^^^
  |
  = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information
  = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0658`.
```

r? ``@compiler-errors``
2024-06-29 22:10:57 +02:00
Matthias Krüger fafb2ea57b
Rollup merge of #127081 - Kobzol:lld-test, r=onur-ozkan
Add a run-make test that LLD is not being used by default on the x64 beta/stable channel

https://github.com/rust-lang/rust/pull/126701 showed that the handling of `lld` in bootstrap is currently not ideal. While it would be nice to refactor it eventually, we should also make sure that we have a test that checks that `lld` is not used (yet!) by default on the x64 Linux stable channel.

CC ``@lqd``

r? ``@onur-ozkan``
2024-06-29 22:10:57 +02:00
Matthias Krüger 6d74ffd238
Rollup merge of #127002 - Kobzol:bootstrap-perf-tool, r=onur-ozkan
Implement `x perf` as a separate tool

Continues work from https://github.com/rust-lang/rust/pull/126318, adds a CLI for running `rustc-perf` profiling commands through a new `rustc-perf-wrapper` tool. The CLI is in a separate tool to enable experimentation outside of `bootstrap`.

This is probably most of what we can do so far, I'll add support for benchmarking once `rustc-perf` gets a terminal output for comparing benchmark results.

r? ``@onur-ozkan``
2024-06-29 22:10:56 +02:00
Matthias Krüger 6df68793f3
Rollup merge of #126960 - Kobzol:tidy-venv-message, r=tgross35
Improve error message in tidy

The old error message was wrong (there is no `venv` Python package on PyPi), and we did not specify the correct Python path in the error message.
2024-06-29 22:10:56 +02:00
Matthias Krüger 5b90824433
Rollup merge of #123237 - bjorn3:debuginfo_refactor, r=compiler-errors
Various rustc_codegen_ssa cleanups
2024-06-29 22:10:55 +02:00
Jakub Beránek e52d95bc82 Remove unused compiler dependencies 2024-06-29 22:09:58 +02:00
bors ba1d7f4a08 Auto merge of #120639 - fee1-dead-contrib:new-effects-desugaring, r=oli-obk
Implement new effects desugaring

cc `@rust-lang/project-const-traits.` Will write down notes once I have finished.

* [x] See if we want `T: Tr` to desugar into `T: Tr, T::Effects: Compat<true>`
* [x] Fix ICEs on `type Assoc: ~const Tr` and `type Assoc<T: ~const Tr>`
* [ ] add types and traits to minicore test
* [ ] update rustc-dev-guide

Fixes #119717
Fixes #123664
Fixes #124857
Fixes #126148
2024-06-29 20:08:10 +00:00
bors d1b7355d3d Auto merge of #126801 - Oneirical:seek-and-testroy, r=Kobzol
Migrate `remap-path-prefix`, `debug-assertions` and `emit-stack-sizes` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Needs OSX/MSVC try jobs.

try-job: aarch64-apple
try-job: x86_64-msvc
2024-06-29 17:50:06 +00:00
Santiago Pastorino 15d5dac32e
Avoid suggesting to add unsafe when the extern block is already unsafe 2024-06-29 14:40:32 -03:00