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

Removed 'proc' from the reserved keywords list #49699

Merged
merged 4 commits into from
Apr 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions src/libsyntax_pos/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,24 +318,23 @@ declare_keywords! {
(46, Offsetof, "offsetof")
(47, Override, "override")
(48, Priv, "priv")
(49, Proc, "proc")
Copy link
Contributor

Choose a reason for hiding this comment

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

The keyword list shouldn't contain holes (otherwise random identifiers will be interpreted as keywords), so the numbers of following keywords have to be shifted by one.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, good catch. @zesterer?

(Also, I wonder if we could construct this list in another way so that it auto-numbers, eliminating this issue in the future.)

Copy link
Contributor Author

@zesterer zesterer Apr 10, 2018

Choose a reason for hiding this comment

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

@joshtriplett My experience with the compiler codebase is less than excellent. Is this the sort of thing that could be easily macro-driven?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is the only keyword removed in the last 3-4 years, certainly not something that need to be automated by extra macro machinery.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@petrochenkov I may be over-thinking this. Is this literally just a case of enumerating everything that comes after the removed keyword?

Copy link
Contributor

Choose a reason for hiding this comment

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

@zesterer
Yes

(50, Pure, "pure")
(51, Sizeof, "sizeof")
(52, Typeof, "typeof")
(53, Unsized, "unsized")
(54, Virtual, "virtual")
(55, Yield, "yield")
(49, Pure, "pure")
(50, Sizeof, "sizeof")
(51, Typeof, "typeof")
(52, Unsized, "unsized")
(53, Virtual, "virtual")
(54, Yield, "yield")

// Special lifetime names
(56, UnderscoreLifetime, "'_")
(57, StaticLifetime, "'static")
(55, UnderscoreLifetime, "'_")
(56, StaticLifetime, "'static")

// Weak keywords, have special meaning only in specific contexts.
(58, Auto, "auto")
(59, Catch, "catch")
(60, Default, "default")
(61, Dyn, "dyn")
(62, Union, "union")
(57, Auto, "auto")
(58, Catch, "catch")
(59, Default, "default")
(60, Dyn, "dyn")
(61, Union, "union")
}

// If an interner exists, return it. Otherwise, prepare a fresh one.
Expand Down
19 changes: 0 additions & 19 deletions src/test/parse-fail/obsolete-proc.rs

This file was deleted.