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

Incorrectly reported missing clone method #14308

Closed
rachitnigam opened this issue Mar 10, 2023 · 5 comments
Closed

Incorrectly reported missing clone method #14308

rachitnigam opened this issue Mar 10, 2023 · 5 comments
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug

Comments

@rachitnigam
Copy link

rust-analyzer version: rust-analyzer version: 0.3.1426-standalone (0a956ec 2023-03-05)
rustc version: rustc 1.68.0 (2c8cc3432 2023-03-06)
relevant settings: Check on save command is cargo clippy but error also occurs when configured with cargo check

The VS code extension for rust-analyzer reports that clone is missing on for a struct:
Screenshot 2023-03-09 at 3 57 26 PM

However, the struct derives Clone:
Screenshot 2023-03-09 at 3 57 58 PM

More importantly, running cargo build or cargo check from the command line doesn't give any error. I'm not sure what's causing the error but it did randomly show up recently. I'm assuming it was caused by an updated.

The only workaround I've found is replacing struct.clone with Clone::clone(&struct):
Screenshot 2023-03-09 at 3 59 19 PM

To reproduce:

git clone https://github.com/cucapra/filament.git
cd filament && code .

Happy to run more debugging commands to help figure out what's causing the problem.

@rachitnigam rachitnigam added the C-bug Category: bug label Mar 10, 2023
@rachitnigam
Copy link
Author

I can confirm that switching to 0.3.1418-standalone (4e29820f6 2023-02-26) fixes the problem for me.

@lnicola
Copy link
Member

lnicola commented Mar 10, 2023

The warnings will be disabled by default in the next version, but it would be interesting to figure out what's happening here. The type there is barely a:

#[derive(Clone)]
pub struct SExp(pub String);

For future readers, you'll also need to clone git clone https://github.com/cucapra/calyx.git.

@lnicola lnicola added the A-ty type system / type inference / traits / method resolution label Mar 10, 2023
@rachitnigam
Copy link
Author

Got it! I'd be interested in poking around the codebase if you have any pointers on where I should look?

@lnicola
Copy link
Member

lnicola commented Mar 10, 2023

Um, no idea. First step might be to minimize this, but I'm currently running into #14310, which may have some impact on it.

@lnicola
Copy link
Member

lnicola commented Mar 10, 2023

Duplicate of #13600.

@lnicola lnicola closed this as completed Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants