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`
This commit is contained in:
Nick Cameron
2015-01-28 14:27:28 +13:00
parent 7ea93abfb2
commit a9d465fec9
3 changed files with 66 additions and 53 deletions

View File

@@ -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)