Simplify use of keyword symbols

This commit is contained in:
Vadim Petrochenkov
2019-05-11 17:41:37 +03:00
parent 37ff5d388f
commit 59a382122f
58 changed files with 502 additions and 534 deletions

View File

@@ -2,7 +2,7 @@ use crate::ast;
use crate::attr;
use crate::edition::Edition;
use crate::ext::hygiene::{Mark, SyntaxContext};
use crate::symbol::{Ident, Symbol, keywords, sym};
use crate::symbol::{Ident, Symbol, kw, sym};
use crate::source_map::{ExpnInfo, MacroAttribute, dummy_spanned, respan};
use crate::ptr::P;
use crate::tokenstream::TokenStream;
@@ -107,7 +107,7 @@ pub fn maybe_inject_crates_ref(
vis: respan(span.shrink_to_lo(), ast::VisibilityKind::Inherited),
node: ast::ItemKind::Use(P(ast::UseTree {
prefix: ast::Path {
segments: iter::once(keywords::PathRoot.ident())
segments: iter::once(ast::Ident::with_empty_ctxt(kw::PathRoot))
.chain(
[name, "prelude", "v1"].iter().cloned()
.map(ast::Ident::from_str)
@@ -118,7 +118,7 @@ pub fn maybe_inject_crates_ref(
span,
})),
id: ast::DUMMY_NODE_ID,
ident: keywords::Invalid.ident(),
ident: ast::Ident::with_empty_ctxt(kw::Invalid),
span,
tokens: None,
}));