Re-export more rustc_span::symbol things from rustc_span.
`rustc_span::symbol` defines some things that are re-exported from
`rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some
closely related things such as `Ident` and `kw`. So you can do `use
rustc_span::{Symbol, sym}` but you have to do `use
rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good
reason.
This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`,
and changes many `rustc_span::symbol::` qualifiers in `compiler/` to
`rustc_span::`. This is a 200+ net line of code reduction, mostly
because many files with two `use rustc_span` items can be reduced to
one.
This commit is contained in:
@@ -18,8 +18,7 @@ use rustc_parse::parser::Parser;
|
||||
use rustc_parse::{new_parser_from_source_str, source_str_to_stream, unwrap_or_emit_fatal};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::def_id::CrateNum;
|
||||
use rustc_span::symbol::{self, Symbol, sym};
|
||||
use rustc_span::{BytePos, FileName, Pos, SourceFile, Span};
|
||||
use rustc_span::{BytePos, FileName, Pos, SourceFile, Span, Symbol, sym};
|
||||
use smallvec::{SmallVec, smallvec};
|
||||
|
||||
use crate::base::ExtCtxt;
|
||||
@@ -230,7 +229,7 @@ impl FromInternal<(TokenStream, &mut Rustc<'_, '_>)> for Vec<TokenTree<TokenStre
|
||||
})),
|
||||
|
||||
Lifetime(name, is_raw) => {
|
||||
let ident = symbol::Ident::new(name, span).without_first_quote();
|
||||
let ident = rustc_span::Ident::new(name, span).without_first_quote();
|
||||
trees.extend([
|
||||
TokenTree::Punct(Punct { ch: b'\'', joint: true, span }),
|
||||
TokenTree::Ident(Ident { sym: ident.name, is_raw: is_raw.into(), span }),
|
||||
|
||||
Reference in New Issue
Block a user