Skip to content

Stack overflow fix #10081

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

Closed

Conversation

matthiaskrgr
Copy link
Member

@matthiaskrgr matthiaskrgr commented Dec 15, 2022

See #10068 (comment) for details

-- original PR description of #10068 --

fixes #10041

Prevent recursion into Self when it's a generic parameter. Added regression test from example in #10041.

  • Followed [lint naming conventions][lint_naming] - N/A
  • Added passing UI tests (including committed .stderr file)
  • cargo test passes locally
  • Executed cargo dev update_lints - N/A
  • Added lint documentation - N/A
  • Run cargo dev fmt

changelog: [new-ret-no-self] Fix segmentation fault caused when generic parameter defaults to Self and is unspecified. For example, `fn uh_oh(&self)>

Fixes rust-lang#10041.

Prevent recusion into Self when it's a generic parameter.
Added regression test from example in rust-lang#10041.
@rustbot
Copy link
Collaborator

rustbot commented Dec 15, 2022

r? @Jarcho

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Dec 15, 2022
@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Dec 15, 2022

This includes #10068 + the changes mentioned in #10068 (comment) which I have authored @nbdd0121 :)

@matthiaskrgr
Copy link
Member Author

@bors try

@bors
Copy link
Contributor

bors commented Dec 15, 2022

⌛ Trying commit eecec91 with merge 0c5bfc3...

bors added a commit that referenced this pull request Dec 15, 2022
Stack overflow fix

See #10068 (comment) for details

-- original PR description of #10068 --

fixes #10041

Prevent recursion into Self when it's a generic parameter. Added regression test from example in #10041.

- \[x] Followed [lint naming conventions][lint_naming] - **N/A**
- \[x] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[x] Executed `cargo dev update_lints` - **N/A**
- \[x] Added lint documentation - **N/A**
- \[x] Run `cargo dev fmt`

changelog: [`new-ret-no-self`] Fix segmentation fault caused when generic parameter defaults to `Self` and is unspecified. For example, `fn uh_oh(&self)>
@bors
Copy link
Contributor

bors commented Dec 15, 2022

💔 Test failed - checks-action_test

See rust-lang#10068 (comment) for details

-- original PR description of rust-lang#10068 --

fixes rust-lang#10041

Prevent recursion into Self when it's a generic parameter. Added regression test from example in rust-lang#10041.

- \[x] Followed [lint naming conventions][lint_naming] - **N/A**
- \[x] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[x] Executed `cargo dev update_lints` - **N/A**
- \[x] Added lint documentation - **N/A**
- \[x] Run `cargo dev fmt`

changelog: [`new-ret-no-self`] Fix segmentation fault caused when generic parameter defaults to `Self` and is unspecified. For example, `fn uh_oh(&self) -> impl PartialOrd { ... }` has a hidden `Rhs=Self` as the generic parameter for `PartialOrd`.
@matthiaskrgr
Copy link
Member Author

I only replaced half of the recursion, oops :D

@matthiaskrgr
Copy link
Member Author

@bors try

@bors
Copy link
Contributor

bors commented Dec 15, 2022

⌛ Trying commit b180800 with merge 90c0407...

bors added a commit that referenced this pull request Dec 15, 2022
Stack overflow fix

See #10068 (comment) for details

-- original PR description of #10068 --

fixes #10041

Prevent recursion into Self when it's a generic parameter. Added regression test from example in #10041.

- \[x] Followed [lint naming conventions][lint_naming] - **N/A**
- \[x] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[x] Executed `cargo dev update_lints` - **N/A**
- \[x] Added lint documentation - **N/A**
- \[x] Run `cargo dev fmt`

changelog: [`new-ret-no-self`] Fix segmentation fault caused when generic parameter defaults to `Self` and is unspecified. For example, `fn uh_oh(&self)>
Comment on lines +1 to 18
error: methods called `new` usually return `Self`
--> $DIR/methods.rs:96:5
|
LL | / async fn new() -> Option<Self> {
LL | | None
LL | | }
| |_____^
|
= note: `-D clippy::new-ret-no-self` implied by `-D warnings`

error: methods called `new` usually return `Self`
--> $DIR/methods.rs:104:5
|
LL | / fn new() -> i32 {
LL | | 0
LL | | }
| |_____^
|
= note: `-D clippy::new-ret-no-self` implied by `-D warnings`

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need some extra code to avoid FPs here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this looks like a fp to me but haven't figured out yet how to work around that

@bors
Copy link
Contributor

bors commented Dec 15, 2022

☀️ Try build successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Build commit: 90c0407 (90c04071e1752cc1152ef35fddbed608a18c37e6)

@matthiaskrgr matthiaskrgr added the S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work label Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work 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.

Clippy crashes on simple method returning impl PartialOrd
6 participants