summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2015-01-28 14:27:28 +1300
committerNick Cameron <ncameron@mozilla.com>2015-01-30 12:00:20 +1300
commita9d465fec902588b71937de96e66d160d2adebf5 (patch)
treef82484ce9849bd594796f0fcb1e2c51722b87a53 /src/libsyntax/parse
parent7ea93abfb2c11111496d6e1f5b82fc21c2da27ad (diff)
downloadrust-a9d465fec902588b71937de96e66d160d2adebf5.tar.gz
rust-a9d465fec902588b71937de96e66d160d2adebf5.zip
Use absolute path to FullRange, rather than assuming it is in the prelude
Closes #21263

[breaking-change]

If you are using `core::ops::FullRange` you should change to using `core::ops::RangeFull`
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs21
-rw-r--r--src/libsyntax/parse/token.rs97
2 files changed, 65 insertions, 53 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 4c1ae532d13..3d65dd82643 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2531,10 +2531,23 @@ impl<'a> Parser<'a> {
                     // FIXME(#20516) It would be better to use a lang item or
                     // something for FullRange.
                     hi = self.last_span.hi;
-                    let range = ExprStruct(ident_to_path(mk_sp(lo, hi),
-                                                         token::special_idents::FullRange),
-                                           vec![],
-                                           None);
+
+                    let idents = vec![token::str_to_ident("core"),
+                                      token::str_to_ident("ops"),
+                                      token::str_to_ident("FullRange")];
+                    let segments = idents.into_iter().map(|ident| {
+                        ast::PathSegment {
+                            identifier: ident,
+                            parameters: ast::PathParameters::none(),
+                        }
+                    }).collect();
+                    let path = ast::Path {
+                        span: mk_sp(lo, hi),
+                        global: true,
+                        segments: segments,
+                    };
+
+                    let range = ExprStruct(path, vec![], None);
                     let ix = self.mk_expr(bracket_pos, hi, range);
                     let index = self.mk_index(e, ix);
                     e = self.mk_expr(lo, hi, index)
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 1ef33a2401e..5531ce7b119 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -516,66 +516,65 @@ declare_special_idents_and_keywords! {
         (9,                          unnamed_field,          "<unnamed_field>");
         (10,                         type_self,              "Self");
         (11,                         prelude_import,         "prelude_import");
-        (12,                         FullRange,              "FullRange");
     }
 
     pub mod keywords {
         // These ones are variants of the Keyword enum
 
         'strict:
-        (13,                         As,         "as");
-        (14,                         Break,      "break");
-        (15,                         Crate,      "crate");
-        (16,                         Else,       "else");
-        (17,                         Enum,       "enum");
-        (18,                         Extern,     "extern");
-        (19,                         False,      "false");
-        (20,                         Fn,         "fn");
-        (21,                         For,        "for");
-        (22,                         If,         "if");
-        (23,                         Impl,       "impl");
-        (24,                         In,         "in");
-        (25,                         Let,        "let");
-        (26,                         Loop,       "loop");
-        (27,                         Match,      "match");
-        (28,                         Mod,        "mod");
-        (29,                         Move,       "move");
-        (30,                         Mut,        "mut");
-        (31,                         Pub,        "pub");
-        (32,                         Ref,        "ref");
-        (33,                         Return,     "return");
+        (12,                         As,         "as");
+        (13,                         Break,      "break");
+        (14,                         Crate,      "crate");
+        (15,                         Else,       "else");
+        (16,                         Enum,       "enum");
+        (17,                         Extern,     "extern");
+        (18,                         False,      "false");
+        (19,                         Fn,         "fn");
+        (20,                         For,        "for");
+        (21,                         If,         "if");
+        (22,                         Impl,       "impl");
+        (23,                         In,         "in");
+        (24,                         Let,        "let");
+        (25,                         Loop,       "loop");
+        (26,                         Match,      "match");
+        (27,                         Mod,        "mod");
+        (28,                         Move,       "move");
+        (29,                         Mut,        "mut");
+        (30,                         Pub,        "pub");
+        (31,                         Ref,        "ref");
+        (32,                         Return,     "return");
         // Static and Self are also special idents (prefill de-dupes)
         (super::STATIC_KEYWORD_NAME_NUM, Static, "static");
         (super::SELF_KEYWORD_NAME_NUM,   Self,   "self");
-        (34,                         Struct,     "struct");
+        (33,                         Struct,     "struct");
         (super::SUPER_KEYWORD_NAME_NUM, Super,   "super");
-        (35,                         True,       "true");
-        (36,                         Trait,      "trait");
-        (37,                         Type,       "type");
-        (38,                         Unsafe,     "unsafe");
-        (39,                         Use,        "use");
-        (40,                         Virtual,    "virtual");
-        (41,                         While,      "while");
-        (42,                         Continue,   "continue");
-        (43,                         Proc,       "proc");
-        (44,                         Box,        "box");
-        (45,                         Const,      "const");
-        (46,                         Where,      "where");
+        (34,                         True,       "true");
+        (35,                         Trait,      "trait");
+        (36,                         Type,       "type");
+        (37,                         Unsafe,     "unsafe");
+        (38,                         Use,        "use");
+        (39,                         Virtual,    "virtual");
+        (40,                         While,      "while");
+        (41,                         Continue,   "continue");
+        (42,                         Proc,       "proc");
+        (43,                         Box,        "box");
+        (44,                         Const,      "const");
+        (45,                         Where,      "where");
         'reserved:
-        (47,                         Alignof,    "alignof");
-        (48,                         Be,         "be");
-        (49,                         Offsetof,   "offsetof");
-        (50,                         Priv,       "priv");
-        (51,                         Pure,       "pure");
-        (52,                         Sizeof,     "sizeof");
-        (53,                         Typeof,     "typeof");
-        (54,                         Unsized,    "unsized");
-        (55,                         Yield,      "yield");
-        (56,                         Do,         "do");
-        (57,                         Abstract,   "abstract");
-        (58,                         Final,      "final");
-        (59,                         Override,   "override");
-        (60,                         Macro,      "macro");
+        (46,                         Alignof,    "alignof");
+        (47,                         Be,         "be");
+        (48,                         Offsetof,   "offsetof");
+        (49,                         Priv,       "priv");
+        (50,                         Pure,       "pure");
+        (51,                         Sizeof,     "sizeof");
+        (52,                         Typeof,     "typeof");
+        (53,                         Unsized,    "unsized");
+        (54,                         Yield,      "yield");
+        (55,                         Do,         "do");
+        (56,                         Abstract,   "abstract");
+        (57,                         Final,      "final");
+        (58,                         Override,   "override");
+        (59,                         Macro,      "macro");
     }
 }