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

Format error in suggestion for needless_lifetimes #12789

Open
rodrigorc opened this issue May 11, 2024 · 1 comment
Open

Format error in suggestion for needless_lifetimes #12789

rodrigorc opened this issue May 11, 2024 · 1 comment
Assignees
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

Comments

@rodrigorc
Copy link

rodrigorc commented May 11, 2024

Summary

The suggested fix for this clippy warning makes no sense.

Reproducer

I tried this code:

pub trait Foo {
    fn test<'s>(&'s self) -> impl Iterator<Item = i32> + 's;
}

I expected to see this happen:

-     fn test<'s>(&'s self) -> impl Iterator<Item = i32> + 's;
+     fn test(&self) -> impl Iterator<Item = i32> + '_;

Instead, this happened:

-     fn test<'s>(&'s self) -> impl Iterator<Item = i32> + 's;
+     fn test'_>(&self) -> impl Iterator<Item = i32> + 's;

That isn't syntactically valid.

There may be some interaction with the 2024 edition feature "RPIT lifetime capture"?

Version

rustc 1.79.0-beta.2 (4bf9354b9 2024-05-02)
binary: rustc
commit-hash: 4bf9354b9e6f07fc6dd881a2d313be0f63cdb8cb
commit-date: 2024-05-02
host: x86_64-unknown-linux-gnu
release: 1.79.0-beta.2
LLVM version: 18.1.4

Additional Labels

No response

@rodrigorc rodrigorc added the C-bug Category: Clippy is not doing the correct thing label May 11, 2024
@Alexendoo Alexendoo added the I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied label May 11, 2024
@m-rph
Copy link
Contributor

m-rph commented May 22, 2024

@rustbot claim

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
Projects
None yet
Development

No branches or pull requests

3 participants