-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
slightly better deprecation message for fn syntax #19020
Conversation
@@ -1229,7 +1229,8 @@ impl<'a> Parser<'a> { | |||
{ | |||
if self.eat(&token::Lt) { | |||
if lifetime_defs.is_empty() { | |||
self.warn("deprecated syntax, use `for` keyword now"); | |||
self.warn("deprecated syntax, use `for` keyword now \ | |||
(e.g.,change `fn<'a>` to `for<'a> fn`)"); |
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.
Nit: this comma probably needs a space after it.
(Also, maybe the other comma (on the line above) should be changed to a semicolon?)
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.
semicolon sounds good. I would probably just kill the comma after e.g.
upon reflection.
@P1start cleaned the message up |
Are closures also covered by this warning? For example: type A = <'a>|&'a int| -> &'a int; Just wanna make sure we're not recommending |
I honestly have no idea. It seems to be the only deprecation notice for using the old syntax, but I'm unclear as to the scope that new syntax applies to. |
All I'm really getting at is that this same message is used for one of two locations for the deprecated syntax, and the suggested fix only applies to one of the locations: type A = <'a> ||;
type B = fn<'a>();
|
The form of the fix is that same, right? |
hm ok I guess this is ok for now with the "e.g." in front, sorry for the confusion! |
fix: Prevent infinite recursion of bounds formatting
Came up on IRC that this was a bit unhelpful as to what should actually be done. I am new to changing compiler messages, please let me know if there's anything else that needs to be done to accomadate this change.
(My build system is still constantly crashing [Is bors contagious?], so this hasn't been formally
check
ed. I figure it's a simple enough change that any consequences [like compile-fail expected messages?] can be eyeballed by someone more experienced.)