-
Notifications
You must be signed in to change notification settings - Fork 13.4k
in which we suggest anonymizing single-use lifetimes in paths #62453
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,37 @@ help: elide the single-use lifetime | |
LL | fn a(x: &u32) { | ||
| -- -- | ||
|
||
error: aborting due to previous error | ||
error: lifetime parameter `'m` only used once | ||
--> $DIR/one-use-in-fn-argument.rs:15:11 | ||
| | ||
LL | fn center<'m>(_: Single<'m>) {} | ||
| ^^ -- ...is used only here | ||
| | | ||
| this lifetime... | ||
help: elide the single-use lifetime | ||
| | ||
LL | fn center(_: Single<'_>) {} | ||
| -- ^^ | ||
|
||
error: lifetime parameter `'y` only used once | ||
--> $DIR/one-use-in-fn-argument.rs:17:13 | ||
| | ||
LL | fn left<'x, 'y>(foo: Double<'x, 'y>) -> &'x u32 { foo.f } | ||
| ^^ this lifetime... -- ...is used only here | ||
help: elide the single-use lifetime | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you perhaps add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it can't due to the multiple ambiguity span bug, unless that has been fixed since Berlin. |
||
| | ||
LL | fn left<'x>(foo: Double<'x, '_>) -> &'x u32 { foo.f } | ||
| -- ^^ | ||
|
||
error: lifetime parameter `'x` only used once | ||
--> $DIR/one-use-in-fn-argument.rs:19:10 | ||
| | ||
LL | fn right<'x, 'y>(foo: Double<'x, 'y>) -> &'y u32 { foo.f } | ||
| ^^ this lifetime... -- ...is used only here | ||
help: elide the single-use lifetime | ||
| | ||
LL | fn right<'y>(foo: Double<'_, 'y>) -> &'y u32 { foo.f } | ||
| -- ^^ | ||
|
||
error: aborting due to 4 previous errors | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like a bug in the ast's span, right? No need to fix now but add a FIXME
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's not referring to an AST span; it's referring to a span that we synthesized earlier in the function (the
'a
with the trailing space in&'a Foo
).