Skip to content

Rustup #12246

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

Merged
merged 23 commits into from
Feb 8, 2024
Merged

Rustup #12246

merged 23 commits into from
Feb 8, 2024

Conversation

flip1995
Copy link
Member

@flip1995 flip1995 commented Feb 8, 2024

r? @ghost

changelog: none

oli-obk and others added 23 commits January 23, 2024 16:34
`unescape_literal` becomes `unescape_unicode`, and `unescape_c_string`
becomes `unescape_mixed`. Because rfc3349 will mean that C string
literals will no longer be the only mixed utf8 literals.
remove StructuralEq trait

The documentation given for the trait is outdated: *all* function pointers implement `PartialEq` and `Eq` these days. So the `StructuralEq` trait doesn't really seem to have any reason to exist any more.

One side-effect of this PR is that we allow matching on some consts that do not implement `Eq`. However, we already allowed matching on floats and consts containing floats, so this is not new, it is just allowed in more cases now. IMO it makes no sense at all to allow float matching but also sometimes require an `Eq` instance. If we want to require `Eq` we should adjust rust-lang/rust#115893 to check for `Eq`, and rule out float matching for good.

Fixes rust-lang/rust#115881
RFC 3349 precursors

Some cleanups I found while working on RFC 3349 that are worth landing separately.

r? `@fee1-dead`
The query accept arbitrary DefIds, not just owner DefIds.
The return can be an `Option` because if there are no nodes, then it doesn't matter whether it's due to NonOwner or Phantom.
Also rename the query to `opt_hir_owner_nodes`.
Remove various `has_errors` or `err_count` uses

follow up to rust-lang/rust#119895

r? `@nnethercote` since you recently did something similar.

There are so many more of these, but I wanted to get a PR out instead of growing the commit list indefinitely. The commits all work on their own and can be reviewed commit by commit.
`Diagnostic::keys`, which is used for hashing and equating diagnostics,
has a surprising behaviour: it ignores children, but only for lints.
This was added in #88493 to fix some duplicated diagnostics, but it
doesn't seem necessary any more.

This commit removes the special case and only four tests have changed
output, with additional errors. And those additional errors aren't
exact duplicates, they're just similar. For example, in
src/tools/clippy/tests/ui/same_name_method.rs we currently have this
error:
```
error: method's name is the same as an existing method in a trait
  --> $DIR/same_name_method.rs:75:13
   |
LL |             fn foo() {}
   |             ^^^^^^^^^^^
   |
note: existing `foo` defined here
  --> $DIR/same_name_method.rs:79:9
   |
LL |         impl T1 for S {}
   |         ^^^^^^^^^^^^^^^^
```
and with this change we also get this error:
```
error: method's name is the same as an existing method in a trait
  --> $DIR/same_name_method.rs:75:13
   |
LL |             fn foo() {}
   |             ^^^^^^^^^^^
   |
note: existing `foo` defined here
  --> $DIR/same_name_method.rs:81:9
   |
LL |         impl T2 for S {}
   |         ^^^^^^^^^^^^^^^^
```
I think printing this second argument is reasonable, possibly even
preferable to hiding it. And the other cases are similar.
hir: Refactor getters for owner nodes
Don't hash lints differently to non-lints.

`Diagnostic::keys`, which is used for hashing and equating diagnostics, has a surprising behaviour: it ignores children, but only for lints. This was added in #88493 to fix some duplicated diagnostics, but it doesn't seem necessary any more.

This commit removes the special case and only four tests have changed output, with additional errors. And those additional errors aren't exact duplicates, they're just similar. For example, in src/tools/clippy/tests/ui/same_name_method.rs we currently have this error:
```
error: method's name is the same as an existing method in a trait
  --> $DIR/same_name_method.rs:75:13
   |
LL |             fn foo() {}
   |             ^^^^^^^^^^^
   |
note: existing `foo` defined here
  --> $DIR/same_name_method.rs:79:9
   |
LL |         impl T1 for S {}
   |         ^^^^^^^^^^^^^^^^
```
and with this change we also get this error:
```
error: method's name is the same as an existing method in a trait
  --> $DIR/same_name_method.rs:75:13
   |
LL |             fn foo() {}
   |             ^^^^^^^^^^^
   |
note: existing `foo` defined here
  --> $DIR/same_name_method.rs:81:9
   |
LL |         impl T2 for S {}
   |
```
I think printing this second argument is reasonable, possibly even preferable to hiding it. And the other cases are similar.

r? `@estebank`
make matching on NaN a hard error, and remove the rest of illegal_floating_point_literal_pattern

These arms would never be hit anyway, so the pattern makes little sense. We have had a future-compat lint against float matches in general for a *long* time, so I hope we can get away with immediately making this a hard error.

This is part of implementing rust-lang/rfcs#3535.

Closes rust-lang/rust#41620 by removing the lint.

rust-lang/reference#1456 updates the reference to match.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 8, 2024
@flip1995
Copy link
Member Author

flip1995 commented Feb 8, 2024

@bors r+ p=1

@bors
Copy link
Contributor

bors commented Feb 8, 2024

📌 Commit 2ca6c84 has been approved by flip1995

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Feb 8, 2024

⌛ Testing commit 2ca6c84 with merge cdfac06...

bors added a commit that referenced this pull request Feb 8, 2024
Rustup

r? `@ghost`

changelog: none
@bors
Copy link
Contributor

bors commented Feb 8, 2024

💔 Test failed - checks-action_test

@flip1995
Copy link
Member Author

flip1995 commented Feb 8, 2024

@bors retry

@bors
Copy link
Contributor

bors commented Feb 8, 2024

⌛ Testing commit 2ca6c84 with merge d6cbb5d...

bors added a commit that referenced this pull request Feb 8, 2024
Rustup

r? `@ghost`

changelog: none
@bors
Copy link
Contributor

bors commented Feb 8, 2024

💔 Test failed - checks-action_test

@flip1995
Copy link
Member Author

flip1995 commented Feb 8, 2024

@bors retry

@bors
Copy link
Contributor

bors commented Feb 8, 2024

⌛ Testing commit 2ca6c84 with merge 60cb29c...

@bors
Copy link
Contributor

bors commented Feb 8, 2024

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing 60cb29c to master...

@bors bors merged commit 60cb29c into rust-lang:master Feb 8, 2024
@flip1995 flip1995 deleted the rustup branch February 8, 2024 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.