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

Clippy recommends use of unstable Self constructors, which cause an ICE #3567

Closed
DianaNites opened this issue Dec 20, 2018 · 2 comments · Fixed by #4538
Closed

Clippy recommends use of unstable Self constructors, which cause an ICE #3567

DianaNites opened this issue Dec 20, 2018 · 2 comments · Fixed by #4538
Labels
C-bug Category: Clippy is not doing the correct thing I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied L-suggestion Lint: Improving, adding or fixing lint suggestions

Comments

@DianaNites
Copy link

DianaNites commented Dec 20, 2018

This is using clippy clippy 0.0.212 (2e26fdc2 2018-11-22)

Given this example, clippy will suggest TestStruct::from_something() entirely be replaced with Self(), which is incorrect, and causes the compiler to ICE due to rust-lang/rust#56611

Of note is that VSCode with RLS will offer code actions to automatically do this transformation.

@mati865
Copy link
Contributor

mati865 commented Dec 20, 2018

ICE doesn't matter here, it's Rust bug and nightly is fixed already.

Currently Clippy reports:

warning: unnecessary structure name repetition
  --> src/main.rs:16:9
   |
16 |         TestStruct::from_something()
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the applicable keyword: `Self`

Tools replace TestStruct::from_something with Self resulting in Self().

To make it work properly only TestStruct should be replaced like that:

16 |         TestStruct::from_something()
   |         ^^^^^^^^^^ help: use the applicable keyword: `Self`

@phansch phansch added C-bug Category: Clippy is not doing the correct thing L-suggestion Lint: Improving, adding or fixing lint suggestions labels Dec 20, 2018
@detrumi
Copy link
Member

detrumi commented Jan 2, 2019

It's the use_self lint, and there are some invalid suggestions in the current tests too, such as:

error: unnecessary structure name repetition
  --> $DIR/use_self.rs:30:13
   |
LL |             Foo::new()
   |             ^^^^^^^^ help: use the applicable keyword: `Self`

I'll take a look at this.

@phansch phansch added the I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied label Jan 4, 2019
bors added a commit that referenced this issue Sep 12, 2019
Verify that issue #3567 is resolved

Closes #3567

changelog: none
@bors bors closed this as completed in 67f1492 Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied L-suggestion Lint: Improving, adding or fixing lint suggestions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants