Skip to content

Commit a9d465f

Browse files
committed
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`
1 parent 7ea93ab commit a9d465f

File tree

3 files changed

+66
-53
lines changed

3 files changed

+66
-53
lines changed

src/libcore/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ mod array;
147147
mod core {
148148
pub use panicking;
149149
pub use fmt;
150+
pub use ops;
150151
}
151152

152153
#[doc(hidden)]

src/libsyntax/parse/parser.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2531,10 +2531,23 @@ impl<'a> Parser<'a> {
25312531
// FIXME(#20516) It would be better to use a lang item or
25322532
// something for FullRange.
25332533
hi = self.last_span.hi;
2534-
let range = ExprStruct(ident_to_path(mk_sp(lo, hi),
2535-
token::special_idents::FullRange),
2536-
vec![],
2537-
None);
2534+
2535+
let idents = vec![token::str_to_ident("core"),
2536+
token::str_to_ident("ops"),
2537+
token::str_to_ident("FullRange")];
2538+
let segments = idents.into_iter().map(|ident| {
2539+
ast::PathSegment {
2540+
identifier: ident,
2541+
parameters: ast::PathParameters::none(),
2542+
}
2543+
}).collect();
2544+
let path = ast::Path {
2545+
span: mk_sp(lo, hi),
2546+
global: true,
2547+
segments: segments,
2548+
};
2549+
2550+
let range = ExprStruct(path, vec![], None);
25382551
let ix = self.mk_expr(bracket_pos, hi, range);
25392552
let index = self.mk_index(e, ix);
25402553
e = self.mk_expr(lo, hi, index)

src/libsyntax/parse/token.rs

Lines changed: 48 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -516,66 +516,65 @@ declare_special_idents_and_keywords! {
516516
(9, unnamed_field, "<unnamed_field>");
517517
(10, type_self, "Self");
518518
(11, prelude_import, "prelude_import");
519-
(12, FullRange, "FullRange");
520519
}
521520

522521
pub mod keywords {
523522
// These ones are variants of the Keyword enum
524523

525524
'strict:
526-
(13, As, "as");
527-
(14, Break, "break");
528-
(15, Crate, "crate");
529-
(16, Else, "else");
530-
(17, Enum, "enum");
531-
(18, Extern, "extern");
532-
(19, False, "false");
533-
(20, Fn, "fn");
534-
(21, For, "for");
535-
(22, If, "if");
536-
(23, Impl, "impl");
537-
(24, In, "in");
538-
(25, Let, "let");
539-
(26, Loop, "loop");
540-
(27, Match, "match");
541-
(28, Mod, "mod");
542-
(29, Move, "move");
543-
(30, Mut, "mut");
544-
(31, Pub, "pub");
545-
(32, Ref, "ref");
546-
(33, Return, "return");
525+
(12, As, "as");
526+
(13, Break, "break");
527+
(14, Crate, "crate");
528+
(15, Else, "else");
529+
(16, Enum, "enum");
530+
(17, Extern, "extern");
531+
(18, False, "false");
532+
(19, Fn, "fn");
533+
(20, For, "for");
534+
(21, If, "if");
535+
(22, Impl, "impl");
536+
(23, In, "in");
537+
(24, Let, "let");
538+
(25, Loop, "loop");
539+
(26, Match, "match");
540+
(27, Mod, "mod");
541+
(28, Move, "move");
542+
(29, Mut, "mut");
543+
(30, Pub, "pub");
544+
(31, Ref, "ref");
545+
(32, Return, "return");
547546
// Static and Self are also special idents (prefill de-dupes)
548547
(super::STATIC_KEYWORD_NAME_NUM, Static, "static");
549548
(super::SELF_KEYWORD_NAME_NUM, Self, "self");
550-
(34, Struct, "struct");
549+
(33, Struct, "struct");
551550
(super::SUPER_KEYWORD_NAME_NUM, Super, "super");
552-
(35, True, "true");
553-
(36, Trait, "trait");
554-
(37, Type, "type");
555-
(38, Unsafe, "unsafe");
556-
(39, Use, "use");
557-
(40, Virtual, "virtual");
558-
(41, While, "while");
559-
(42, Continue, "continue");
560-
(43, Proc, "proc");
561-
(44, Box, "box");
562-
(45, Const, "const");
563-
(46, Where, "where");
551+
(34, True, "true");
552+
(35, Trait, "trait");
553+
(36, Type, "type");
554+
(37, Unsafe, "unsafe");
555+
(38, Use, "use");
556+
(39, Virtual, "virtual");
557+
(40, While, "while");
558+
(41, Continue, "continue");
559+
(42, Proc, "proc");
560+
(43, Box, "box");
561+
(44, Const, "const");
562+
(45, Where, "where");
564563
'reserved:
565-
(47, Alignof, "alignof");
566-
(48, Be, "be");
567-
(49, Offsetof, "offsetof");
568-
(50, Priv, "priv");
569-
(51, Pure, "pure");
570-
(52, Sizeof, "sizeof");
571-
(53, Typeof, "typeof");
572-
(54, Unsized, "unsized");
573-
(55, Yield, "yield");
574-
(56, Do, "do");
575-
(57, Abstract, "abstract");
576-
(58, Final, "final");
577-
(59, Override, "override");
578-
(60, Macro, "macro");
564+
(46, Alignof, "alignof");
565+
(47, Be, "be");
566+
(48, Offsetof, "offsetof");
567+
(49, Priv, "priv");
568+
(50, Pure, "pure");
569+
(51, Sizeof, "sizeof");
570+
(52, Typeof, "typeof");
571+
(53, Unsized, "unsized");
572+
(54, Yield, "yield");
573+
(55, Do, "do");
574+
(56, Abstract, "abstract");
575+
(57, Final, "final");
576+
(58, Override, "override");
577+
(59, Macro, "macro");
579578
}
580579
}
581580

0 commit comments

Comments
 (0)