-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Possible single_use_lifetime false positive #46873
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
Comments
It wants you to say fn rotations(n: u32, digs: &mut [u32], rots: &'rots mut [u32]) -> &'rots [u32] { |
Filed a specific issue on improving the diagnostics at #46944 |
Perhaps I'm still missing something, but I am still seeing warnings:
Another possible solution:
|
How can I reopen this issue? |
Ah, looks like I tested it with the thing commented out. My bad. Reopening. https://play.rust-lang.org/?gist=73158fdb88e83c6a6f592838e3b066b9&version=nightly (In the future please give playpen link for bug reports) |
This is fixed now. |
Uh oh!
There was an error while loading. Please reload this page.
Perhaps here I am missing something and it's just a mistake of mine, but even in such case, other programmers could trip like me and they could enjoy a better error message.
I have this small program, it compiles without warnings and works:
I've tried to use the new
single_use_lifetime
lint, if I uncomment the#![warn(single_use_lifetime)]
line, I see the warnings/errors:Using in_band_lifetimes and leaving just 'a gives a similar warning:
Not using in_band_lifetimes and leaving just 'a gives the same:
The warning seems to suggest to use the 'a name too, but it doesn't compile:
If I try to use an underscore the error is similar:
So is the message given to me by single_use_lifetime correct? If it's correct then I don't see how to fix the code to remove the warning
The text was updated successfully, but these errors were encountered: