Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 12 pull requests #137153

Closed
wants to merge 31 commits into from

Conversation

workingjubilee
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

dianne and others added 30 commits February 10, 2025 04:08
Because of an ambiguity with const closures, the parser needs to ensure
that for a const item, the `const` keyword isn't followed by a `move` or
`static` keyword, as that would indicate a const closure:

```rust
fn main() {
  const move // ...
}
```

This check did not take raw identifiers into account, therefore being
unable to distinguish between `const move` and `const r#move`. The
latter is obviously not a const closure, so it should be allowed as a
const item.

This fixes the check in the parser to only treat `const ...` as a const
closure if it's followed by the *proper keyword*, and not a raw
identifier.

Additionally, this adds a large test that tests for all raw identifiers in
all kinds of positions, including `const`, to prevent issues like this
one from occurring again.
As an i586 target, it should not have SSE. This caused the following
warning to be emitted:

```
warning: target feature `sse2` must be enabled to ensure that the ABI of the current target can be implemented correctly
  |
  = note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, see issue rust-lang#116344 <rust-lang#116344>

warning: 1 warning emitted
```
It's similar to the other limits, e.g. obtained via `get_limit`. So it
makes sense to handle it consistently with the other limits. We now use
`Limit`/`usize` in most places instead of `Option<usize>`, so we use
`Limit::new(usize::MAX)`/`usize::MAX` to emulate how `None` used to work.

The commit also adds `Limit::unlimited`.
Thanks to the previous commit, they no longer need to be separate.
It's always good to make `rustc_middle` smaller. `rustc_interface` is
the best destination, because it's the only crate that calls
`get_recursive_limit`.
For consistency with `recursion_limit`, `move_size_limit`, and
`type_length_limit`.
…eril

Overhaul `rustc_middle::limits`

In particular, to make `pattern_complexity` work more like other limits, which then enables some other simplifications.

r? `@Nadrieril`
…tion, r=Nadrieril

Pattern Migration 2024: clean up and comment

This follows up on rust-lang#136577 by moving the pattern migration logic to its own module, removing a bit of unnecessary complexity, and adding comments. Since there's quite a bit of pattern migration logic now (and potentially more in rust-lang#136496), I think it makes sense to keep it separate from THIR construction, at least as much as is convenient.

r? `@Nadrieril`
…sDenton

Use `const_error!` when possible

Replace usages of `io::Error::new(io::ErrorKind::Variant, "constant string")` with `io::const_error!(io::ErrorKind::Variant, "constant string")` to avoid allocations when possible. Additionally, fix `&&str` error messages in SGX and missing/misplaced trailing commas in `const_error!`.
… r=workingjubilee

rustc_target: import TargetMetadata
…workingjubilee

Replace some u64 hashes with Hash64

I introduced the Hash64 and Hash128 types in rust-lang#110083, essentially as a mechanism to prevent hashes from landing in our leb128 encoding paths. If you just have a u64 or u128 field in a struct then derive Encodable/Decodable, that number gets leb128 encoding. So if you need to store a hash or some other value which behaves very close to a hash, don't store it as a u64.

This reverts part of rust-lang#117603, which turned an encoded Hash64 into a u64.

Based on rust-lang#110083, I don't expect this to be perf-sensitive on its own, though I expect that it may help stabilize some of the small rmeta size fluctuations we currently see in perf reports.
…, r=compiler-errors

HIR analysis: Remove unnecessary abstraction over list of clauses

`rustc_hir_analysis::bounds::Bounds` with its methods is nowadays a paper-thin wrapper around `Vec<(Clause, Span)>`s and `Vec::push` essentially.

Its existence slightly annoyed me (and I keep opening its corresp. file instead of the identically named `bounds.rs` in `hir_ty_lowering/` that I actually want most of the time :P).

Opening to check if you agree with inlining it.
r? compiler-errors or reassign
…Nadrieril

Restrict DerefPure for Cow<T> impl to T = impl Clone, [impl Clone], str.

Fixes rust-lang#136046

`feature(deref_patterns)` tracking issue: rust-lang#87121

`Cow<'_, T>` should only implement `DerefPure` if its `Deref` impl is pure, which requires `<T::Owned as Borrow<T>>::borrow`  to be pure. This PR restricts `impl DerefPure for Cow<'_, T>` to `T: Sized + Clone`, `T = [U: Clone]`, and `T = str` (for all of whom `<T::Owned as Borrow<T>>::borrow` is implemented in the stdlib and is pure).

cc `@Nadrieril`

------

An alternate approach would be to introduce a new `unsafe trait BorrowPure<T>` analogous to `DerefPure`  that could be implemented for `T: Sized`, `&T`, `&mut T`, `String`, `Vec`, `Box`, `PathBuf`, `OsString`, etc. rust-lang/rust@master...zachs18:borrow-pure-trait
…illaumeGomez

Enable `relative-path-include-bytes-132203` rustdoc-ui test on Windows

The problem with the error message on Windows is:

- The path separators are different
- The OS error message string is different

Normalizing those two things makes the test pass on Windows.
…ompiler-errors

Fix const items not being allowed to be called `r#move` or `r#static`

Because of an ambiguity with const closures, the parser needs to ensure that for a const item, the `const` keyword isn't followed by a `move` or `static` keyword, as that would indicate a const closure:

```rust
fn main() {
  const move // ...
}
```

This check did not take raw identifiers into account, therefore being unable to distinguish between `const move` and `const r#move`. The latter is obviously not a const closure, so it should be allowed as a const item.

This fixes the check in the parser to only treat `const ...` as a const closure if it's followed by the *proper keyword*, and not a raw identifier.

Additionally, this adds a large test that tests for all raw identifiers in all kinds of positions, including `const`, to prevent issues like this one from occurring again.

fixes rust-lang#137128
use add-core-stubs / minicore for a few more tests

See rust-lang#131485 for context. These are some tests I worked on in the past so I figured I'd see if `minicore` works for them. :)
…lfJung

Remove SSE ABI from i586-pc-windows-msvc

As an i586 target, it should not have SSE. This caused the following warning to be emitted:

```
warning: target feature `sse2` must be enabled to ensure that the ABI of the current target can be implemented correctly
  |
  = note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, see issue rust-lang#116344 <rust-lang#116344>

warning: 1 warning emitted
```

see rust-lang#116344.

r? RalfJung
@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-run-make Area: port run-make Makefiles to rmake.rs O-hermit Operating System: Hermit O-solid Operating System: SOLID O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-windows Operating system: Windows S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-release Relevant to the release subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Feb 16, 2025
@workingjubilee
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Feb 16, 2025

📌 Commit 759ccca has been approved by workingjubilee

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 16, 2025
@bors
Copy link
Contributor

bors commented Feb 17, 2025

⌛ Testing commit 759ccca with merge 57fb317...

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 17, 2025
…kingjubilee

Rollup of 12 pull requests

Successful merges:

 - rust-lang#136671 (Overhaul `rustc_middle::limits`)
 - rust-lang#136817 (Pattern Migration 2024: clean up and comment)
 - rust-lang#136844 (Use `const_error!` when possible)
 - rust-lang#136953 (rustc_target: import TargetMetadata)
 - rust-lang#137095 (Replace some u64 hashes with Hash64)
 - rust-lang#137100 (HIR analysis: Remove unnecessary abstraction over list of clauses)
 - rust-lang#137105 (Restrict DerefPure for Cow<T> impl to T = impl Clone, [impl Clone], str.)
 - rust-lang#137120 (Enable `relative-path-include-bytes-132203` rustdoc-ui test on Windows)
 - rust-lang#137125 (Re-add missing empty lines in the releases notes)
 - rust-lang#137140 (Fix const items not being allowed to be called `r#move` or `r#static`)
 - rust-lang#137145 (use add-core-stubs / minicore for a few more tests)
 - rust-lang#137149 (Remove SSE ABI from i586-pc-windows-msvc)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job dist-apple-various failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

error[E0463]: can't find crate for `proc_macro2`
    --> /rust/deps/syn-2.0.96/src/token.rs:1058:9
     |
1058 |     use proc_macro2::{Delimiter, Group, Ident, Punct, Spacing, Span, TokenStream};

error[E0463]: can't find crate for `quote`
    --> /rust/deps/syn-2.0.96/src/token.rs:1059:9
     |
---

error[E0463]: can't find crate for `proc_macro2`
  --> /rust/deps/syn-2.0.96/src/buffer.rs:10:5
   |
10 | use proc_macro2::{Delimiter, Group, Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree};

error[E0463]: can't find crate for `proc_macro2`
  --> /rust/deps/syn-2.0.96/src/classify.rs:12:5
   |
---

error[E0463]: can't find crate for `proc_macro2`
   --> /rust/deps/syn-2.0.96/src/lifetime.rs:144:9
    |
144 |     use proc_macro2::{Punct, Spacing, TokenStream};

error[E0463]: can't find crate for `quote`
   --> /rust/deps/syn-2.0.96/src/lifetime.rs:145:9
    |
---

error[E0463]: can't find crate for `proc_macro2`
   --> /rust/deps/syn-2.0.96/src/parse.rs:190:5
    |
190 | use proc_macro2::{Delimiter, Group, Literal, Punct, Span, TokenStream, TokenTree};

error[E0463]: can't find crate for `quote`
   --> /rust/deps/syn-2.0.96/src/parse.rs:192:5
    |
---
   |
70 | pub use quote::{ToTokens, TokenStreamExt};
   |         ^^^^^ can't find crate

error[E0432]: unresolved imports `crate::ident::Ident`, `crate::ident::Ident`, `crate::ident::Ident`, `crate::ident::Ident`, `crate::ident::Ident`, `crate::ident::Ident`, `crate::ident::Ident`, `crate::ident::Ident`, `crate::ident::Ident`, `crate::ident::Ident`, `crate::ident::Ident`, `crate::Ident`, `crate::ident::Ident`, `crate::ident::Ident`, `crate::ident::Ident`, `crate::ident::Ident`, `crate::ident::Ident`, `crate::spanned::ToTokens`, `crate::ident::Ident`, `crate::ident::Ident`, `crate::ident::Ident`
     |
420  | pub use crate::ident::Ident;
     |         ^^^^^^^^^^^^^^^^^^^
     |
---
     |         ^^^^^^^^^^^^^^^^^^^
     |
    ::: /rust/deps/syn-2.0.96/src/parse_quote.rs:152:54
     |
152  | use crate::{attr, Attribute, Field, FieldMutability, Ident, Type, Visibility};
     |
    ::: /rust/deps/syn-2.0.96/src/pat.rs:3:5
     |
3    | use crate::ident::Ident;
---

error[E0463]: can't find crate for `proc_macro2`
   --> /rust/deps/syn-2.0.96/src/token.rs:184:37
    |
184 | impl_low_level_token!("group token" proc_macro2::Group any_group);

error[E0463]: can't find crate for `quote`
   --> /rust/deps/syn-2.0.96/src/macros.rs:131:16
    |
    |
131 |         impl ::quote::ToTokens for $name {
    |                ^^^^^ can't find crate

error[E0463]: can't find crate for `proc_macro2`
   --> /rust/deps/syn-2.0.96/src/macros.rs:132:49
    |
132 |             fn to_tokens(&self, $tokens: &mut ::proc_macro2::TokenStream) {

error[E0460]: found possibly newer version of crate `core` which `unicode_ident` depends on
  --> /rust/deps/syn-2.0.96/src/ident.rs:40:26
   |
   |
40 |     if !(first == '_' || unicode_ident::is_xid_start(first)) {
   |
   = note: perhaps that crate needs to be recompiled?
   = note: the following crate versions were found:
           crate `core`: /Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/lib/libcore-1178adaa3faf36dd.rlib
           crate `core`: /Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage0-sysroot/lib/rustlib/x86_64-apple-darwin/lib/libcore-1178adaa3faf36dd.rlib
           crate `unicode_ident`: /Users/runner/work/rust/rust/build/x86_64-apple-darwin/stage0-bootstrap-tools/release/deps/libunicode_ident-22ea159624be439f.rmeta

error[E0463]: can't find crate for `unicode_ident`
  --> /rust/deps/syn-2.0.96/src/ident.rs:44:13
   |
44 |         if !unicode_ident::is_xid_continue(ch) {

error[E0463]: can't find crate for `proc_macro2`
    --> /rust/deps/syn-2.0.96/src/parse.rs:1255:21
     |
---

error[E0463]: can't find crate for `proc_macro2`
   --> /rust/deps/syn-2.0.96/src/lib.rs:921:40
    |
921 | pub fn parse2<T: parse::Parse>(tokens: proc_macro2::TokenStream) -> Result<T> {

For more information about this error, try `rustc --explain E0463`.
[RUSTC-TIMING] cc test:false 1.750
error: could not compile `cc` (lib) due to 1 previous error
---
   --> /rust/deps/syn-2.0.96/src/path.rs:116:1
    |
116 | / impl<T> From<T> for PathSegment
117 | | where
118 | |     T: Into<Ident>,
    |
    = note: conflicting implementation in crate `core`:
            - impl<T> From<T> for T;

@bors
Copy link
Contributor

bors commented Feb 17, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 17, 2025
@workingjubilee workingjubilee deleted the rollup-1cjmnuh branch February 17, 2025 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-run-make Area: port run-make Makefiles to rmake.rs O-hermit Operating System: Hermit O-solid Operating System: SOLID O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-windows Operating system: Windows rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-release Relevant to the release subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.