Skip to content

Commit 684b8d3

Browse files
committed
Auto merge of #51196 - Havvy:remove-keywords, r=petrochenkov
Implement RFC 2421, 'Keyword unreservations (pure, sizeof, alignof, offsetof) On my local machine I was getting failures in `test/ui-fulldeps`, but I was also getting them again after reverting the change, so I'm hoping that this works. I removed the test because that's what the other PR that unreserved a keyword did and I feel that it doesn't make sense/keep value to keep a test for something removed years ago.
2 parents b4d836c + 679a521 commit 684b8d3

File tree

2 files changed

+30
-25
lines changed

2 files changed

+30
-25
lines changed

src/libsyntax_pos/symbol.rs

+18-22
Original file line numberDiff line numberDiff line change
@@ -384,34 +384,30 @@ declare_keywords! {
384384

385385
// Keywords reserved for future use.
386386
(40, Abstract, "abstract")
387-
(41, Alignof, "alignof")
388-
(42, Become, "become")
389-
(43, Do, "do")
390-
(44, Final, "final")
391-
(45, Macro, "macro")
392-
(46, Offsetof, "offsetof")
393-
(47, Override, "override")
394-
(48, Priv, "priv")
395-
(49, Pure, "pure")
396-
(50, Sizeof, "sizeof")
397-
(51, Typeof, "typeof")
398-
(52, Unsized, "unsized")
399-
(53, Virtual, "virtual")
400-
(54, Yield, "yield")
387+
(41, Become, "become")
388+
(42, Do, "do")
389+
(43, Final, "final")
390+
(44, Macro, "macro")
391+
(45, Override, "override")
392+
(46, Priv, "priv")
393+
(47, Typeof, "typeof")
394+
(48, Unsized, "unsized")
395+
(49, Virtual, "virtual")
396+
(50, Yield, "yield")
401397

402398
// Edition-specific keywords reserved for future use.
403-
(55, Async, "async") // >= 2018 Edition Only
399+
(51, Async, "async") // >= 2018 Edition Only
404400

405401
// Special lifetime names
406-
(56, UnderscoreLifetime, "'_")
407-
(57, StaticLifetime, "'static")
402+
(52, UnderscoreLifetime, "'_")
403+
(53, StaticLifetime, "'static")
408404

409405
// Weak keywords, have special meaning only in specific contexts.
410-
(58, Auto, "auto")
411-
(59, Catch, "catch")
412-
(60, Default, "default")
413-
(61, Dyn, "dyn")
414-
(62, Union, "union")
406+
(54, Auto, "auto")
407+
(55, Catch, "catch")
408+
(56, Default, "default")
409+
(57, Dyn, "dyn")
410+
(58, Union, "union")
415411
}
416412

417413
impl Symbol {
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -8,6 +8,15 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: -Z parse-only
11+
// Test that removed keywords are allowed as identifiers.
12+
fn main () {
13+
let offsetof = ();
14+
let alignof = ();
15+
let sizeof = ();
16+
let pure = ();
17+
}
1218

13-
pure fn f() {} //~ ERROR expected item, found `pure`
19+
fn offsetof() {}
20+
fn alignof() {}
21+
fn sizeof() {}
22+
fn pure() {}

0 commit comments

Comments
 (0)