Skip to content

Remove proc keyword #23156

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

Merged
merged 3 commits into from
Mar 12, 2015
Merged

Remove proc keyword #23156

merged 3 commits into from
Mar 12, 2015

Conversation

GuillaumeGomez
Copy link
Member

This is the implementation of the RFC 584.

@rust-highfive
Copy link
Contributor

r? @sfackler

(rust_highfive has picked a reviewer for you, use r? to override)

@GuillaumeGomez
Copy link
Member Author

r? @steveklabnik

@steveklabnik
Copy link
Member

This looks good to me, but someone else (maybe @nikomatsakis ) should r+ it

@@ -561,7 +561,6 @@ declare_special_idents_and_keywords! {
(39, Virtual, "virtual");
(40, While, "while");
(41, Continue, "continue");
(42, Proc, "proc");
(43, Box, "box");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these numbers be collapsed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum... Actually that's a pretty good question...

@GuillaumeGomez
Copy link
Member Author

It's good now !

@huonw
Copy link
Member

huonw commented Mar 8, 2015

Maybe we could leave proc as a reserved keyword?

@GuillaumeGomez
Copy link
Member Author

Why would you want to keep proc as a reserved keyword ? When needed, it will just need to be re-implemented and all we will be good.

@steveklabnik
Copy link
Member

Technically, 're-implementing it' might break backwards compatibility, as you could have named something proc in the meantime.

That said, I can see it either way.

@GuillaumeGomez
Copy link
Member Author

Well, as you prefer.
Le 8 mars 2015 15:02, "Steve Klabnik" [email protected] a écrit :

Technically, 're-implementing it' might break backwards compatibility, as
you could have named something proc in the meantime.

That said, I can see it either way.


Reply to this email directly or view it on GitHub
#23156 (comment).

@alexcrichton
Copy link
Member

I would prefer to just leave it as is today. It's a somewhat useful word and we may find use for it one day (especially because it's already reserved). Adding a new keyword forces crates using the keyword to possibly opt-in to having the new keyword semantics, so it's not a free operation.

@GuillaumeGomez
Copy link
Member Author

I re-added it. Waiting for review.

@bombless
Copy link
Contributor

bombless commented Mar 9, 2015

https://github.com/GuillaumeGomez/rust/blob/remove-proc/src/libsyntax/parse/token.rs#L525
(Maybe proc keyword should be moved from strict to reserved)
(Ignore me, I'm just random passer-by)

@GuillaumeGomez
Copy link
Member Author

@bombless: Well, I'll wait for others' opinion before doing anything but thanks for your comment !

@alexcrichton
Copy link
Member

Ah yes, could it be moved to the reserved section there as well? Also could you leave the test but update the error message that it outputs?

@GuillaumeGomez
Copy link
Member Author

Yes of course. I change that.

@GuillaumeGomez
Copy link
Member Author

I moved proc to reserved keywords.

@@ -1052,7 +1052,7 @@ impl<'a> Parser<'a> {

// examine next token to decide to do
if self.eat_keyword_noexpect(keywords::Proc) {
self.parse_proc_type(lifetime_defs)
self.fatal("`proc` keyword isn't used for the moment");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok to remove this specific handling of the Proc keyword, an error should show up regardless somewhere in the parser eventually.

@GuillaumeGomez
Copy link
Member Author

@alexcrichton: I applied your comments.

let _ = self.parse_proc_decl();
let _ = self.parse_expr();
return self.obsolete_expr(span, ObsoleteSyntax::ProcExpr);
self.fatal("`proc` keyword isn't used for the moment");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this special case can also be removed)

@GuillaumeGomez
Copy link
Member Author

So now we're back to my first commit haha. @alexcrichton r? ?

@@ -10,8 +10,8 @@

// Test that we generate obsolete syntax errors around usages of `proc`.

fn foo(p: proc()) { } //~ ERROR obsolete syntax: the `proc` type
fn foo(p: proc()) { } //~ ERROR: the `proc` type isn't used for the moment
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this error message be updated? I think the parser modifications you made earlier may have changed the error message (you can check with make check-stage2-pfail)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I think it's a good thing. Like that it's even more precise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, I meant that I'm not sure that this error message is still generated. Have you run make check-stage2-pfail after the recent modifications?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah no, I always stop at stage1. And even if this error message isn't generated, a nice comment is always useful. ^^ Or it wasn't what you meant ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I'm saying is that this error message cannot happen an this test needs to be updated if it wants to get past the bots. The ObsoleteSyntax changes you made above are never actually called (ProcExpr is never referenced and ProcType is only called in a dead function).

Could you:

  • Delete ProcExpr and ProcType
  • Delete parse_proc_type
  • Update the error messages in this test

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed ProcExpr, ProcType and parse_proc_type. I'll run make check-stage2-pfail tomorrow.

@GuillaumeGomez
Copy link
Member Author

Ready for review !

@alexcrichton
Copy link
Member

@bors: r+ db726fa

bors added a commit that referenced this pull request Mar 11, 2015
@bors
Copy link
Collaborator

bors commented Mar 11, 2015

⌛ Testing commit db726fa with merge 425297a...

@bors bors merged commit db726fa into rust-lang:master Mar 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants