Commit Graph

265146 Commits

Author SHA1 Message Date
Matthias Krüger
485fd3815c
Rollup merge of #129896 - lcnr:bail-on-unknowable, r=jackh726
do not attempt to prove unknowable goals

In case a goal is unknowable, we previously still checked all other possible ways to prove this goal, even though its final result is already guaranteed to be ambiguous. By ignoring all other candidates in that case we can avoid a lot of unnecessary work, fixing the performance regression in typenum found in #121848.

This is already the behavior in the old solver. This could in theory cause future-compatability issues as considering fewer goals unknowable may end up causing performance regressions/hangs. I am quite confident that this will not be an issue.

r? ``@compiler-errors``
2024-09-03 19:13:26 +02:00
Matthias Krüger
2f6e85567a
Rollup merge of #129863 - RalfJung:target-spec-features, r=wesleywiser
update comment regarding TargetOptions.features

The claim that `-Ctarget-features` cannot disable these features set in the target spec is definitely wrong -- I tried it for `x86_64-pc-windows-gnu`, which enables SSE3 that way. Building with `-Ctarget-feature=-sse3` works fine, and `cfg!(target_feature = "sse3")` is `false` in that build.

There are also some indications that these are actually intended to be overwritten:

3b14526cea/compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs (L22-L23)

84ac80f192/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs (L18-L23)

So... let's update the comment to match reality, I guess?

The claim that they overwrite `-Ctarget-cpu` is based on
- for `native`, the comment in the apple target spec quoted above
- for other CPU strings, the assumption that `LLVMRustCreateTargetMachine` will apply these features after doing whatever the base CPU model does. I am not sure how to check that, I hope some LLVM backend people can chime in. :)
2024-09-03 19:13:25 +02:00
Matthias Krüger
1453cce5e9
Rollup merge of #129630 - alexcrichton:document-broken-c-abi-on-wasm32-u-u, r=workingjubilee
Document the broken C ABI of `wasm32-unknown-unknown`

Inspired by discussion on
https://github.com/rust-lang/rust/issues/129486 this is intended to at least document the current state of the world in a more public location than throughout a series of issues.
2024-09-03 19:13:24 +02:00
Matthias Krüger
e7504ac704
Rollup merge of #128934 - Nadrieril:fix-empty-non-exhaustive, r=compiler-errors
Non-exhaustive structs may be empty

This is a follow-up to a discrepancy noticed in https://github.com/rust-lang/rust/pull/122792: today, the following struct is considered inhabited (non-empty) outside its defining crate:
```rust
#[non_exhaustive]
pub struct UninhabitedStruct {
    pub never: !,
    // other fields
}
```

`#[non_exhaustive]` on a struct should mean that adding fields to it isn't a breaking change. There is no way that adding fields to this struct could make it non-empty since the `never` field must stay and is inconstructible. I suspect this was implemented this way due to confusion with `#[non_exhaustive]` enums, which indeed should be considered non-empty outside their defining crate.

I propose that we consider such a struct uninhabited (empty), just like it would be without the `#[non_exhaustive]` annotation.

Code that doesn't pass today and will pass after this:
```rust
// In a different crate
fn empty_match_on_empty_struct<T>(x: UninhabitedStruct) -> T {
    match x {}
}
```

This is not a breaking change.

r? ``@compiler-errors``
2024-09-03 19:13:24 +02:00
Matthias Krüger
51c686f32b
Rollup merge of #128701 - veera-sivarajan:fix-128604, r=estebank
Don't Suggest Labeling `const` and `unsafe` Blocks

Fixes #128604

Previously, both anonymous constant blocks (E.g. The labeled block
inside `['_'; 'block: { break 'block 1 + 2; }]`) and inline const
blocks (E.g. `const { ... }`) were considered to be the same
kind of blocks. This caused the compiler to incorrectly suggest
labeling both the blocks when only anonymous constant blocks can be
labeled.

This PR adds an other enum variant to `Context` so that both the
blocks can be handled appropriately.

Also, adds some doc comments and removes unnecessary `&mut` in a
couple of places.
2024-09-03 19:13:23 +02:00
Matthias Krüger
f75a1954eb
Rollup merge of #127692 - veera-sivarajan:bugfix-125139, r=estebank
Suggest `impl Trait` for References to Bare Trait in Function Header

Fixes #125139

This PR suggests `impl Trait` when `&Trait` is found as a function parameter type or return type. This makes use of existing diagnostics by adding `peel_refs()` when checking for type equality.

Additionaly, it makes a few other improvements:
1. Checks if functions inside impl blocks have bare trait in their headers.
2. Introduces a trait `NextLifetimeParamName` similar to the existing `NextTypeParamName` for suggesting a lifetime name. Also, abstracts out the common logic between the two trait impls.

### Related Issues
I ran into a bunch of related diagnostic issues but couldn't fix them within the scope of this PR. So, I have created the following issues:
1. [Misleading Suggestion when Returning a Reference to a Bare Trait from a Function](https://github.com/rust-lang/rust/issues/127689)
2. [Verbose Error When a Function Takes a Bare Trait as Parameter](https://github.com/rust-lang/rust/issues/127690)
3. [Incorrect Suggestion when Returning a Bare Trait from a Function](https://github.com/rust-lang/rust/issues/127691)

r​? ```@estebank``` since you implemented  #119148
2024-09-03 19:13:23 +02:00
Alex Crichton
2d6d6a84df Updates/clarifications 2024-09-03 07:19:42 -07:00
Chris Denton
c811d3126f
More robust extension checking 2024-09-03 14:36:21 +02:00
Pietro Albini
17f3f92e8b
include 1.80.1 release notes on master
Forgot this during the release process
2024-09-03 12:42:48 +02:00
Ralf Jung
aa1f60ecff rustc_driver_impl: remove some old dead logic 2024-09-03 09:42:37 +02:00
Ralf Jung
5c0dfc6182 update comment regarding TargetOptions.features 2024-09-03 09:35:15 +02:00
Jan Sommer
6fd358e99d Add documentation for target armv7-rtems-eabihf 2024-09-03 09:20:49 +02:00
Jan Sommer
124454cda8 rtems: Add spec file for arm_rtems6_eabihf 2024-09-03 09:20:49 +02:00
Jan Sommer
6f435cb07f Port std library to RTEMS 2024-09-03 09:19:29 +02:00
lcnr
6188aae369 do not attempt to prove unknowable goals 2024-09-03 08:35:23 +02:00
Nicholas Nethercote
0b2b03cf70 Clarify a comment. 2024-09-03 16:04:09 +10:00
Nicholas Nethercote
827fa43392 Reduce visibility of MirPass and related things.
They're now all just used within this crate.
2024-09-03 16:04:09 +10:00
Nicholas Nethercote
2aae619edb Move MirPass to rustc_mir_transform.
Because that's now the only crate that uses it.

Moving stuff out of `rustc_middle` is always welcome.

I chose to use `impl crate::MirPass`/`impl crate::MirLint` (with
explicit `crate::`) everywhere because that's the only mention of
`MirPass`/`MirLint` used in all of these files. (Prior to this change,
`MirPass` was mostly imported via `use rustc_middle::mir::*` items.)
2024-09-03 16:03:46 +10:00
bors
d6c8169c18 Auto merge of #129922 - matthiaskrgr:rollup-4vqx8ct, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #129152 (custom/external clippy support for bootstrapping)
 - #129311 (don't copy `.rustc-dev-contents` from CI rustc)
 - #129800 (Move the Windows remove_dir_all impl into a module and make it more race resistant)
 - #129860 (update `object` dependency to remove duplicate `wasmparser`)
 - #129885 (chore: remove repetitive words)
 - #129913 (Add missing read_buf stub for x86_64-unknown-l4re-uclibc)
 - #129916 (process.rs: remove "Basic usage" text where not useful)
 - #129917 (Fix parsing of beta version in dry-run mode)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-03 05:44:18 +00:00
Nicholas Nethercote
5410900aaa Adjust SanityCheck.
The actual implementation remains in `rustc_mir_dataflow`, but this
commit moves the `MirPass` impl to `rustc_mir_transform` and changes it
to a `MirLint` (fixing a `FIXME` comment).

(I originally tried moving the full implementation from
`rustc_mir_dataflow` but I had some trait problems with `HasMoveData`
and `RustcPeekAt` and `MaybeLiveLocals`. This commit was much smaller
and simpler, but still will allow some follow-up cleanups.)
2024-09-03 15:18:30 +10:00
Matthias Krüger
29bcf8062a
Rollup merge of #129917 - Kobzol:fix-beta-git, r=Mark-Simulacrum
Fix parsing of beta version in dry-run mode

This was blocking beta release.

r? `@BoxyUwU`
2024-09-03 06:05:42 +02:00
Matthias Krüger
6e38c9bc83
Rollup merge of #129916 - tshepang:basic-usage, r=ChrisDenton
process.rs: remove "Basic usage" text where not useful

Is not useful because just a single example is given.
2024-09-03 06:05:42 +02:00
Matthias Krüger
f943c53c59
Rollup merge of #129913 - saethlin:l4re-read-buf, r=Noratrieb
Add missing read_buf stub for x86_64-unknown-l4re-uclibc

Before this PR, `x check library/std --target x86_64-unknown-l4re-uclibc` will fail with
```
error[E0599]: no method named `read_buf` found for struct `Socket` in the current scope
   --> std/src/os/unix/net/stream.rs:598:16
    |
598 |         self.0.read_buf(buf)
    |                ^^^^^^^^
    |
   ::: std/src/sys/pal/unix/l4re.rs:23:5
    |
23  |     pub struct Socket(FileDesc);
    |     ----------------- method `read_buf` not found for this struct
    |
    = help: items from traits can only be used if the trait is implemented and in scope
```

This target doesn't have a maintainer to cc.
2024-09-03 06:05:42 +02:00
Matthias Krüger
afb92329dc
Rollup merge of #129885 - cuishuang:master, r=scottmcm
chore: remove repetitive words
2024-09-03 06:05:41 +02:00
Matthias Krüger
e9cd99670a
Rollup merge of #129860 - lqd:remove-duplicate-deps, r=alexcrichton
update `object` dependency to remove duplicate `wasmparser`

``@alexcrichton`` in #129762 you bumped a few wasm-related dependencies and tried to avoid duplicates.

If I understand correctly, `object` 0.36.4 wasn't yet released at the time, and therefore #129762 ended up duplicating `wasmparser`. Now that the release happened, we can remove the duplicate.

r? ``@alexcrichton``
2024-09-03 06:05:41 +02:00
Matthias Krüger
72cc383a7f
Rollup merge of #129800 - ChrisDenton:remove-dir-all2, r=Amanieu
Move the Windows remove_dir_all impl into a module and make it more race resistant

This attempts to make the Windows implementation of `remove_dir_all` easier to understand and work with by separating out different concerns into their own functions. The code is mostly the same as before just moved around. There are some changes to make it more robust against races (e.g. two calls to `remove_dir_all` running concurrently). The module level comment explains the issue.

try-job: x86_64-msvc
try-job: i686-msvc
2024-09-03 06:05:40 +02:00
Matthias Krüger
44187d667c
Rollup merge of #129311 - onur-ozkan:multiple-candidates-fix, r=Kobzol
don't copy `.rustc-dev-contents` from CI rustc

Since https://github.com/rust-lang/rust/pull/127188, copying files from `.rustc-dev-contents` regressed https://github.com/rust-lang/rust/issues/108767 again. Since `rustc-src` is already included in the CI rustc sysroot, we don't need to copy these files to have `rustc-src` component.

Blocker for #122709
2024-09-03 06:05:39 +02:00
Matthias Krüger
11398eded1
Rollup merge of #129152 - onur-ozkan:custom-clippy, r=Kobzol
custom/external clippy support for bootstrapping

Similar to cargo, rustc, and rustfmt, this adds the support of using custom clippy on bootstrap. It’s designed for those who want to test their own clippy builds or avoid downloading the stage0 clippy.

Closes #121518
2024-09-03 06:05:39 +02:00
bors
6199b69c53 Auto merge of #129777 - nnethercote:unreachable_pub-4, r=Urgau
Add `unreachable_pub`, round 4

A follow-up to #129732.

r? `@Urgau`
2024-09-03 01:27:20 +00:00
Kevin Mehall
22bd319772 Add Waker::new and LocalWaker::new
Per the `waker_getters` FCP:
https://github.com/rust-lang/rust/issues/96992#issuecomment-1941998046

Docs largely copied from `RawWaker::new`.
2024-09-02 18:51:59 -06:00
Kevin Mehall
2dc75148ee Stabilize waker_getters 2024-09-02 18:51:59 -06:00
Kevin Mehall
8d3e5fa0ae Move the data and vtable methods from RawWaker to Waker
Per the `waker_getters` FCP:
https://github.com/rust-lang/rust/issues/96992#issuecomment-1941998046
2024-09-02 18:51:26 -06:00
Guillaume Gomez
55bc638a1d Fix wrong padding for expanded scraped example 2024-09-03 01:04:59 +02:00
bors
2251572086 Auto merge of #129915 - matthiaskrgr:rollup-56h2xp2, r=matthiaskrgr
Rollup of 12 pull requests

Successful merges:

 - #129748 (Box validity: update for new zero-sized rules)
 - #129829 (Make decoding non-optional `LazyArray` panic if not set)
 - #129856 (compiler_fence documentation: emphasize synchronization, not reordering)
 - #129868 (Remove kobzol vacation status)
 - #129875 (chore: Fix typos in 'compiler' (batch 1))
 - #129877 (chore: Fix typos in 'compiler' (batch 2))
 - #129878 (chore: Fix typos in 'compiler' (batch 3))
 - #129890 (Remove stray word in a comment)
 - #129892 (Clarify language around ptrs in slice::raw)
 - #129905 (mailmap: add new email for davidtwco)
 - #129906 (mailmapper?)
 - #129907 (Fix compile error in solid's remove_dir_all)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-02 22:54:39 +00:00
Nicholas Nethercote
88b6a78d0b Add warn(unreachable_pub) to rustc_const_eval. 2024-09-03 08:50:33 +10:00
Nicholas Nethercote
d7caea129d Add warn(unreachable_pub) to rustc_ty_utils. 2024-09-03 08:50:33 +10:00
Nicholas Nethercote
3e09c450b4 Add warn(unreachable_pub) to rustc_type_ir. 2024-09-03 08:50:31 +10:00
Nicholas Nethercote
e4b1e28033 Add warn(unreachable_pub) to rustc_transmute. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote
2e358e633d Add warn(unreachable_pub) to rustc_trait_selection. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote
c4f6f52139 Add warn(unreachable_pub) to rustc_traits. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote
0fb3a509cf Add warn(unreachable_pub) to rustc_target. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote
89deb3c742 Add warn(unreachable_pub) to rustc_symbol_mangling. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote
b0f22ff98f Add warn(unreachable_pub) to rustc_span. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote
b457ab3186 Add warn(unreachable_pub) to rustc_smir. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote
19ff6e6e63 Add warn(unreachable_pub) to rustc_session. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote
21a37da268 Add warn(unreachable_pub) to rustc_serialize. 2024-09-03 08:49:54 +10:00
Nicholas Nethercote
19843bba64 Add warn(unreachable_pub) to rustc_sanitizers. 2024-09-03 08:49:54 +10:00
Jakub Beránek
f1e5191807
Fix parsing of beta version in dry-run mode 2024-09-02 23:16:15 +02:00
Tshepang Mbambo
0a89f72065 process.rs: remove "Basic usage" text where not useful
Is not useful because just a single example is given.
2024-09-02 22:36:25 +02:00
Matthias Krüger
d6298d3736
Rollup merge of #129907 - saethlin:solid-io-error, r=WaffleLapkin
Fix compile error in solid's remove_dir_all

Before this PR, `x check library/std --target=aarch64-kmc-solid_asp3` will fail with:
```
error[E0382]: use of partially moved value: `result`
   --> std/src/sys/pal/solid/fs.rs:544:20
    |
541 |         if let Err(err) = result
    |                    --- value partially moved here
...
544 |             return result;
    |                    ^^^^^^ value used here after partial move
    |
    = note: partial move occurs because value has type `io::error::Error`, which does not implement the `Copy` trait
help: borrow this binding in the pattern to avoid moving the value
    |
541 |         if let Err(ref err) = result
    |                    +++

```

cc `@kawadakk` I think this will clear up https://solid-rs.github.io/toolstate/ :)
2024-09-02 22:35:23 +02:00