From ebc315bbbbb8aa92fe118fb7cee5f8aea88ab265 Mon Sep 17 00:00:00 2001
From: Havvy <ryan.havvy@gmail.com>
Date: Tue, 29 May 2018 17:08:29 -0700
Subject: [PATCH 1/2] Implement RFC 2421, 'Keyword unreservations (pure,
 sizeof, alignof, offsetof)'

---
 src/libsyntax_pos/symbol.rs                   | 40 +++++++++----------
 src/test/parse-fail/removed-syntax-fn-pure.rs | 13 ------
 2 files changed, 18 insertions(+), 35 deletions(-)
 delete mode 100644 src/test/parse-fail/removed-syntax-fn-pure.rs

diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs
index 283b41e5725a9..abe738d751c13 100644
--- a/src/libsyntax_pos/symbol.rs
+++ b/src/libsyntax_pos/symbol.rs
@@ -384,34 +384,30 @@ declare_keywords! {
 
     // Keywords reserved for future use.
     (40, Abstract,           "abstract")
-    (41, Alignof,            "alignof")
-    (42, Become,             "become")
-    (43, Do,                 "do")
-    (44, Final,              "final")
-    (45, Macro,              "macro")
-    (46, Offsetof,           "offsetof")
-    (47, Override,           "override")
-    (48, Priv,               "priv")
-    (49, Pure,               "pure")
-    (50, Sizeof,             "sizeof")
-    (51, Typeof,             "typeof")
-    (52, Unsized,            "unsized")
-    (53, Virtual,            "virtual")
-    (54, Yield,              "yield")
+    (41, Become,             "become")
+    (42, Do,                 "do")
+    (43, Final,              "final")
+    (44, Macro,              "macro")
+    (45, Override,           "override")
+    (46, Priv,               "priv")
+    (47, Typeof,             "typeof")
+    (48, Unsized,            "unsized")
+    (49, Virtual,            "virtual")
+    (50, Yield,              "yield")
 
     // Edition-specific keywords reserved for future use.
-    (55, Async,              "async") // >= 2018 Edition Only
+    (51, Async,              "async") // >= 2018 Edition Only
 
     // Special lifetime names
-    (56, UnderscoreLifetime, "'_")
-    (57, StaticLifetime,     "'static")
+    (52, UnderscoreLifetime, "'_")
+    (53, 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")
+    (54, Auto,               "auto")
+    (55, Catch,              "catch")
+    (56, Default,            "default")
+    (57, Dyn,                "dyn")
+    (58, Union,              "union")
 }
 
 impl Symbol {
diff --git a/src/test/parse-fail/removed-syntax-fn-pure.rs b/src/test/parse-fail/removed-syntax-fn-pure.rs
deleted file mode 100644
index 83794a70a4f43..0000000000000
--- a/src/test/parse-fail/removed-syntax-fn-pure.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags: -Z parse-only
-
-pure fn f() {} //~ ERROR expected item, found `pure`

From 679a5219e7e8f7e7c9c1709c75184569be254be3 Mon Sep 17 00:00:00 2001
From: Havvy <ryan.havvy@gmail.com>
Date: Fri, 1 Jun 2018 09:01:16 -0700
Subject: [PATCH 2/2] Test keyword unreservations

---
 ...-unreserve-pure-offsetof-sizeof-alignof.rs | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 src/test/run-pass/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs

diff --git a/src/test/run-pass/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs b/src/test/run-pass/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs
new file mode 100644
index 0000000000000..7d8050a07a310
--- /dev/null
+++ b/src/test/run-pass/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs
@@ -0,0 +1,22 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that removed keywords are allowed as identifiers.
+fn main () {
+    let offsetof = ();
+    let alignof = ();
+    let sizeof = ();
+    let pure = ();
+}
+
+fn offsetof() {}
+fn alignof() {}
+fn sizeof() {}
+fn pure() {}