mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Rollup merge of #71555 - cjgillot:nameless, r=matthewjasper
Remove ast::{Ident, Name} reexports. The reexport of `Symbol` into `Name` confused me.
This commit is contained in:
commit
366c1786e6
@ -4226,7 +4226,6 @@ name = "rustc_privacy"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"rustc_ast",
|
||||
"rustc_attr",
|
||||
"rustc_data_structures",
|
||||
"rustc_errors",
|
||||
|
@ -22,8 +22,6 @@ pub use crate::util::parser::ExprPrecedence;
|
||||
pub use GenericArgs::*;
|
||||
pub use UnsafeSource::*;
|
||||
|
||||
pub use rustc_span::symbol::{Ident, Symbol as Name};
|
||||
|
||||
use crate::ptr::P;
|
||||
use crate::token::{self, DelimToken};
|
||||
use crate::tokenstream::{DelimSpan, TokenStream, TokenTree};
|
||||
@ -34,7 +32,7 @@ use rustc_data_structures::thin_vec::ThinVec;
|
||||
use rustc_macros::HashStable_Generic;
|
||||
use rustc_serialize::{self, Decoder, Encoder};
|
||||
use rustc_span::source_map::{respan, Spanned};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
use std::convert::TryFrom;
|
||||
@ -2451,7 +2449,7 @@ pub enum ItemKind {
|
||||
/// An `extern crate` item, with the optional *original* crate name if the crate was renamed.
|
||||
///
|
||||
/// E.g., `extern crate foo` or `extern crate foo_bar as foo`.
|
||||
ExternCrate(Option<Name>),
|
||||
ExternCrate(Option<Symbol>),
|
||||
/// A use declaration item (`use`).
|
||||
///
|
||||
/// E.g., `use foo;`, `use foo::bar;` or `use foo::bar as FooBar;`.
|
||||
|
@ -3,8 +3,8 @@
|
||||
use crate::ast;
|
||||
use crate::ast::{AttrId, AttrItem, AttrKind, AttrStyle, AttrVec, Attribute};
|
||||
use crate::ast::{Expr, GenericParam, Item, Lit, LitKind, Local, Stmt, StmtKind};
|
||||
use crate::ast::{Ident, Name, Path, PathSegment};
|
||||
use crate::ast::{MacArgs, MacDelimiter, MetaItem, MetaItemKind, NestedMetaItem};
|
||||
use crate::ast::{Path, PathSegment};
|
||||
use crate::mut_visit::visit_clobber;
|
||||
use crate::ptr::P;
|
||||
use crate::token::{self, Token};
|
||||
@ -14,7 +14,7 @@ use rustc_data_structures::sync::Lock;
|
||||
use rustc_index::bit_set::GrowableBitSet;
|
||||
use rustc_span::edition::{Edition, DEFAULT_EDITION};
|
||||
use rustc_span::source_map::{BytePos, Spanned};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::symbol::{sym, Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
use log::debug;
|
||||
@ -113,7 +113,7 @@ impl NestedMetaItem {
|
||||
}
|
||||
|
||||
/// Returns a name and single literal value tuple of the `MetaItem`.
|
||||
pub fn name_value_literal(&self) -> Option<(Name, &Lit)> {
|
||||
pub fn name_value_literal(&self) -> Option<(Symbol, &Lit)> {
|
||||
self.meta_item().and_then(|meta_item| {
|
||||
meta_item.meta_item_list().and_then(|meta_item_list| {
|
||||
if meta_item_list.len() == 1 {
|
||||
|
@ -15,6 +15,7 @@ use crate::tokenstream::*;
|
||||
use rustc_data_structures::map_in_place::MapInPlace;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_span::source_map::{respan, Spanned};
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::Span;
|
||||
|
||||
use smallvec::{smallvec, Array, SmallVec};
|
||||
|
@ -12,7 +12,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_macros::HashStable_Generic;
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
use rustc_span::{self, Span, DUMMY_SP};
|
||||
use std::borrow::Cow;
|
||||
use std::{fmt, mem};
|
||||
@ -145,7 +145,7 @@ impl Lit {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ident_can_begin_expr(name: ast::Name, span: Span, is_raw: bool) -> bool {
|
||||
pub fn ident_can_begin_expr(name: Symbol, span: Span, is_raw: bool) -> bool {
|
||||
let ident_token = Token::new(Ident(name, is_raw), span);
|
||||
|
||||
!ident_token.is_reserved_ident()
|
||||
@ -173,7 +173,7 @@ pub fn ident_can_begin_expr(name: ast::Name, span: Span, is_raw: bool) -> bool {
|
||||
.contains(&name)
|
||||
}
|
||||
|
||||
fn ident_can_begin_type(name: ast::Name, span: Span, is_raw: bool) -> bool {
|
||||
fn ident_can_begin_type(name: Symbol, span: Span, is_raw: bool) -> bool {
|
||||
let ident_token = Token::new(Ident(name, is_raw), span);
|
||||
|
||||
!ident_token.is_reserved_ident()
|
||||
@ -229,18 +229,18 @@ pub enum TokenKind {
|
||||
/// Do not forget about `NtIdent` when you want to match on identifiers.
|
||||
/// It's recommended to use `Token::(ident,uninterpolate,uninterpolated_span)` to
|
||||
/// treat regular and interpolated identifiers in the same way.
|
||||
Ident(ast::Name, /* is_raw */ bool),
|
||||
Ident(Symbol, /* is_raw */ bool),
|
||||
/// Lifetime identifier token.
|
||||
/// Do not forget about `NtLifetime` when you want to match on lifetime identifiers.
|
||||
/// It's recommended to use `Token::(lifetime,uninterpolate,uninterpolated_span)` to
|
||||
/// treat regular and interpolated lifetime identifiers in the same way.
|
||||
Lifetime(ast::Name),
|
||||
Lifetime(Symbol),
|
||||
|
||||
Interpolated(Lrc<Nonterminal>),
|
||||
|
||||
// Can be expanded into several tokens.
|
||||
/// A doc comment.
|
||||
DocComment(ast::Name),
|
||||
DocComment(Symbol),
|
||||
|
||||
// Junk. These carry no data because we don't really care about the data
|
||||
// they *would* carry, and don't really want to allocate a new ident for
|
||||
@ -249,9 +249,9 @@ pub enum TokenKind {
|
||||
Whitespace,
|
||||
/// A comment.
|
||||
Comment,
|
||||
Shebang(ast::Name),
|
||||
Shebang(Symbol),
|
||||
/// A completely invalid token which should be skipped.
|
||||
Unknown(ast::Name),
|
||||
Unknown(Symbol),
|
||||
|
||||
Eof,
|
||||
}
|
||||
@ -325,8 +325,8 @@ impl Token {
|
||||
Token::new(TokenKind::Whitespace, DUMMY_SP)
|
||||
}
|
||||
|
||||
/// Recovers a `Token` from an `ast::Ident`. This creates a raw identifier if necessary.
|
||||
pub fn from_ast_ident(ident: ast::Ident) -> Self {
|
||||
/// Recovers a `Token` from an `Ident`. This creates a raw identifier if necessary.
|
||||
pub fn from_ast_ident(ident: Ident) -> Self {
|
||||
Token::new(Ident(ident.name, ident.is_raw_guess()), ident.span)
|
||||
}
|
||||
|
||||
@ -488,19 +488,19 @@ impl Token {
|
||||
}
|
||||
|
||||
/// Returns an identifier if this token is an identifier.
|
||||
pub fn ident(&self) -> Option<(ast::Ident, /* is_raw */ bool)> {
|
||||
pub fn ident(&self) -> Option<(Ident, /* is_raw */ bool)> {
|
||||
let token = self.uninterpolate();
|
||||
match token.kind {
|
||||
Ident(name, is_raw) => Some((ast::Ident::new(name, token.span), is_raw)),
|
||||
Ident(name, is_raw) => Some((Ident::new(name, token.span), is_raw)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a lifetime identifier if this token is a lifetime.
|
||||
pub fn lifetime(&self) -> Option<ast::Ident> {
|
||||
pub fn lifetime(&self) -> Option<Ident> {
|
||||
let token = self.uninterpolate();
|
||||
match token.kind {
|
||||
Lifetime(name) => Some(ast::Ident::new(name, token.span)),
|
||||
Lifetime(name) => Some(Ident::new(name, token.span)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@ -577,28 +577,28 @@ impl Token {
|
||||
}
|
||||
|
||||
pub fn is_path_segment_keyword(&self) -> bool {
|
||||
self.is_non_raw_ident_where(ast::Ident::is_path_segment_keyword)
|
||||
self.is_non_raw_ident_where(Ident::is_path_segment_keyword)
|
||||
}
|
||||
|
||||
// Returns true for reserved identifiers used internally for elided lifetimes,
|
||||
// unnamed method parameters, crate root module, error recovery etc.
|
||||
pub fn is_special_ident(&self) -> bool {
|
||||
self.is_non_raw_ident_where(ast::Ident::is_special)
|
||||
self.is_non_raw_ident_where(Ident::is_special)
|
||||
}
|
||||
|
||||
/// Returns `true` if the token is a keyword used in the language.
|
||||
pub fn is_used_keyword(&self) -> bool {
|
||||
self.is_non_raw_ident_where(ast::Ident::is_used_keyword)
|
||||
self.is_non_raw_ident_where(Ident::is_used_keyword)
|
||||
}
|
||||
|
||||
/// Returns `true` if the token is a keyword reserved for possible future use.
|
||||
pub fn is_unused_keyword(&self) -> bool {
|
||||
self.is_non_raw_ident_where(ast::Ident::is_unused_keyword)
|
||||
self.is_non_raw_ident_where(Ident::is_unused_keyword)
|
||||
}
|
||||
|
||||
/// Returns `true` if the token is either a special identifier or a keyword.
|
||||
pub fn is_reserved_ident(&self) -> bool {
|
||||
self.is_non_raw_ident_where(ast::Ident::is_reserved)
|
||||
self.is_non_raw_ident_where(Ident::is_reserved)
|
||||
}
|
||||
|
||||
/// Returns `true` if the token is the identifier `true` or `false`.
|
||||
@ -607,7 +607,7 @@ impl Token {
|
||||
}
|
||||
|
||||
/// Returns `true` if the token is a non-raw identifier for which `pred` holds.
|
||||
pub fn is_non_raw_ident_where(&self, pred: impl FnOnce(ast::Ident) -> bool) -> bool {
|
||||
pub fn is_non_raw_ident_where(&self, pred: impl FnOnce(Ident) -> bool) -> bool {
|
||||
match self.ident() {
|
||||
Some((id, false)) => pred(id),
|
||||
_ => false,
|
||||
@ -746,8 +746,8 @@ pub enum Nonterminal {
|
||||
NtPat(P<ast::Pat>),
|
||||
NtExpr(P<ast::Expr>),
|
||||
NtTy(P<ast::Ty>),
|
||||
NtIdent(ast::Ident, /* is_raw */ bool),
|
||||
NtLifetime(ast::Ident),
|
||||
NtIdent(Ident, /* is_raw */ bool),
|
||||
NtLifetime(Ident),
|
||||
NtLiteral(P<ast::Expr>),
|
||||
/// Stuff inside brackets for attributes
|
||||
NtMeta(P<ast::AttrItem>),
|
||||
|
@ -17,6 +17,7 @@ use crate::ast::*;
|
||||
use crate::token::Token;
|
||||
use crate::tokenstream::{TokenStream, TokenTree};
|
||||
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
@ -74,7 +75,7 @@ impl<'a> FnKind<'a> {
|
||||
/// to monitor future changes to `Visitor` in case a new method with a
|
||||
/// new default implementation gets introduced.)
|
||||
pub trait Visitor<'ast>: Sized {
|
||||
fn visit_name(&mut self, _span: Span, _name: Name) {
|
||||
fn visit_name(&mut self, _span: Span, _name: Symbol) {
|
||||
// Nothing to do.
|
||||
}
|
||||
fn visit_ident(&mut self, ident: Ident) {
|
||||
|
@ -9,7 +9,7 @@ use rustc_errors::struct_span_err;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::Res;
|
||||
use rustc_span::source_map::{respan, DesugaringKind, Span, Spanned};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::symbol::{sym, Ident, Symbol};
|
||||
|
||||
impl<'hir> LoweringContext<'_, 'hir> {
|
||||
fn lower_exprs(&mut self, exprs: &[AstP<Expr>]) -> &'hir [hir::Expr<'hir>] {
|
||||
|
@ -12,7 +12,7 @@ use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_span::source_map::{respan, DesugaringKind};
|
||||
use rustc_span::symbol::{kw, sym};
|
||||
use rustc_span::symbol::{kw, sym, Ident};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::spec::abi;
|
||||
|
||||
|
@ -63,7 +63,7 @@ use rustc_session::parse::ParseSess;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::hygiene::ExpnId;
|
||||
use rustc_span::source_map::{respan, DesugaringKind, ExpnData, ExpnKind};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
use log::{debug, trace};
|
||||
|
@ -5,6 +5,7 @@ use rustc_ast::ptr::P;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::Res;
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::{source_map::Spanned, Span};
|
||||
|
||||
impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
|
@ -9,6 +9,7 @@ use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::GenericArg;
|
||||
use rustc_session::lint::builtin::ELIDED_LIFETIMES_IN_PATHS;
|
||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::Span;
|
||||
|
||||
use log::debug;
|
||||
|
@ -20,7 +20,7 @@ use rustc_parse::validate_attr;
|
||||
use rustc_session::lint::builtin::PATTERNS_IN_FNS_WITHOUT_BODY;
|
||||
use rustc_session::lint::LintBuffer;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::{kw, sym};
|
||||
use rustc_span::symbol::{kw, sym, Ident};
|
||||
use rustc_span::Span;
|
||||
use std::mem;
|
||||
use std::ops::DerefMut;
|
||||
|
@ -7,7 +7,7 @@ use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP};
|
||||
use rustc_feature::{Features, GateIssue, UnstableFeatures};
|
||||
use rustc_session::parse::{feature_err, feature_err_issue, ParseSess};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
use log::debug;
|
||||
@ -252,7 +252,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_name(&mut self, sp: Span, name: ast::Name) {
|
||||
fn visit_name(&mut self, sp: Span, name: Symbol) {
|
||||
if !name.as_str().is_ascii() {
|
||||
gate_feature_post!(
|
||||
&self,
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use rustc_ast::ast::*;
|
||||
use rustc_ast::visit::*;
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::Span;
|
||||
|
||||
pub struct NodeCounter {
|
||||
|
@ -12,7 +12,7 @@ use rustc_ast::util::parser::{self, AssocOp, Fixity};
|
||||
use rustc_ast::util::{classify, comments};
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::source_map::{SourceMap, Spanned};
|
||||
use rustc_span::symbol::{kw, sym, IdentPrinter};
|
||||
use rustc_span::symbol::{kw, sym, Ident, IdentPrinter, Symbol};
|
||||
use rustc_span::{BytePos, FileName, Span};
|
||||
|
||||
use std::borrow::Cow;
|
||||
@ -26,8 +26,8 @@ pub enum MacHeader<'a> {
|
||||
}
|
||||
|
||||
pub enum AnnNode<'a> {
|
||||
Ident(&'a ast::Ident),
|
||||
Name(&'a ast::Name),
|
||||
Ident(&'a Ident),
|
||||
Name(&'a Symbol),
|
||||
Block(&'a ast::Block),
|
||||
Item(&'a ast::Item),
|
||||
SubItem(ast::NodeId),
|
||||
@ -118,8 +118,8 @@ pub fn print_crate<'a>(
|
||||
// of the feature gate, so we fake them up here.
|
||||
|
||||
// `#![feature(prelude_import)]`
|
||||
let pi_nested = attr::mk_nested_word_item(ast::Ident::with_dummy_span(sym::prelude_import));
|
||||
let list = attr::mk_list_item(ast::Ident::with_dummy_span(sym::feature), vec![pi_nested]);
|
||||
let pi_nested = attr::mk_nested_word_item(Ident::with_dummy_span(sym::prelude_import));
|
||||
let list = attr::mk_list_item(Ident::with_dummy_span(sym::feature), vec![pi_nested]);
|
||||
let fake_attr = attr::mk_attr_inner(list);
|
||||
s.print_attribute(&fake_attr);
|
||||
|
||||
@ -127,7 +127,7 @@ pub fn print_crate<'a>(
|
||||
// root, so this is not needed, and actually breaks things.
|
||||
if edition == Edition::Edition2015 {
|
||||
// `#![no_std]`
|
||||
let no_std_meta = attr::mk_word_item(ast::Ident::with_dummy_span(sym::no_std));
|
||||
let no_std_meta = attr::mk_word_item(Ident::with_dummy_span(sym::no_std));
|
||||
let fake_attr = attr::mk_attr_inner(no_std_meta);
|
||||
s.print_attribute(&fake_attr);
|
||||
}
|
||||
@ -389,7 +389,7 @@ impl std::ops::DerefMut for State<'_> {
|
||||
|
||||
pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::DerefMut {
|
||||
fn comments(&mut self) -> &mut Option<Comments<'a>>;
|
||||
fn print_ident(&mut self, ident: ast::Ident);
|
||||
fn print_ident(&mut self, ident: Ident);
|
||||
fn print_generic_args(&mut self, args: &ast::GenericArgs, colons_before_params: bool);
|
||||
|
||||
fn strsep<T, F>(
|
||||
@ -671,7 +671,7 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
|
||||
&mut self,
|
||||
header: Option<MacHeader<'_>>,
|
||||
has_bang: bool,
|
||||
ident: Option<ast::Ident>,
|
||||
ident: Option<Ident>,
|
||||
delim: DelimToken,
|
||||
tts: TokenStream,
|
||||
convert_dollar_crate: bool,
|
||||
@ -782,7 +782,7 @@ impl<'a> PrintState<'a> for State<'a> {
|
||||
&mut self.comments
|
||||
}
|
||||
|
||||
fn print_ident(&mut self, ident: ast::Ident) {
|
||||
fn print_ident(&mut self, ident: Ident) {
|
||||
self.s.word(IdentPrinter::for_ast_ident(ident, ident.is_raw_guess()).to_string());
|
||||
self.ann.post(self, AnnNode::Ident(&ident))
|
||||
}
|
||||
@ -1001,7 +1001,7 @@ impl<'a> State<'a> {
|
||||
|
||||
fn print_item_const(
|
||||
&mut self,
|
||||
ident: ast::Ident,
|
||||
ident: Ident,
|
||||
mutbl: Option<ast::Mutability>,
|
||||
ty: &ast::Ty,
|
||||
body: Option<&ast::Expr>,
|
||||
@ -1032,7 +1032,7 @@ impl<'a> State<'a> {
|
||||
|
||||
fn print_associated_type(
|
||||
&mut self,
|
||||
ident: ast::Ident,
|
||||
ident: Ident,
|
||||
generics: &ast::Generics,
|
||||
bounds: &ast::GenericBounds,
|
||||
ty: Option<&ast::Ty>,
|
||||
@ -1281,7 +1281,7 @@ impl<'a> State<'a> {
|
||||
&mut self,
|
||||
enum_definition: &ast::EnumDef,
|
||||
generics: &ast::Generics,
|
||||
ident: ast::Ident,
|
||||
ident: Ident,
|
||||
span: rustc_span::Span,
|
||||
visibility: &ast::Visibility,
|
||||
) {
|
||||
@ -1337,7 +1337,7 @@ impl<'a> State<'a> {
|
||||
&mut self,
|
||||
struct_def: &ast::VariantData,
|
||||
generics: &ast::Generics,
|
||||
ident: ast::Ident,
|
||||
ident: Ident,
|
||||
span: rustc_span::Span,
|
||||
print_finalizer: bool,
|
||||
) {
|
||||
@ -2116,7 +2116,7 @@ impl<'a> State<'a> {
|
||||
self.s.word(i.to_string())
|
||||
}
|
||||
|
||||
crate fn print_name(&mut self, name: ast::Name) {
|
||||
crate fn print_name(&mut self, name: Symbol) {
|
||||
self.s.word(name.to_string());
|
||||
self.ann.post(self, AnnNode::Name(&name))
|
||||
}
|
||||
@ -2322,7 +2322,7 @@ impl<'a> State<'a> {
|
||||
fn print_fn_full(
|
||||
&mut self,
|
||||
sig: &ast::FnSig,
|
||||
name: ast::Ident,
|
||||
name: Ident,
|
||||
generics: &ast::Generics,
|
||||
vis: &ast::Visibility,
|
||||
defaultness: ast::Defaultness,
|
||||
@ -2347,7 +2347,7 @@ impl<'a> State<'a> {
|
||||
&mut self,
|
||||
decl: &ast::FnDecl,
|
||||
header: ast::FnHeader,
|
||||
name: Option<ast::Ident>,
|
||||
name: Option<Ident>,
|
||||
generics: &ast::Generics,
|
||||
) {
|
||||
self.print_fn_header_info(header);
|
||||
@ -2614,7 +2614,7 @@ impl<'a> State<'a> {
|
||||
ext: ast::Extern,
|
||||
unsafety: ast::Unsafe,
|
||||
decl: &ast::FnDecl,
|
||||
name: Option<ast::Ident>,
|
||||
name: Option<Ident>,
|
||||
generic_params: &[ast::GenericParam],
|
||||
) {
|
||||
self.ibox(INDENT_UNIT);
|
||||
|
@ -4,11 +4,12 @@ use rustc_ast::ast;
|
||||
use rustc_ast::with_default_globals;
|
||||
use rustc_span;
|
||||
use rustc_span::source_map::respan;
|
||||
use rustc_span::symbol::Ident;
|
||||
|
||||
fn fun_to_string(
|
||||
decl: &ast::FnDecl,
|
||||
header: ast::FnHeader,
|
||||
name: ast::Ident,
|
||||
name: Ident,
|
||||
generics: &ast::Generics,
|
||||
) -> String {
|
||||
to_string(|s| {
|
||||
@ -26,7 +27,7 @@ fn variant_to_string(var: &ast::Variant) -> String {
|
||||
#[test]
|
||||
fn test_fun_to_string() {
|
||||
with_default_globals(|| {
|
||||
let abba_ident = ast::Ident::from_str("abba");
|
||||
let abba_ident = Ident::from_str("abba");
|
||||
|
||||
let decl =
|
||||
ast::FnDecl { inputs: Vec::new(), output: ast::FnRetTy::Default(rustc_span::DUMMY_SP) };
|
||||
@ -41,7 +42,7 @@ fn test_fun_to_string() {
|
||||
#[test]
|
||||
fn test_variant_to_string() {
|
||||
with_default_globals(|| {
|
||||
let ident = ast::Ident::from_str("principal_skinner");
|
||||
let ident = Ident::from_str("principal_skinner");
|
||||
|
||||
let var = ast::Variant {
|
||||
ident,
|
||||
|
@ -7,7 +7,7 @@ use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree};
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_expand::base::*;
|
||||
use rustc_parse::parser::Parser;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::symbol::{sym, Ident, Symbol};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
pub fn expand_assert<'cx>(
|
||||
|
@ -3,7 +3,7 @@ use rustc_ast::ptr::P;
|
||||
use rustc_ast::token::{self, Token};
|
||||
use rustc_ast::tokenstream::{TokenStream, TokenTree};
|
||||
use rustc_expand::base::{self, *};
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
pub fn expand_concat_idents<'cx>(
|
||||
@ -39,10 +39,10 @@ pub fn expand_concat_idents<'cx>(
|
||||
}
|
||||
}
|
||||
|
||||
let ident = ast::Ident::new(Symbol::intern(&res_str), cx.with_call_site_ctxt(sp));
|
||||
let ident = Ident::new(Symbol::intern(&res_str), cx.with_call_site_ctxt(sp));
|
||||
|
||||
struct ConcatIdentsResult {
|
||||
ident: ast::Ident,
|
||||
ident: Ident,
|
||||
}
|
||||
|
||||
impl base::MacResult for ConcatIdentsResult {
|
||||
|
@ -5,7 +5,7 @@ use crate::deriving::path_std;
|
||||
use rustc_ast::ast::{self, Expr, GenericArg, Generics, ItemKind, MetaItem, VariantData};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
pub fn expand_deriving_clone(
|
||||
@ -135,8 +135,7 @@ fn cs_clone_shallow(
|
||||
let mut stmts = Vec::new();
|
||||
if is_union {
|
||||
// let _: AssertParamIsCopy<Self>;
|
||||
let self_ty =
|
||||
cx.ty_path(cx.path_ident(trait_span, ast::Ident::with_dummy_span(kw::SelfUpper)));
|
||||
let self_ty = cx.ty_path(cx.path_ident(trait_span, Ident::with_dummy_span(kw::SelfUpper)));
|
||||
assert_ty_bounds(cx, &mut stmts, self_ty, trait_span, "AssertParamIsCopy");
|
||||
} else {
|
||||
match *substr.fields {
|
||||
|
@ -2,10 +2,10 @@ use crate::deriving::generic::ty::*;
|
||||
use crate::deriving::generic::*;
|
||||
use crate::deriving::path_std;
|
||||
|
||||
use rustc_ast::ast::{self, Expr, GenericArg, Ident, MetaItem};
|
||||
use rustc_ast::ast::{self, Expr, GenericArg, MetaItem};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::symbol::{sym, Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
pub fn expand_deriving_eq(
|
||||
|
@ -5,7 +5,7 @@ use crate::deriving::path_std;
|
||||
use rustc_ast::ast::{self, Expr, MetaItem};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::symbol::{sym, Ident};
|
||||
use rustc_span::Span;
|
||||
|
||||
pub fn expand_deriving_ord(
|
||||
@ -45,15 +45,15 @@ pub fn expand_deriving_ord(
|
||||
pub fn ordering_collapsed(
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
span: Span,
|
||||
self_arg_tags: &[ast::Ident],
|
||||
self_arg_tags: &[Ident],
|
||||
) -> P<ast::Expr> {
|
||||
let lft = cx.expr_ident(span, self_arg_tags[0]);
|
||||
let rgt = cx.expr_addr_of(span, cx.expr_ident(span, self_arg_tags[1]));
|
||||
cx.expr_method_call(span, lft, ast::Ident::new(sym::cmp, span), vec![rgt])
|
||||
cx.expr_method_call(span, lft, Ident::new(sym::cmp, span), vec![rgt])
|
||||
}
|
||||
|
||||
pub fn cs_cmp(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> P<Expr> {
|
||||
let test_id = ast::Ident::new(sym::cmp, span);
|
||||
let test_id = Ident::new(sym::cmp, span);
|
||||
let equals_path = cx.path_global(span, cx.std_path(&[sym::cmp, sym::Ordering, sym::Equal]));
|
||||
|
||||
let cmp_path = cx.std_path(&[sym::cmp, sym::Ord, sym::cmp]);
|
||||
|
@ -7,7 +7,7 @@ use crate::deriving::{path_local, path_std, pathvec_std};
|
||||
use rustc_ast::ast::{self, BinOpKind, Expr, MetaItem};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::symbol::{sym, Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
pub fn expand_deriving_partial_ord(
|
||||
@ -104,7 +104,7 @@ pub fn some_ordering_collapsed(
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
span: Span,
|
||||
op: OrderingOp,
|
||||
self_arg_tags: &[ast::Ident],
|
||||
self_arg_tags: &[Ident],
|
||||
) -> P<ast::Expr> {
|
||||
let lft = cx.expr_ident(span, self_arg_tags[0]);
|
||||
let rgt = cx.expr_addr_of(span, cx.expr_ident(span, self_arg_tags[1]));
|
||||
@ -119,7 +119,7 @@ pub fn some_ordering_collapsed(
|
||||
}
|
||||
|
||||
pub fn cs_partial_cmp(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> P<Expr> {
|
||||
let test_id = ast::Ident::new(sym::cmp, span);
|
||||
let test_id = Ident::new(sym::cmp, span);
|
||||
let ordering = cx.path_global(span, cx.std_path(&[sym::cmp, sym::Ordering, sym::Equal]));
|
||||
let ordering_expr = cx.expr_path(ordering.clone());
|
||||
let equals_expr = cx.expr_some(span, ordering_expr);
|
||||
|
@ -2,11 +2,11 @@ use crate::deriving::generic::ty::*;
|
||||
use crate::deriving::generic::*;
|
||||
use crate::deriving::path_std;
|
||||
|
||||
use rustc_ast::ast::{self, Ident};
|
||||
use rustc_ast::ast;
|
||||
use rustc_ast::ast::{Expr, MetaItem};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::symbol::{sym, Ident};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
pub fn expand_deriving_debug(
|
||||
|
@ -181,7 +181,7 @@ use std::cell::RefCell;
|
||||
use std::iter;
|
||||
use std::vec;
|
||||
|
||||
use rustc_ast::ast::{self, BinOpKind, EnumDef, Expr, Generics, Ident, PatKind};
|
||||
use rustc_ast::ast::{self, BinOpKind, EnumDef, Expr, Generics, PatKind};
|
||||
use rustc_ast::ast::{GenericArg, GenericParamKind, VariantData};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_attr as attr;
|
||||
@ -189,7 +189,7 @@ use rustc_data_structures::map_in_place::MapInPlace;
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::source_map::respan;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
use ty::{LifetimeBounds, Path, Ptr, PtrTy, Self_, Ty};
|
||||
@ -222,7 +222,7 @@ pub struct TraitDef<'a> {
|
||||
|
||||
pub methods: Vec<MethodDef<'a>>,
|
||||
|
||||
pub associated_types: Vec<(ast::Ident, Ty<'a>)>,
|
||||
pub associated_types: Vec<(Ident, Ty<'a>)>,
|
||||
}
|
||||
|
||||
pub struct MethodDef<'a> {
|
||||
@ -336,14 +336,14 @@ pub fn combine_substructure(
|
||||
/// is not global and starts with `T`, or a `TyQPath`.
|
||||
fn find_type_parameters(
|
||||
ty: &ast::Ty,
|
||||
ty_param_names: &[ast::Name],
|
||||
ty_param_names: &[Symbol],
|
||||
cx: &ExtCtxt<'_>,
|
||||
) -> Vec<P<ast::Ty>> {
|
||||
use rustc_ast::visit;
|
||||
|
||||
struct Visitor<'a, 'b> {
|
||||
cx: &'a ExtCtxt<'b>,
|
||||
ty_param_names: &'a [ast::Name],
|
||||
ty_param_names: &'a [Symbol],
|
||||
types: Vec<P<ast::Ty>>,
|
||||
}
|
||||
|
||||
@ -620,7 +620,7 @@ impl<'a> TraitDef<'a> {
|
||||
.peekable();
|
||||
|
||||
if ty_params.peek().is_some() {
|
||||
let ty_param_names: Vec<ast::Name> =
|
||||
let ty_param_names: Vec<Symbol> =
|
||||
ty_params.map(|ty_param| ty_param.ident.name).collect();
|
||||
|
||||
for field_ty in field_tys {
|
||||
@ -1223,7 +1223,7 @@ impl<'a> MethodDef<'a> {
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let self_arg_idents =
|
||||
self_arg_names.iter().map(|name| cx.ident_of(name, sp)).collect::<Vec<ast::Ident>>();
|
||||
self_arg_names.iter().map(|name| cx.ident_of(name, sp)).collect::<Vec<Ident>>();
|
||||
|
||||
// The `vi_idents` will be bound, solely in the catch-all, to
|
||||
// a series of let statements mapping each self_arg to an int
|
||||
@ -1234,7 +1234,7 @@ impl<'a> MethodDef<'a> {
|
||||
let vi_suffix = format!("{}_vi", &name[..]);
|
||||
cx.ident_of(&vi_suffix[..], trait_.span)
|
||||
})
|
||||
.collect::<Vec<ast::Ident>>();
|
||||
.collect::<Vec<Ident>>();
|
||||
|
||||
// Builds, via callback to call_substructure_method, the
|
||||
// delegated expression that handles the catch-all case,
|
||||
@ -1598,7 +1598,7 @@ impl<'a> TraitDef<'a> {
|
||||
fn create_subpatterns(
|
||||
&self,
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
field_paths: Vec<ast::Ident>,
|
||||
field_paths: Vec<Ident>,
|
||||
mutbl: ast::Mutability,
|
||||
use_temporaries: bool,
|
||||
) -> Vec<P<ast::Pat>> {
|
||||
@ -1670,7 +1670,7 @@ impl<'a> TraitDef<'a> {
|
||||
fn create_enum_variant_pattern(
|
||||
&self,
|
||||
cx: &mut ExtCtxt<'_>,
|
||||
enum_ident: ast::Ident,
|
||||
enum_ident: Ident,
|
||||
variant: &'a ast::Variant,
|
||||
prefix: &str,
|
||||
mutbl: ast::Mutability,
|
||||
|
@ -4,11 +4,11 @@
|
||||
pub use PtrTy::*;
|
||||
pub use Ty::*;
|
||||
|
||||
use rustc_ast::ast::{self, Expr, GenericArg, GenericParamKind, Generics, Ident, SelfKind};
|
||||
use rustc_ast::ast::{self, Expr, GenericArg, GenericParamKind, Generics, SelfKind};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_expand::base::ExtCtxt;
|
||||
use rustc_span::source_map::{respan, DUMMY_SP};
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::symbol::{kw, Ident};
|
||||
use rustc_span::Span;
|
||||
|
||||
/// The types of pointers
|
||||
|
@ -3,7 +3,7 @@
|
||||
use rustc_ast::ast::{self, ItemKind, MetaItem};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt, MultiItemModifier};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::symbol::{sym, Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
macro path_local($x:ident) {
|
||||
@ -154,7 +154,7 @@ fn inject_impl_of_structural_trait(
|
||||
|
||||
let newitem = cx.item(
|
||||
span,
|
||||
ast::Ident::invalid(),
|
||||
Ident::invalid(),
|
||||
attrs,
|
||||
ItemKind::Impl {
|
||||
unsafety: ast::Unsafe::No,
|
||||
|
@ -3,10 +3,10 @@
|
||||
// interface.
|
||||
//
|
||||
|
||||
use rustc_ast::ast::{self, GenericArg, Ident};
|
||||
use rustc_ast::ast::{self, GenericArg};
|
||||
use rustc_ast::tokenstream::TokenStream;
|
||||
use rustc_expand::base::{self, *};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::env;
|
||||
|
@ -10,7 +10,7 @@ use rustc_ast::tokenstream::TokenStream;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_errors::{pluralize, Applicability, DiagnosticBuilder};
|
||||
use rustc_expand::base::{self, *};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::symbol::{sym, Ident, Symbol};
|
||||
use rustc_span::{MultiSpan, Span};
|
||||
|
||||
use std::borrow::Cow;
|
||||
@ -535,7 +535,7 @@ impl<'a, 'b> Context<'a, 'b> {
|
||||
self.count_args_index_offset = sofar;
|
||||
}
|
||||
|
||||
fn rtpath(ecx: &ExtCtxt<'_>, s: &str) -> Vec<ast::Ident> {
|
||||
fn rtpath(ecx: &ExtCtxt<'_>, s: &str) -> Vec<Ident> {
|
||||
ecx.std_path(&[sym::fmt, sym::rt, sym::v1, Symbol::intern(s)])
|
||||
}
|
||||
|
||||
@ -794,7 +794,7 @@ impl<'a, 'b> Context<'a, 'b> {
|
||||
macsp: Span,
|
||||
mut sp: Span,
|
||||
ty: &ArgumentType,
|
||||
arg: ast::Ident,
|
||||
arg: Ident,
|
||||
) -> P<ast::Expr> {
|
||||
sp = ecx.with_def_site_ctxt(sp);
|
||||
let arg = ecx.expr_ident(sp, arg);
|
||||
|
@ -1,13 +1,13 @@
|
||||
use crate::util::check_builtin_macro_attribute;
|
||||
|
||||
use rustc_ast::ast::{self, Attribute, Expr, FnHeader, FnSig, Generics, Ident, Param};
|
||||
use rustc_ast::ast::{self, Attribute, Expr, FnHeader, FnSig, Generics, Param};
|
||||
use rustc_ast::ast::{ItemKind, Mutability, Stmt, Ty, TyKind, Unsafe};
|
||||
use rustc_ast::expand::allocator::{
|
||||
AllocatorKind, AllocatorMethod, AllocatorTy, ALLOCATOR_METHODS,
|
||||
};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
pub fn expand(
|
||||
|
@ -15,6 +15,7 @@ use rustc_ast::tokenstream::TokenStream;
|
||||
use rustc_errors::DiagnosticBuilder;
|
||||
use rustc_expand::base::{self, *};
|
||||
use rustc_span::source_map::respan;
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::Span;
|
||||
use smallvec::smallvec;
|
||||
|
||||
@ -25,7 +26,7 @@ pub fn expand_global_asm<'cx>(
|
||||
) -> Box<dyn base::MacResult + 'cx> {
|
||||
match parse_global_asm(cx, sp, tts) {
|
||||
Ok(Some(global_asm)) => MacEager::items(smallvec![P(ast::Item {
|
||||
ident: ast::Ident::invalid(),
|
||||
ident: Ident::invalid(),
|
||||
attrs: Vec::new(),
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
kind: ast::ItemKind::GlobalAsm(P(global_asm)),
|
||||
|
@ -14,11 +14,10 @@ extern crate proc_macro;
|
||||
|
||||
use crate::deriving::*;
|
||||
|
||||
use rustc_ast::ast::Ident;
|
||||
use rustc_expand::base::{MacroExpanderFn, Resolver, SyntaxExtension, SyntaxExtensionKind};
|
||||
use rustc_expand::proc_macro::BangProcMacro;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::symbol::{sym, Ident};
|
||||
|
||||
mod assert;
|
||||
mod cfg;
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::mem;
|
||||
|
||||
use rustc_ast::ast::{self, Ident, NodeId};
|
||||
use rustc_ast::ast::{self, NodeId};
|
||||
use rustc_ast::attr;
|
||||
use rustc_ast::expand::is_proc_macro_attr;
|
||||
use rustc_ast::ptr::P;
|
||||
@ -11,17 +11,17 @@ use rustc_expand::expand::{AstFragment, ExpansionConfig};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::hygiene::AstPass;
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::symbol::{kw, sym};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use smallvec::smallvec;
|
||||
use std::cell::RefCell;
|
||||
|
||||
struct ProcMacroDerive {
|
||||
id: NodeId,
|
||||
trait_name: ast::Name,
|
||||
trait_name: Symbol,
|
||||
function_name: Ident,
|
||||
span: Span,
|
||||
attrs: Vec<ast::Name>,
|
||||
attrs: Vec<Symbol>,
|
||||
}
|
||||
|
||||
enum ProcMacroDefType {
|
||||
@ -480,7 +480,7 @@ fn mk_decls(
|
||||
|
||||
let anon_constant = cx.item_const(
|
||||
span,
|
||||
ast::Ident::new(kw::Underscore, span),
|
||||
Ident::new(kw::Underscore, span),
|
||||
cx.ty(span, ast::TyKind::Tup(Vec::new())),
|
||||
block,
|
||||
);
|
||||
|
@ -60,17 +60,17 @@ pub fn inject(
|
||||
let name = names[0];
|
||||
|
||||
let import_path = if rust_2018 {
|
||||
[name, sym::prelude, sym::v1].iter().map(|symbol| ast::Ident::new(*symbol, span)).collect()
|
||||
[name, sym::prelude, sym::v1].iter().map(|symbol| Ident::new(*symbol, span)).collect()
|
||||
} else {
|
||||
[kw::PathRoot, name, sym::prelude, sym::v1]
|
||||
.iter()
|
||||
.map(|symbol| ast::Ident::new(*symbol, span))
|
||||
.map(|symbol| Ident::new(*symbol, span))
|
||||
.collect()
|
||||
};
|
||||
|
||||
let use_item = cx.item(
|
||||
span,
|
||||
ast::Ident::invalid(),
|
||||
Ident::invalid(),
|
||||
vec![cx.attribute(cx.meta_word(span, sym::prelude_import))],
|
||||
ast::ItemKind::Use(P(ast::UseTree {
|
||||
prefix: cx.path(span, import_path),
|
||||
|
@ -7,7 +7,7 @@ use rustc_ast::attr;
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_expand::base::*;
|
||||
use rustc_span::source_map::respan;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::symbol::{sym, Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::iter;
|
||||
@ -105,7 +105,7 @@ pub fn expand_test_or_bench(
|
||||
|
||||
let (sp, attr_sp) = (cx.with_def_site_ctxt(item.span), cx.with_def_site_ctxt(attr_sp));
|
||||
|
||||
let test_id = ast::Ident::new(sym::test, attr_sp);
|
||||
let test_id = Ident::new(sym::test, attr_sp);
|
||||
|
||||
// creates test::$name
|
||||
let test_path = |name| cx.path(sp, vec![test_id, cx.ident_of(name, sp)]);
|
||||
@ -172,12 +172,12 @@ pub fn expand_test_or_bench(
|
||||
|
||||
let mut test_const = cx.item(
|
||||
sp,
|
||||
ast::Ident::new(item.ident.name, sp),
|
||||
Ident::new(item.ident.name, sp),
|
||||
vec![
|
||||
// #[cfg(test)]
|
||||
cx.attribute(attr::mk_list_item(
|
||||
ast::Ident::new(sym::cfg, attr_sp),
|
||||
vec![attr::mk_nested_word_item(ast::Ident::new(sym::test, attr_sp))],
|
||||
Ident::new(sym::cfg, attr_sp),
|
||||
vec![attr::mk_nested_word_item(Ident::new(sym::test, attr_sp))],
|
||||
)),
|
||||
// #[rustc_test_marker]
|
||||
cx.attribute(cx.meta_word(attr_sp, sym::rustc_test_marker)),
|
||||
@ -288,7 +288,7 @@ pub fn expand_test_or_bench(
|
||||
]
|
||||
}
|
||||
|
||||
fn item_path(mod_path: &[ast::Ident], item_ident: &ast::Ident) -> String {
|
||||
fn item_path(mod_path: &[Ident], item_ident: &Ident) -> String {
|
||||
mod_path
|
||||
.iter()
|
||||
.chain(iter::once(item_ident))
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code that generates a test runner to run all the tests in a crate
|
||||
|
||||
use log::debug;
|
||||
use rustc_ast::ast::{self, Ident};
|
||||
use rustc_ast::ast;
|
||||
use rustc_ast::attr;
|
||||
use rustc_ast::entry::{self, EntryPointType};
|
||||
use rustc_ast::mut_visit::{ExpectOne, *};
|
||||
@ -12,7 +12,7 @@ use rustc_feature::Features;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::hygiene::{AstPass, SyntaxContext, Transparency};
|
||||
use rustc_span::source_map::respan;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::symbol::{sym, Ident, Symbol};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use rustc_target::spec::PanicStrategy;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
@ -19,7 +19,6 @@ use crate::llvm::debuginfo::{
|
||||
use crate::value::Value;
|
||||
|
||||
use log::debug;
|
||||
use rustc_ast::ast;
|
||||
use rustc_codegen_ssa::traits::*;
|
||||
use rustc_data_structures::const_cstr;
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
@ -93,7 +92,7 @@ pub const UNKNOWN_COLUMN_NUMBER: c_uint = 0;
|
||||
pub const NO_SCOPE_METADATA: Option<&DIScope> = None;
|
||||
|
||||
#[derive(Copy, Debug, Hash, Eq, PartialEq, Clone)]
|
||||
pub struct UniqueTypeId(ast::Name);
|
||||
pub struct UniqueTypeId(Symbol);
|
||||
|
||||
/// The `TypeMap` is where the `CrateDebugContext` holds the type metadata nodes
|
||||
/// created so far. The metadata nodes are indexed by `UniqueTypeId`, and, for
|
||||
@ -1300,7 +1299,7 @@ fn use_enum_fallback(cx: &CodegenCx<'_, '_>) -> bool {
|
||||
fn generator_layout_and_saved_local_names(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def_id: DefId,
|
||||
) -> (&'tcx GeneratorLayout<'tcx>, IndexVec<mir::GeneratorSavedLocal, Option<ast::Name>>) {
|
||||
) -> (&'tcx GeneratorLayout<'tcx>, IndexVec<mir::GeneratorSavedLocal, Option<Symbol>>) {
|
||||
let body = tcx.optimized_mir(def_id);
|
||||
let generator_layout = body.generator_layout.as_ref().unwrap();
|
||||
let mut generator_saved_local_names = IndexVec::from_elem(None, &generator_layout.field_tys);
|
||||
@ -1656,7 +1655,7 @@ enum VariantInfo<'a, 'tcx> {
|
||||
Generator {
|
||||
substs: SubstsRef<'tcx>,
|
||||
generator_layout: &'tcx GeneratorLayout<'tcx>,
|
||||
generator_saved_local_names: &'a IndexVec<mir::GeneratorSavedLocal, Option<ast::Name>>,
|
||||
generator_saved_local_names: &'a IndexVec<mir::GeneratorSavedLocal, Option<Symbol>>,
|
||||
variant_index: VariantIdx,
|
||||
},
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ use crate::llvm::debuginfo::{
|
||||
};
|
||||
use crate::value::Value;
|
||||
|
||||
use rustc_ast::ast;
|
||||
use rustc_codegen_ssa::debuginfo::type_names;
|
||||
use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext, VariableKind};
|
||||
use rustc_codegen_ssa::traits::*;
|
||||
@ -529,7 +528,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||
fn create_dbg_var(
|
||||
&self,
|
||||
dbg_context: &FunctionDebugContext<&'ll DIScope>,
|
||||
variable_name: ast::Name,
|
||||
variable_name: Symbol,
|
||||
variable_type: Ty<'tcx>,
|
||||
scope_metadata: &'ll DIScope,
|
||||
variable_kind: VariableKind,
|
||||
|
@ -1,10 +1,9 @@
|
||||
use super::BackendTypes;
|
||||
use crate::mir::debuginfo::{FunctionDebugContext, VariableKind};
|
||||
use rustc_ast::ast::Name;
|
||||
use rustc_hir::def_id::CrateNum;
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::ty::{Instance, Ty};
|
||||
use rustc_span::{SourceFile, Span};
|
||||
use rustc_span::{SourceFile, Span, Symbol};
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
use rustc_target::abi::Size;
|
||||
|
||||
@ -36,7 +35,7 @@ pub trait DebugInfoMethods<'tcx>: BackendTypes {
|
||||
fn create_dbg_var(
|
||||
&self,
|
||||
dbg_context: &FunctionDebugContext<Self::DIScope>,
|
||||
variable_name: Name,
|
||||
variable_name: Symbol,
|
||||
variable_type: Ty<'tcx>,
|
||||
scope_metadata: Self::DIScope,
|
||||
variable_kind: VariableKind,
|
||||
|
@ -11,6 +11,7 @@ use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_mir::util::{write_mir_graphviz, write_mir_pretty};
|
||||
use rustc_session::config::{Input, PpMode, PpSourceMode};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::FileName;
|
||||
|
||||
use std::cell::Cell;
|
||||
@ -284,7 +285,7 @@ impl<'a> PrinterSupport for HygieneAnnotation<'a> {
|
||||
impl<'a> pprust::PpAnn for HygieneAnnotation<'a> {
|
||||
fn post(&self, s: &mut pprust::State<'_>, node: pprust::AnnNode<'_>) {
|
||||
match node {
|
||||
pprust::AnnNode::Ident(&ast::Ident { name, span }) => {
|
||||
pprust::AnnNode::Ident(&Ident { name, span }) => {
|
||||
s.s.space();
|
||||
s.synth_comment(format!("{}{:?}", name.as_u32(), span.ctxt()))
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::expand::{self, AstFragment, Invocation};
|
||||
use crate::module::DirectoryOwnership;
|
||||
|
||||
use rustc_ast::ast::{self, Attribute, Name, NodeId, PatKind};
|
||||
use rustc_ast::ast::{self, Attribute, NodeId, PatKind};
|
||||
use rustc_ast::mut_visit::{self, MutVisitor};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::token;
|
||||
@ -796,7 +796,7 @@ impl SyntaxExtension {
|
||||
span: Span,
|
||||
helper_attrs: Vec<Symbol>,
|
||||
edition: Edition,
|
||||
name: Name,
|
||||
name: Symbol,
|
||||
attrs: &[ast::Attribute],
|
||||
) -> SyntaxExtension {
|
||||
let allow_internal_unstable = attr::allow_internal_unstable(&attrs, &sess.span_diagnostic)
|
||||
@ -885,7 +885,7 @@ pub trait Resolver {
|
||||
|
||||
fn resolve_dollar_crates(&mut self);
|
||||
fn visit_ast_fragment_with_placeholders(&mut self, expn_id: ExpnId, fragment: &AstFragment);
|
||||
fn register_builtin_macro(&mut self, ident: ast::Ident, ext: SyntaxExtension);
|
||||
fn register_builtin_macro(&mut self, ident: Ident, ext: SyntaxExtension);
|
||||
|
||||
fn expansion_for_ast_pass(
|
||||
&mut self,
|
||||
@ -913,7 +913,7 @@ pub trait Resolver {
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ModuleData {
|
||||
pub mod_path: Vec<ast::Ident>,
|
||||
pub mod_path: Vec<Ident>,
|
||||
pub directory: PathBuf,
|
||||
}
|
||||
|
||||
@ -1052,16 +1052,16 @@ impl<'a> ExtCtxt<'a> {
|
||||
pub fn set_trace_macros(&mut self, x: bool) {
|
||||
self.ecfg.trace_mac = x
|
||||
}
|
||||
pub fn ident_of(&self, st: &str, sp: Span) -> ast::Ident {
|
||||
ast::Ident::from_str_and_span(st, sp)
|
||||
pub fn ident_of(&self, st: &str, sp: Span) -> Ident {
|
||||
Ident::from_str_and_span(st, sp)
|
||||
}
|
||||
pub fn std_path(&self, components: &[Symbol]) -> Vec<ast::Ident> {
|
||||
pub fn std_path(&self, components: &[Symbol]) -> Vec<Ident> {
|
||||
let def_site = self.with_def_site_ctxt(DUMMY_SP);
|
||||
iter::once(Ident::new(kw::DollarCrate, def_site))
|
||||
.chain(components.iter().map(|&s| Ident::with_dummy_span(s)))
|
||||
.collect()
|
||||
}
|
||||
pub fn name_of(&self, st: &str) -> ast::Name {
|
||||
pub fn name_of(&self, st: &str) -> Symbol {
|
||||
Symbol::intern(st)
|
||||
}
|
||||
|
||||
|
@ -1,28 +1,28 @@
|
||||
use crate::base::ExtCtxt;
|
||||
|
||||
use rustc_ast::ast::{self, AttrVec, BlockCheckMode, Expr, Ident, PatKind, UnOp};
|
||||
use rustc_ast::ast::{self, AttrVec, BlockCheckMode, Expr, PatKind, UnOp};
|
||||
use rustc_ast::attr;
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_span::source_map::{respan, Spanned};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
|
||||
use rustc_span::Span;
|
||||
|
||||
impl<'a> ExtCtxt<'a> {
|
||||
pub fn path(&self, span: Span, strs: Vec<ast::Ident>) -> ast::Path {
|
||||
pub fn path(&self, span: Span, strs: Vec<Ident>) -> ast::Path {
|
||||
self.path_all(span, false, strs, vec![])
|
||||
}
|
||||
pub fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path {
|
||||
pub fn path_ident(&self, span: Span, id: Ident) -> ast::Path {
|
||||
self.path(span, vec![id])
|
||||
}
|
||||
pub fn path_global(&self, span: Span, strs: Vec<ast::Ident>) -> ast::Path {
|
||||
pub fn path_global(&self, span: Span, strs: Vec<Ident>) -> ast::Path {
|
||||
self.path_all(span, true, strs, vec![])
|
||||
}
|
||||
pub fn path_all(
|
||||
&self,
|
||||
span: Span,
|
||||
global: bool,
|
||||
mut idents: Vec<ast::Ident>,
|
||||
mut idents: Vec<Ident>,
|
||||
args: Vec<ast::GenericArg>,
|
||||
) -> ast::Path {
|
||||
assert!(!idents.is_empty());
|
||||
@ -63,7 +63,7 @@ impl<'a> ExtCtxt<'a> {
|
||||
|
||||
// Might need to take bounds as an argument in the future, if you ever want
|
||||
// to generate a bounded existential trait type.
|
||||
pub fn ty_ident(&self, span: Span, ident: ast::Ident) -> P<ast::Ty> {
|
||||
pub fn ty_ident(&self, span: Span, ident: Ident) -> P<ast::Ty> {
|
||||
self.ty_path(self.path_ident(span, ident))
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ impl<'a> ExtCtxt<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn const_ident(&self, span: Span, ident: ast::Ident) -> ast::AnonConst {
|
||||
pub fn const_ident(&self, span: Span, ident: Ident) -> ast::AnonConst {
|
||||
self.anon_const(span, ast::ExprKind::Path(None, self.path_ident(span, ident)))
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ impl<'a> ExtCtxt<'a> {
|
||||
pub fn typaram(
|
||||
&self,
|
||||
span: Span,
|
||||
ident: ast::Ident,
|
||||
ident: Ident,
|
||||
attrs: Vec<ast::Attribute>,
|
||||
bounds: ast::GenericBounds,
|
||||
default: Option<P<ast::Ty>>,
|
||||
@ -129,14 +129,14 @@ impl<'a> ExtCtxt<'a> {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn lifetime(&self, span: Span, ident: ast::Ident) -> ast::Lifetime {
|
||||
pub fn lifetime(&self, span: Span, ident: Ident) -> ast::Lifetime {
|
||||
ast::Lifetime { id: ast::DUMMY_NODE_ID, ident: ident.with_span_pos(span) }
|
||||
}
|
||||
|
||||
pub fn lifetime_def(
|
||||
&self,
|
||||
span: Span,
|
||||
ident: ast::Ident,
|
||||
ident: Ident,
|
||||
attrs: Vec<ast::Attribute>,
|
||||
bounds: ast::GenericBounds,
|
||||
) -> ast::GenericParam {
|
||||
@ -155,13 +155,7 @@ impl<'a> ExtCtxt<'a> {
|
||||
ast::Stmt { id: ast::DUMMY_NODE_ID, span: expr.span, kind: ast::StmtKind::Expr(expr) }
|
||||
}
|
||||
|
||||
pub fn stmt_let(
|
||||
&self,
|
||||
sp: Span,
|
||||
mutbl: bool,
|
||||
ident: ast::Ident,
|
||||
ex: P<ast::Expr>,
|
||||
) -> ast::Stmt {
|
||||
pub fn stmt_let(&self, sp: Span, mutbl: bool, ident: Ident, ex: P<ast::Expr>) -> ast::Stmt {
|
||||
let pat = if mutbl {
|
||||
let binding_mode = ast::BindingMode::ByValue(ast::Mutability::Mut);
|
||||
self.pat_ident_binding_mode(sp, ident, binding_mode)
|
||||
@ -218,7 +212,7 @@ impl<'a> ExtCtxt<'a> {
|
||||
self.expr(path.span, ast::ExprKind::Path(None, path))
|
||||
}
|
||||
|
||||
pub fn expr_ident(&self, span: Span, id: ast::Ident) -> P<ast::Expr> {
|
||||
pub fn expr_ident(&self, span: Span, id: Ident) -> P<ast::Expr> {
|
||||
self.expr_path(self.path_ident(span, id))
|
||||
}
|
||||
pub fn expr_self(&self, span: Span) -> P<ast::Expr> {
|
||||
@ -251,18 +245,13 @@ impl<'a> ExtCtxt<'a> {
|
||||
) -> P<ast::Expr> {
|
||||
self.expr(span, ast::ExprKind::Call(expr, args))
|
||||
}
|
||||
pub fn expr_call_ident(
|
||||
&self,
|
||||
span: Span,
|
||||
id: ast::Ident,
|
||||
args: Vec<P<ast::Expr>>,
|
||||
) -> P<ast::Expr> {
|
||||
pub fn expr_call_ident(&self, span: Span, id: Ident, args: Vec<P<ast::Expr>>) -> P<ast::Expr> {
|
||||
self.expr(span, ast::ExprKind::Call(self.expr_ident(span, id), args))
|
||||
}
|
||||
pub fn expr_call_global(
|
||||
&self,
|
||||
sp: Span,
|
||||
fn_path: Vec<ast::Ident>,
|
||||
fn_path: Vec<Ident>,
|
||||
args: Vec<P<ast::Expr>>,
|
||||
) -> P<ast::Expr> {
|
||||
let pathexpr = self.expr_path(self.path_global(sp, fn_path));
|
||||
@ -272,7 +261,7 @@ impl<'a> ExtCtxt<'a> {
|
||||
&self,
|
||||
span: Span,
|
||||
expr: P<ast::Expr>,
|
||||
ident: ast::Ident,
|
||||
ident: Ident,
|
||||
mut args: Vec<P<ast::Expr>>,
|
||||
) -> P<ast::Expr> {
|
||||
args.insert(0, expr);
|
||||
@ -304,7 +293,7 @@ impl<'a> ExtCtxt<'a> {
|
||||
pub fn expr_struct_ident(
|
||||
&self,
|
||||
span: Span,
|
||||
id: ast::Ident,
|
||||
id: Ident,
|
||||
fields: Vec<ast::Field>,
|
||||
) -> P<ast::Expr> {
|
||||
self.expr_struct(span, self.path_ident(span, id), fields)
|
||||
@ -405,7 +394,7 @@ impl<'a> ExtCtxt<'a> {
|
||||
pub fn pat_lit(&self, span: Span, expr: P<ast::Expr>) -> P<ast::Pat> {
|
||||
self.pat(span, PatKind::Lit(expr))
|
||||
}
|
||||
pub fn pat_ident(&self, span: Span, ident: ast::Ident) -> P<ast::Pat> {
|
||||
pub fn pat_ident(&self, span: Span, ident: Ident) -> P<ast::Pat> {
|
||||
let binding_mode = ast::BindingMode::ByValue(ast::Mutability::Not);
|
||||
self.pat_ident_binding_mode(span, ident, binding_mode)
|
||||
}
|
||||
@ -413,7 +402,7 @@ impl<'a> ExtCtxt<'a> {
|
||||
pub fn pat_ident_binding_mode(
|
||||
&self,
|
||||
span: Span,
|
||||
ident: ast::Ident,
|
||||
ident: Ident,
|
||||
bm: ast::BindingMode,
|
||||
) -> P<ast::Pat> {
|
||||
let pat = PatKind::Ident(bm, ident.with_span_pos(span), None);
|
||||
@ -517,7 +506,7 @@ impl<'a> ExtCtxt<'a> {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn lambda(&self, span: Span, ids: Vec<ast::Ident>, body: P<ast::Expr>) -> P<ast::Expr> {
|
||||
pub fn lambda(&self, span: Span, ids: Vec<Ident>, body: P<ast::Expr>) -> P<ast::Expr> {
|
||||
let fn_decl = self.fn_decl(
|
||||
ids.iter().map(|id| self.param(span, *id, self.ty(span, ast::TyKind::Infer))).collect(),
|
||||
ast::FnRetTy::Default(span),
|
||||
@ -544,20 +533,15 @@ impl<'a> ExtCtxt<'a> {
|
||||
self.lambda(span, Vec::new(), body)
|
||||
}
|
||||
|
||||
pub fn lambda1(&self, span: Span, body: P<ast::Expr>, ident: ast::Ident) -> P<ast::Expr> {
|
||||
pub fn lambda1(&self, span: Span, body: P<ast::Expr>, ident: Ident) -> P<ast::Expr> {
|
||||
self.lambda(span, vec![ident], body)
|
||||
}
|
||||
|
||||
pub fn lambda_stmts_1(
|
||||
&self,
|
||||
span: Span,
|
||||
stmts: Vec<ast::Stmt>,
|
||||
ident: ast::Ident,
|
||||
) -> P<ast::Expr> {
|
||||
pub fn lambda_stmts_1(&self, span: Span, stmts: Vec<ast::Stmt>, ident: Ident) -> P<ast::Expr> {
|
||||
self.lambda1(span, self.expr_block(self.block(span, stmts)), ident)
|
||||
}
|
||||
|
||||
pub fn param(&self, span: Span, ident: ast::Ident, ty: P<ast::Ty>) -> ast::Param {
|
||||
pub fn param(&self, span: Span, ident: Ident, ty: P<ast::Ty>) -> ast::Param {
|
||||
let arg_pat = self.pat_ident(span, ident);
|
||||
ast::Param {
|
||||
attrs: AttrVec::default(),
|
||||
@ -653,7 +637,7 @@ impl<'a> ExtCtxt<'a> {
|
||||
attr::mk_attr_outer(mi)
|
||||
}
|
||||
|
||||
pub fn meta_word(&self, sp: Span, w: ast::Name) -> ast::MetaItem {
|
||||
pub fn meta_word(&self, sp: Span, w: Symbol) -> ast::MetaItem {
|
||||
attr::mk_word_item(Ident::new(w, sp))
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ use crate::module::{parse_external_mod, push_directory, Directory, DirectoryOwne
|
||||
use crate::placeholders::{placeholder, PlaceholderExpander};
|
||||
use crate::proc_macro::collect_derives;
|
||||
|
||||
use rustc_ast::ast::{self, AttrItem, Block, Ident, LitKind, NodeId, PatKind, Path};
|
||||
use rustc_ast::ast::{self, AttrItem, Block, LitKind, NodeId, PatKind, Path};
|
||||
use rustc_ast::ast::{ItemKind, MacArgs, MacStmtStyle, StmtKind};
|
||||
use rustc_ast::mut_visit::*;
|
||||
use rustc_ast::ptr::P;
|
||||
@ -25,7 +25,7 @@ use rustc_session::lint::builtin::UNUSED_DOC_COMMENTS;
|
||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||
use rustc_session::parse::{feature_err, ParseSess};
|
||||
use rustc_span::source_map::respan;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::symbol::{sym, Ident, Symbol};
|
||||
use rustc_span::{FileName, Span, DUMMY_SP};
|
||||
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
@ -9,10 +9,10 @@ crate mod macro_rules;
|
||||
crate mod quoted;
|
||||
crate mod transcribe;
|
||||
|
||||
use rustc_ast::ast;
|
||||
use rustc_ast::token::{self, Token, TokenKind};
|
||||
use rustc_ast::tokenstream::DelimSpan;
|
||||
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::Span;
|
||||
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
@ -82,13 +82,9 @@ enum TokenTree {
|
||||
/// A kleene-style repetition sequence
|
||||
Sequence(DelimSpan, Lrc<SequenceRepetition>),
|
||||
/// e.g., `$var`
|
||||
MetaVar(Span, ast::Ident),
|
||||
MetaVar(Span, Ident),
|
||||
/// e.g., `$var:expr`. This is only used in the left hand side of MBE macros.
|
||||
MetaVarDecl(
|
||||
Span,
|
||||
ast::Ident, /* name to bind */
|
||||
ast::Ident, /* kind of nonterminal */
|
||||
),
|
||||
MetaVarDecl(Span, Ident /* name to bind */, Ident /* kind of nonterminal */),
|
||||
}
|
||||
|
||||
impl TokenTree {
|
||||
|
@ -76,7 +76,6 @@ use TokenTreeOrTokenTreeSlice::*;
|
||||
|
||||
use crate::mbe::{self, TokenTree};
|
||||
|
||||
use rustc_ast::ast::Name;
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::token::{self, DocComment, Nonterminal, Token};
|
||||
use rustc_ast_pretty::pprust;
|
||||
@ -766,7 +765,7 @@ fn get_macro_ident(token: &Token) -> Option<(Ident, bool)> {
|
||||
///
|
||||
/// Returning `false` is a *stability guarantee* that such a matcher will *never* begin with that
|
||||
/// token. Be conservative (return true) if not sure.
|
||||
fn may_begin_with(token: &Token, name: Name) -> bool {
|
||||
fn may_begin_with(token: &Token, name: Symbol) -> bool {
|
||||
/// Checks whether the non-terminal may contain a single (non-keyword) identifier.
|
||||
fn may_be_ident(nt: &token::Nonterminal) -> bool {
|
||||
match *nt {
|
||||
|
@ -21,7 +21,7 @@ use rustc_parse::parser::Parser;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::hygiene::Transparency;
|
||||
use rustc_span::symbol::{kw, sym, MacroRulesNormalizedIdent, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, MacroRulesNormalizedIdent, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
use log::debug;
|
||||
@ -39,7 +39,7 @@ crate struct ParserAnyMacro<'a> {
|
||||
/// Span of the expansion site of the macro this parser is for
|
||||
site_span: Span,
|
||||
/// The ident of the macro we're parsing
|
||||
macro_ident: ast::Ident,
|
||||
macro_ident: Ident,
|
||||
arm_span: Span,
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ fn emit_frag_parse_err(
|
||||
parser: &Parser<'_>,
|
||||
orig_parser: &mut Parser<'_>,
|
||||
site_span: Span,
|
||||
macro_ident: ast::Ident,
|
||||
macro_ident: Ident,
|
||||
arm_span: Span,
|
||||
kind: AstFragmentKind,
|
||||
) {
|
||||
@ -166,7 +166,7 @@ impl<'a> ParserAnyMacro<'a> {
|
||||
}
|
||||
|
||||
struct MacroRulesMacroExpander {
|
||||
name: ast::Ident,
|
||||
name: Ident,
|
||||
span: Span,
|
||||
transparency: Transparency,
|
||||
lhses: Vec<mbe::TokenTree>,
|
||||
@ -215,7 +215,7 @@ fn generic_extension<'cx>(
|
||||
cx: &'cx mut ExtCtxt<'_>,
|
||||
sp: Span,
|
||||
def_span: Span,
|
||||
name: ast::Ident,
|
||||
name: Ident,
|
||||
transparency: Transparency,
|
||||
arg: TokenStream,
|
||||
lhses: &[mbe::TokenTree],
|
||||
@ -400,9 +400,9 @@ pub fn compile_declarative_macro(
|
||||
};
|
||||
|
||||
let diag = &sess.span_diagnostic;
|
||||
let lhs_nm = ast::Ident::new(sym::lhs, def.span);
|
||||
let rhs_nm = ast::Ident::new(sym::rhs, def.span);
|
||||
let tt_spec = ast::Ident::new(sym::tt, def.span);
|
||||
let lhs_nm = Ident::new(sym::lhs, def.span);
|
||||
let rhs_nm = Ident::new(sym::rhs, def.span);
|
||||
let tt_spec = Ident::new(sym::tt, def.span);
|
||||
|
||||
// Parse the macro_rules! invocation
|
||||
let (macro_rules, body) = match &def.kind {
|
||||
|
@ -1,12 +1,11 @@
|
||||
use crate::mbe::macro_parser;
|
||||
use crate::mbe::{Delimited, KleeneOp, KleeneToken, SequenceRepetition, TokenTree};
|
||||
|
||||
use rustc_ast::ast;
|
||||
use rustc_ast::token::{self, Token};
|
||||
use rustc_ast::tokenstream;
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::symbol::{kw, Ident};
|
||||
|
||||
use rustc_span::Span;
|
||||
|
||||
@ -67,7 +66,7 @@ pub(super) fn parse(
|
||||
tree => tree.as_ref().map(tokenstream::TokenTree::span).unwrap_or(start_sp),
|
||||
};
|
||||
sess.missing_fragment_specifiers.borrow_mut().insert(span);
|
||||
result.push(TokenTree::MetaVarDecl(span, ident, ast::Ident::invalid()));
|
||||
result.push(TokenTree::MetaVarDecl(span, ident, Ident::invalid()));
|
||||
}
|
||||
|
||||
// Not a metavar or no matchers allowed, so just return the tree
|
||||
@ -145,7 +144,7 @@ fn parse_tree(
|
||||
let msg =
|
||||
format!("expected identifier, found `{}`", pprust::token_to_string(&token),);
|
||||
sess.span_diagnostic.span_err(token.span, &msg);
|
||||
TokenTree::MetaVar(token.span, ast::Ident::invalid())
|
||||
TokenTree::MetaVar(token.span, Ident::invalid())
|
||||
}
|
||||
|
||||
// There are no more tokens. Just return the `$` we already have.
|
||||
|
@ -1,10 +1,10 @@
|
||||
use rustc_ast::ast::{self, Attribute, Ident, Mod};
|
||||
use rustc_ast::ast::{Attribute, Mod};
|
||||
use rustc_ast::{attr, token};
|
||||
use rustc_errors::{struct_span_err, PResult};
|
||||
use rustc_parse::new_parser_from_file;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::source_map::{FileName, Span};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::symbol::{sym, Ident};
|
||||
|
||||
use std::path::{self, Path, PathBuf};
|
||||
|
||||
@ -18,7 +18,7 @@ pub struct Directory {
|
||||
pub enum DirectoryOwnership {
|
||||
Owned {
|
||||
// None if `mod.rs`, `Some("foo")` if we're in `foo.rs`.
|
||||
relative: Option<ast::Ident>,
|
||||
relative: Option<Ident>,
|
||||
},
|
||||
UnownedViaBlock,
|
||||
UnownedViaMod,
|
||||
@ -40,7 +40,7 @@ pub struct ModulePathSuccess {
|
||||
|
||||
crate fn parse_external_mod(
|
||||
sess: &ParseSess,
|
||||
id: ast::Ident,
|
||||
id: Ident,
|
||||
span: Span, // The span to blame on errors.
|
||||
Directory { mut ownership, path }: Directory,
|
||||
attrs: &mut Vec<Attribute>,
|
||||
@ -125,7 +125,7 @@ crate fn push_directory(
|
||||
|
||||
fn submod_path<'a>(
|
||||
sess: &'a ParseSess,
|
||||
id: ast::Ident,
|
||||
id: Ident,
|
||||
span: Span,
|
||||
attrs: &[Attribute],
|
||||
ownership: DirectoryOwnership,
|
||||
@ -236,9 +236,9 @@ pub fn submod_path_from_attr(attrs: &[Attribute], dir_path: &Path) -> Option<Pat
|
||||
// Public for rustfmt usage.
|
||||
pub fn default_submod_path<'a>(
|
||||
sess: &'a ParseSess,
|
||||
id: ast::Ident,
|
||||
id: Ident,
|
||||
span: Span,
|
||||
relative: Option<ast::Ident>,
|
||||
relative: Option<Ident>,
|
||||
dir_path: &Path,
|
||||
) -> ModulePath<'a> {
|
||||
// If we're in a foo.rs file instead of a mod.rs file,
|
||||
|
@ -1,9 +1,10 @@
|
||||
use crate::tests::{matches_codepattern, string_to_crate};
|
||||
|
||||
use rustc_ast::ast::{self, Ident};
|
||||
use rustc_ast::ast;
|
||||
use rustc_ast::mut_visit::{self, MutVisitor};
|
||||
use rustc_ast::with_default_globals;
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_span::symbol::Ident;
|
||||
|
||||
// This version doesn't care about getting comments or doc-strings in.
|
||||
fn fake_print_crate(s: &mut pprust::State<'_>, krate: &ast::Crate) {
|
||||
@ -14,7 +15,7 @@ fn fake_print_crate(s: &mut pprust::State<'_>, krate: &ast::Crate) {
|
||||
struct ToZzIdentMutVisitor;
|
||||
|
||||
impl MutVisitor for ToZzIdentMutVisitor {
|
||||
fn visit_ident(&mut self, ident: &mut ast::Ident) {
|
||||
fn visit_ident(&mut self, ident: &mut Ident) {
|
||||
*ident = Ident::from_str("zz");
|
||||
}
|
||||
fn visit_mac(&mut self, mac: &mut ast::MacCall) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::tests::{matches_codepattern, string_to_stream, with_error_checking_parse};
|
||||
|
||||
use rustc_ast::ast::{self, Name, PatKind};
|
||||
use rustc_ast::ast::{self, PatKind};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::token::{self, Token};
|
||||
use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree};
|
||||
@ -100,12 +100,12 @@ fn string_to_tts_1() {
|
||||
|
||||
let expected = TokenStream::new(vec![
|
||||
TokenTree::token(token::Ident(kw::Fn, false), sp(0, 2)).into(),
|
||||
TokenTree::token(token::Ident(Name::intern("a"), false), sp(3, 4)).into(),
|
||||
TokenTree::token(token::Ident(Symbol::intern("a"), false), sp(3, 4)).into(),
|
||||
TokenTree::Delimited(
|
||||
DelimSpan::from_pair(sp(5, 6), sp(13, 14)),
|
||||
token::DelimToken::Paren,
|
||||
TokenStream::new(vec![
|
||||
TokenTree::token(token::Ident(Name::intern("b"), false), sp(6, 7)).into(),
|
||||
TokenTree::token(token::Ident(Symbol::intern("b"), false), sp(6, 7)).into(),
|
||||
TokenTree::token(token::Colon, sp(8, 9)).into(),
|
||||
TokenTree::token(token::Ident(sym::i32, false), sp(10, 13)).into(),
|
||||
])
|
||||
@ -116,7 +116,7 @@ fn string_to_tts_1() {
|
||||
DelimSpan::from_pair(sp(15, 16), sp(20, 21)),
|
||||
token::DelimToken::Brace,
|
||||
TokenStream::new(vec![
|
||||
TokenTree::token(token::Ident(Name::intern("b"), false), sp(17, 18)).into(),
|
||||
TokenTree::token(token::Ident(Symbol::intern("b"), false), sp(17, 18)).into(),
|
||||
TokenTree::token(token::Semi, sp(18, 19)).into(),
|
||||
])
|
||||
.into(),
|
||||
|
@ -5,6 +5,7 @@ use rustc_ast::ast;
|
||||
use rustc_ast::mut_visit::*;
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_span::source_map::{dummy_spanned, DUMMY_SP};
|
||||
use rustc_span::symbol::Ident;
|
||||
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
@ -23,7 +24,7 @@ pub fn placeholder(
|
||||
}
|
||||
}
|
||||
|
||||
let ident = ast::Ident::invalid();
|
||||
let ident = Ident::invalid();
|
||||
let attrs = Vec::new();
|
||||
let vis = vis.unwrap_or_else(|| dummy_spanned(ast::VisibilityKind::Inherited));
|
||||
let span = DUMMY_SP;
|
||||
|
@ -10,7 +10,7 @@ use rustc_errors::Diagnostic;
|
||||
use rustc_parse::lexer::nfc_normalize;
|
||||
use rustc_parse::{nt_to_tokenstream, parse_stream_from_source_str};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{self, kw, sym, Symbol};
|
||||
use rustc_span::{BytePos, FileName, MultiSpan, Pos, SourceFile, Span};
|
||||
|
||||
use pm::bridge::{server, TokenTree};
|
||||
@ -143,7 +143,7 @@ impl FromInternal<(TreeAndJoint, &'_ ParseSess, &'_ mut Vec<Self>)>
|
||||
Ident(name, false) if name == kw::DollarCrate => tt!(Ident::dollar_crate()),
|
||||
Ident(name, is_raw) => tt!(Ident::new(sess, name, is_raw)),
|
||||
Lifetime(name) => {
|
||||
let ident = ast::Ident::new(name, span).without_first_quote();
|
||||
let ident = symbol::Ident::new(name, span).without_first_quote();
|
||||
stack.push(tt!(Ident::new(sess, ident.name, false)));
|
||||
tt!(Punct::new('\'', true))
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
use crate::tests::string_to_stream;
|
||||
|
||||
use rustc_ast::ast::Name;
|
||||
use rustc_ast::token;
|
||||
use rustc_ast::tokenstream::{TokenStream, TokenStreamBuilder, TokenTree};
|
||||
use rustc_ast::with_default_globals;
|
||||
use rustc_span::{BytePos, Span};
|
||||
use rustc_span::{BytePos, Span, Symbol};
|
||||
use smallvec::smallvec;
|
||||
|
||||
fn string_to_ts(string: &str) -> TokenStream {
|
||||
@ -87,7 +86,7 @@ fn test_is_empty() {
|
||||
with_default_globals(|| {
|
||||
let test0: TokenStream = Vec::<TokenTree>::new().into_iter().collect();
|
||||
let test1: TokenStream =
|
||||
TokenTree::token(token::Ident(Name::intern("a"), false), sp(0, 1)).into();
|
||||
TokenTree::token(token::Ident(Symbol::intern("a"), false), sp(0, 1)).into();
|
||||
let test2 = string_to_ts("foo(bar::baz)");
|
||||
|
||||
assert_eq!(test0.is_empty(), true);
|
||||
|
@ -3,7 +3,7 @@ use crate::def_id::DefId;
|
||||
crate use crate::hir_id::HirId;
|
||||
use crate::itemlikevisit;
|
||||
|
||||
use rustc_ast::ast::{self, CrateSugar, Ident, LlvmAsmDialect, Name};
|
||||
use rustc_ast::ast::{self, CrateSugar, LlvmAsmDialect};
|
||||
use rustc_ast::ast::{AttrVec, Attribute, FloatTy, IntTy, Label, LitKind, StrStyle, UintTy};
|
||||
pub use rustc_ast::ast::{BorrowKind, ImplPolarity, IsAuto};
|
||||
pub use rustc_ast::ast::{CaptureBy, Movability, Mutability};
|
||||
@ -13,7 +13,7 @@ use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::sync::{par_for_each_in, Send, Sync};
|
||||
use rustc_macros::HashStable_Generic;
|
||||
use rustc_span::source_map::{SourceMap, Spanned};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::{MultiSpan, Span, DUMMY_SP};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
@ -2443,7 +2443,7 @@ pub enum ItemKind<'hir> {
|
||||
/// An `extern crate` item, with optional *original* crate name if the crate was renamed.
|
||||
///
|
||||
/// E.g., `extern crate foo` or `extern crate foo_bar as foo`.
|
||||
ExternCrate(Option<Name>),
|
||||
ExternCrate(Option<Symbol>),
|
||||
|
||||
/// `use foo::bar::*;` or `use foo::bar::baz as quux;`
|
||||
///
|
||||
@ -2611,7 +2611,7 @@ pub type TraitMap<ID = HirId> = NodeMap<Vec<TraitCandidate<ID>>>;
|
||||
|
||||
// Map from the NodeId of a glob import to a list of items which are actually
|
||||
// imported.
|
||||
pub type GlobMap = NodeMap<FxHashSet<Name>>;
|
||||
pub type GlobMap = NodeMap<FxHashSet<Symbol>>;
|
||||
|
||||
#[derive(Copy, Clone, Debug, HashStable_Generic)]
|
||||
pub enum Node<'hir> {
|
||||
|
@ -34,8 +34,9 @@
|
||||
use crate::hir::*;
|
||||
use crate::hir_id::CRATE_HIR_ID;
|
||||
use crate::itemlikevisit::{ItemLikeVisitor, ParItemLikeVisitor};
|
||||
use rustc_ast::ast::{Attribute, Ident, Label, Name};
|
||||
use rustc_ast::ast::{Attribute, Label};
|
||||
use rustc_ast::walk_list;
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
pub struct DeepVisitor<'v, V> {
|
||||
@ -317,7 +318,7 @@ pub trait Visitor<'v>: Sized {
|
||||
fn visit_id(&mut self, _hir_id: HirId) {
|
||||
// Nothing to do.
|
||||
}
|
||||
fn visit_name(&mut self, _span: Span, _name: Name) {
|
||||
fn visit_name(&mut self, _span: Span, _name: Symbol) {
|
||||
// Nothing to do.
|
||||
}
|
||||
fn visit_ident(&mut self, ident: Ident) {
|
||||
@ -395,7 +396,7 @@ pub trait Visitor<'v>: Sized {
|
||||
fn visit_variant_data(
|
||||
&mut self,
|
||||
s: &'v VariantData<'v>,
|
||||
_: Name,
|
||||
_: Symbol,
|
||||
_: &'v Generics<'v>,
|
||||
_parent_id: HirId,
|
||||
_: Span,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::def::{CtorOf, DefKind, Res};
|
||||
use crate::def_id::DefId;
|
||||
use crate::hir::{self, HirId, PatKind};
|
||||
use rustc_ast::ast;
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::iter::{Enumerate, ExactSizeIterator};
|
||||
@ -79,7 +79,7 @@ impl hir::Pat<'_> {
|
||||
|
||||
/// Call `f` on every "binding" in a pattern, e.g., on `a` in
|
||||
/// `match foo() { Some(a) => (), None => () }`
|
||||
pub fn each_binding(&self, mut f: impl FnMut(hir::BindingAnnotation, HirId, Span, ast::Ident)) {
|
||||
pub fn each_binding(&self, mut f: impl FnMut(hir::BindingAnnotation, HirId, Span, Ident)) {
|
||||
self.walk_always(|p| {
|
||||
if let PatKind::Binding(binding_mode, _, ident, _) = p.kind {
|
||||
f(binding_mode, p.hir_id, p.span, ident);
|
||||
@ -93,7 +93,7 @@ impl hir::Pat<'_> {
|
||||
/// When encountering an or-pattern `p_0 | ... | p_n` only `p_0` will be visited.
|
||||
pub fn each_binding_or_first(
|
||||
&self,
|
||||
f: &mut impl FnMut(hir::BindingAnnotation, HirId, Span, ast::Ident),
|
||||
f: &mut impl FnMut(hir::BindingAnnotation, HirId, Span, Ident),
|
||||
) {
|
||||
self.walk(|p| match &p.kind {
|
||||
PatKind::Or(ps) => {
|
||||
@ -140,7 +140,7 @@ impl hir::Pat<'_> {
|
||||
satisfies
|
||||
}
|
||||
|
||||
pub fn simple_ident(&self) -> Option<ast::Ident> {
|
||||
pub fn simple_ident(&self) -> Option<Ident> {
|
||||
match self.kind {
|
||||
PatKind::Binding(
|
||||
hir::BindingAnnotation::Unannotated | hir::BindingAnnotation::Mutable,
|
||||
|
@ -10,7 +10,7 @@ use rustc_hir as hir;
|
||||
use rustc_hir::{GenericArg, GenericParam, GenericParamKind, Node};
|
||||
use rustc_hir::{GenericBound, PatKind, RangeEnd, TraitBoundModifier};
|
||||
use rustc_span::source_map::{SourceMap, Spanned};
|
||||
use rustc_span::symbol::{kw, IdentPrinter};
|
||||
use rustc_span::symbol::{kw, Ident, IdentPrinter, Symbol};
|
||||
use rustc_span::{self, BytePos, FileName};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
@ -23,7 +23,7 @@ pub fn id_to_string(map: &dyn rustc_hir::intravisit::Map<'_>, hir_id: hir::HirId
|
||||
}
|
||||
|
||||
pub enum AnnNode<'a> {
|
||||
Name(&'a ast::Name),
|
||||
Name(&'a Symbol),
|
||||
Block(&'a hir::Block<'a>),
|
||||
Item(&'a hir::Item<'a>),
|
||||
SubItem(hir::HirId),
|
||||
@ -145,7 +145,7 @@ impl<'a> PrintState<'a> for State<'a> {
|
||||
&mut self.comments
|
||||
}
|
||||
|
||||
fn print_ident(&mut self, ident: ast::Ident) {
|
||||
fn print_ident(&mut self, ident: Ident) {
|
||||
self.s.word(IdentPrinter::for_ast_ident(ident, ident.is_raw_guess()).to_string());
|
||||
self.ann.post(self, AnnNode::Name(&ident.name))
|
||||
}
|
||||
@ -453,7 +453,7 @@ impl<'a> State<'a> {
|
||||
|
||||
fn print_associated_const(
|
||||
&mut self,
|
||||
ident: ast::Ident,
|
||||
ident: Ident,
|
||||
ty: &hir::Ty<'_>,
|
||||
default: Option<hir::BodyId>,
|
||||
vis: &hir::Visibility<'_>,
|
||||
@ -473,7 +473,7 @@ impl<'a> State<'a> {
|
||||
|
||||
fn print_associated_type(
|
||||
&mut self,
|
||||
ident: ast::Ident,
|
||||
ident: Ident,
|
||||
generics: &hir::Generics<'_>,
|
||||
bounds: Option<hir::GenericBounds<'_>>,
|
||||
ty: Option<&hir::Ty<'_>>,
|
||||
@ -768,7 +768,7 @@ impl<'a> State<'a> {
|
||||
&mut self,
|
||||
enum_definition: &hir::EnumDef<'_>,
|
||||
generics: &hir::Generics<'_>,
|
||||
name: ast::Name,
|
||||
name: Symbol,
|
||||
span: rustc_span::Span,
|
||||
visibility: &hir::Visibility<'_>,
|
||||
) {
|
||||
@ -827,7 +827,7 @@ impl<'a> State<'a> {
|
||||
&mut self,
|
||||
struct_def: &hir::VariantData<'_>,
|
||||
generics: &hir::Generics<'_>,
|
||||
name: ast::Name,
|
||||
name: Symbol,
|
||||
span: rustc_span::Span,
|
||||
print_finalizer: bool,
|
||||
) {
|
||||
@ -886,11 +886,11 @@ impl<'a> State<'a> {
|
||||
}
|
||||
pub fn print_method_sig(
|
||||
&mut self,
|
||||
ident: ast::Ident,
|
||||
ident: Ident,
|
||||
m: &hir::FnSig<'_>,
|
||||
generics: &hir::Generics<'_>,
|
||||
vis: &hir::Visibility<'_>,
|
||||
arg_names: &[ast::Ident],
|
||||
arg_names: &[Ident],
|
||||
body_id: Option<hir::BodyId>,
|
||||
) {
|
||||
self.print_fn(&m.decl, m.header, Some(ident.name), generics, vis, arg_names, body_id)
|
||||
@ -1297,7 +1297,7 @@ impl<'a> State<'a> {
|
||||
self.bopen();
|
||||
|
||||
// Print `let _t = $init;`:
|
||||
let temp = ast::Ident::from_str("_t");
|
||||
let temp = Ident::from_str("_t");
|
||||
self.print_local(Some(init), |this| this.print_ident(temp));
|
||||
self.s.word(";");
|
||||
|
||||
@ -1496,8 +1496,8 @@ impl<'a> State<'a> {
|
||||
self.s.word(i.to_string())
|
||||
}
|
||||
|
||||
pub fn print_name(&mut self, name: ast::Name) {
|
||||
self.print_ident(ast::Ident::with_dummy_span(name))
|
||||
pub fn print_name(&mut self, name: Symbol) {
|
||||
self.print_ident(Ident::with_dummy_span(name))
|
||||
}
|
||||
|
||||
pub fn print_for_decl(&mut self, loc: &hir::Local<'_>, coll: &hir::Expr<'_>) {
|
||||
@ -1888,10 +1888,10 @@ impl<'a> State<'a> {
|
||||
&mut self,
|
||||
decl: &hir::FnDecl<'_>,
|
||||
header: hir::FnHeader,
|
||||
name: Option<ast::Name>,
|
||||
name: Option<Symbol>,
|
||||
generics: &hir::Generics<'_>,
|
||||
vis: &hir::Visibility<'_>,
|
||||
arg_names: &[ast::Ident],
|
||||
arg_names: &[Ident],
|
||||
body_id: Option<hir::BodyId>,
|
||||
) {
|
||||
self.print_fn_header_info(header, vis);
|
||||
@ -2154,9 +2154,9 @@ impl<'a> State<'a> {
|
||||
abi: Abi,
|
||||
unsafety: hir::Unsafety,
|
||||
decl: &hir::FnDecl<'_>,
|
||||
name: Option<ast::Name>,
|
||||
name: Option<Symbol>,
|
||||
generic_params: &[hir::GenericParam<'_>],
|
||||
arg_names: &[ast::Ident],
|
||||
arg_names: &[Ident],
|
||||
) {
|
||||
self.ibox(INDENT_UNIT);
|
||||
if !generic_params.is_empty() {
|
||||
|
@ -44,7 +44,7 @@ use rustc_middle::dep_graph::debug::{DepNodeFilter, EdgeFilter};
|
||||
use rustc_middle::dep_graph::{DepGraphQuery, DepKind, DepNode, DepNodeExt};
|
||||
use rustc_middle::hir::map::Map;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::env;
|
||||
@ -89,7 +89,7 @@ pub fn assert_dep_graph(tcx: TyCtxt<'_>) {
|
||||
}
|
||||
|
||||
type Sources = Vec<(Span, DefId, DepNode)>;
|
||||
type Targets = Vec<(Span, ast::Name, hir::HirId, DepNode)>;
|
||||
type Targets = Vec<(Span, Symbol, hir::HirId, DepNode)>;
|
||||
|
||||
struct IfThisChanged<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
@ -98,7 +98,7 @@ struct IfThisChanged<'tcx> {
|
||||
}
|
||||
|
||||
impl IfThisChanged<'tcx> {
|
||||
fn argument(&self, attr: &ast::Attribute) -> Option<ast::Name> {
|
||||
fn argument(&self, attr: &ast::Attribute) -> Option<Symbol> {
|
||||
let mut value = None;
|
||||
for list_item in attr.meta_item_list().unwrap_or_default() {
|
||||
match list_item.ident() {
|
||||
|
@ -147,7 +147,7 @@ impl AssertModuleSource<'tcx> {
|
||||
);
|
||||
}
|
||||
|
||||
fn field(&self, attr: &ast::Attribute, name: Symbol) -> ast::Name {
|
||||
fn field(&self, attr: &ast::Attribute, name: Symbol) -> Symbol {
|
||||
for item in attr.meta_item_list().unwrap_or_else(Vec::new) {
|
||||
if item.check_name(name) {
|
||||
if let Some(value) = item.value_str() {
|
||||
|
@ -499,7 +499,7 @@ fn check_config(tcx: TyCtxt<'_>, attr: &Attribute) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
fn expect_associated_value(tcx: TyCtxt<'_>, item: &NestedMetaItem) -> ast::Name {
|
||||
fn expect_associated_value(tcx: TyCtxt<'_>, item: &NestedMetaItem) -> Symbol {
|
||||
if let Some(value) = item.value_str() {
|
||||
value
|
||||
} else {
|
||||
|
@ -10,7 +10,6 @@ pub(crate) use self::undo_log::{InferCtxtUndoLogs, Snapshot, UndoLog};
|
||||
|
||||
use crate::traits::{self, ObligationCause, PredicateObligations, TraitEngine};
|
||||
|
||||
use rustc_ast::ast;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_data_structures::undo_log::Rollback;
|
||||
@ -457,7 +456,7 @@ pub enum SubregionOrigin<'tcx> {
|
||||
/// the containing trait.
|
||||
CompareImplMethodObligation {
|
||||
span: Span,
|
||||
item_name: ast::Name,
|
||||
item_name: Symbol,
|
||||
impl_item_def_id: DefId,
|
||||
trait_item_def_id: DefId,
|
||||
},
|
||||
@ -519,7 +518,7 @@ pub enum RegionVariableOrigin {
|
||||
|
||||
UpvarRegion(ty::UpvarId, Span),
|
||||
|
||||
BoundRegionInCoherence(ast::Name),
|
||||
BoundRegionInCoherence(Symbol),
|
||||
|
||||
/// This origin is used for the inference variables that we create
|
||||
/// during NLL region processing.
|
||||
|
@ -1,12 +1,12 @@
|
||||
use super::ObjectSafetyViolation;
|
||||
|
||||
use crate::infer::InferCtxt;
|
||||
use rustc_ast::ast;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::Span;
|
||||
use std::fmt;
|
||||
|
||||
@ -14,7 +14,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
pub fn report_extra_impl_obligation(
|
||||
&self,
|
||||
error_span: Span,
|
||||
item_name: ast::Name,
|
||||
item_name: Symbol,
|
||||
_impl_item_def_id: DefId,
|
||||
trait_item_def_id: DefId,
|
||||
requirement: &dyn fmt::Display,
|
||||
|
@ -41,7 +41,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_session::lint::FutureIncompatibleInfo;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::{BytePos, Span};
|
||||
use rustc_target::abi::VariantIdx;
|
||||
use rustc_trait_selection::traits::misc::can_type_implement_copy;
|
||||
@ -1428,7 +1428,7 @@ impl KeywordIdents {
|
||||
&mut self,
|
||||
cx: &EarlyContext<'_>,
|
||||
UnderMacro(under_macro): UnderMacro,
|
||||
ident: ast::Ident,
|
||||
ident: Ident,
|
||||
) {
|
||||
let next_edition = match cx.sess.edition() {
|
||||
Edition::Edition2015 => {
|
||||
@ -1482,7 +1482,7 @@ impl EarlyLintPass for KeywordIdents {
|
||||
fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &ast::MacCall) {
|
||||
self.check_tokens(cx, mac.args.inner_tokens());
|
||||
}
|
||||
fn check_ident(&mut self, cx: &EarlyContext<'_>, ident: ast::Ident) {
|
||||
fn check_ident(&mut self, cx: &EarlyContext<'_>, ident: Ident) {
|
||||
self.check_ident_token(cx, UnderMacro(false), ident);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ use rustc_ast::ast;
|
||||
use rustc_ast::visit as ast_visit;
|
||||
use rustc_session::lint::{BufferedEarlyLint, LintBuffer, LintPass};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::Span;
|
||||
|
||||
use log::debug;
|
||||
@ -159,7 +160,7 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
|
||||
ast_visit::walk_ty(self, t);
|
||||
}
|
||||
|
||||
fn visit_ident(&mut self, ident: ast::Ident) {
|
||||
fn visit_ident(&mut self, ident: Ident) {
|
||||
run_early_pass!(self, check_ident, ident);
|
||||
}
|
||||
|
||||
|
@ -2,13 +2,13 @@
|
||||
//! Clippy.
|
||||
|
||||
use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext};
|
||||
use rustc_ast::ast::{Ident, Item, ItemKind};
|
||||
use rustc_ast::ast::{Item, ItemKind};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{GenericArg, HirId, MutTy, Mutability, Path, PathSegment, QPath, Ty, TyKind};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint, impl_lint_pass};
|
||||
use rustc_span::hygiene::{ExpnKind, MacroKind};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::symbol::{sym, Ident, Symbol};
|
||||
|
||||
declare_tool_lint! {
|
||||
pub rustc::DEFAULT_HASH_TYPES,
|
||||
|
@ -25,6 +25,7 @@ use rustc_hir::intravisit::Visitor;
|
||||
use rustc_middle::hir::map::Map;
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_session::lint::LintPass;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::Span;
|
||||
|
||||
use log::debug;
|
||||
@ -192,7 +193,7 @@ impl<'a, 'tcx, T: LateLintPass<'a, 'tcx>> hir_visit::Visitor<'tcx>
|
||||
fn visit_variant_data(
|
||||
&mut self,
|
||||
s: &'tcx hir::VariantData<'tcx>,
|
||||
_: ast::Name,
|
||||
_: Symbol,
|
||||
_: &'tcx hir::Generics<'tcx>,
|
||||
_: hir::HirId,
|
||||
_: Span,
|
||||
@ -227,7 +228,7 @@ impl<'a, 'tcx, T: LateLintPass<'a, 'tcx>> hir_visit::Visitor<'tcx>
|
||||
hir_visit::walk_ty(self, t);
|
||||
}
|
||||
|
||||
fn visit_name(&mut self, sp: Span, name: ast::Name) {
|
||||
fn visit_name(&mut self, sp: Span, name: Symbol) {
|
||||
lint_callback!(self, check_name, sp, name);
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,7 @@ use rustc_session::lint::builtin::{
|
||||
INTRA_DOC_LINK_RESOLUTION_FAILURE, INVALID_CODEBLOCK_ATTRIBUTE, MISSING_DOC_CODE_EXAMPLES,
|
||||
PRIVATE_DOC_TESTS,
|
||||
};
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
use array_into_iter::ArrayIntoIter;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{EarlyContext, EarlyLintPass, LintContext};
|
||||
use rustc_ast::ast;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_span::symbol::SymbolStr;
|
||||
use rustc_span::symbol::{Ident, SymbolStr};
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::ops::Deref;
|
||||
|
||||
@ -155,7 +155,7 @@ impl EarlyLintPass for NonAsciiIdents {
|
||||
.or_insert((symbol_str, sp));
|
||||
}
|
||||
}
|
||||
fn check_ident(&mut self, cx: &EarlyContext<'_>, ident: ast::Ident) {
|
||||
fn check_ident(&mut self, cx: &EarlyContext<'_>, ident: Ident) {
|
||||
use unicode_security::GeneralSecurityProfile;
|
||||
let name_str = ident.name.as_str();
|
||||
if name_str.is_ascii() {
|
||||
|
@ -5,6 +5,7 @@ use rustc_data_structures::sync;
|
||||
use rustc_hir as hir;
|
||||
use rustc_session::lint::builtin::HardwiredLints;
|
||||
use rustc_session::lint::LintPass;
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
#[macro_export]
|
||||
@ -14,7 +15,7 @@ macro_rules! late_lint_methods {
|
||||
fn check_param(a: &$hir hir::Param<$hir>);
|
||||
fn check_body(a: &$hir hir::Body<$hir>);
|
||||
fn check_body_post(a: &$hir hir::Body<$hir>);
|
||||
fn check_name(a: Span, b: ast::Name);
|
||||
fn check_name(a: Span, b: Symbol);
|
||||
fn check_crate(a: &$hir hir::Crate<$hir>);
|
||||
fn check_crate_post(a: &$hir hir::Crate<$hir>);
|
||||
fn check_mod(a: &$hir hir::Mod<$hir>, b: Span, c: hir::HirId);
|
||||
@ -155,7 +156,7 @@ macro_rules! early_lint_methods {
|
||||
($macro:path, $args:tt) => (
|
||||
$macro!($args, [
|
||||
fn check_param(a: &ast::Param);
|
||||
fn check_ident(a: ast::Ident);
|
||||
fn check_ident(a: Ident);
|
||||
fn check_crate(a: &ast::Crate);
|
||||
fn check_crate_post(a: &ast::Crate);
|
||||
fn check_mod(a: &ast::Mod, b: Span, c: ast::NodeId);
|
||||
|
@ -4,7 +4,7 @@ use crate::creader::CrateMetadataRef;
|
||||
use crate::rmeta::table::{FixedSizeEncoding, Table};
|
||||
use crate::rmeta::*;
|
||||
|
||||
use rustc_ast::ast::{self, Ident};
|
||||
use rustc_ast::ast;
|
||||
use rustc_attr as attr;
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
@ -33,7 +33,7 @@ use rustc_middle::util::common::record_time;
|
||||
use rustc_serialize::{opaque, Decodable, Decoder, SpecializedDecoder};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::source_map::{respan, Spanned};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::symbol::{sym, Ident, Symbol};
|
||||
use rustc_span::{self, hygiene::MacroKind, BytePos, Pos, Span, DUMMY_SP};
|
||||
|
||||
use log::debug;
|
||||
@ -917,7 +917,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
||||
}
|
||||
|
||||
/// Iterates over all the stability attributes in the given crate.
|
||||
fn get_lib_features(&self, tcx: TyCtxt<'tcx>) -> &'tcx [(ast::Name, Option<ast::Name>)] {
|
||||
fn get_lib_features(&self, tcx: TyCtxt<'tcx>) -> &'tcx [(Symbol, Option<Symbol>)] {
|
||||
// FIXME: For a proc macro crate, not sure whether we should return the "host"
|
||||
// features or an empty Vec. Both don't cause ICEs.
|
||||
tcx.arena.alloc_from_iter(self.root.lib_features.decode(self))
|
||||
@ -1205,7 +1205,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
fn get_struct_field_names(&self, id: DefIndex, sess: &Session) -> Vec<Spanned<ast::Name>> {
|
||||
fn get_struct_field_names(&self, id: DefIndex, sess: &Session) -> Vec<Spanned<Symbol>> {
|
||||
self.root
|
||||
.tables
|
||||
.children
|
||||
@ -1317,7 +1317,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_fn_param_names(&self, tcx: TyCtxt<'tcx>, id: DefIndex) -> &'tcx [ast::Name] {
|
||||
fn get_fn_param_names(&self, tcx: TyCtxt<'tcx>, id: DefIndex) -> &'tcx [Symbol] {
|
||||
let param_names = match self.kind(id) {
|
||||
EntryKind::Fn(data) | EntryKind::ForeignFn(data) => data.decode(self).param_names,
|
||||
EntryKind::AssocFn(data) => data.decode(self).fn_data.param_names,
|
||||
|
@ -21,7 +21,7 @@ use rustc_middle::ty::query::QueryConfig;
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_session::{CrateDisambiguator, Session};
|
||||
use rustc_span::source_map::{self, Span, Spanned};
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use smallvec::SmallVec;
|
||||
@ -419,7 +419,7 @@ impl CStore {
|
||||
.disambiguated_data
|
||||
.data
|
||||
.get_opt_name()
|
||||
.map(ast::Ident::with_dummy_span) // FIXME: cross-crate hygiene
|
||||
.map(Ident::with_dummy_span) // FIXME: cross-crate hygiene
|
||||
.expect("no name in load_macro");
|
||||
|
||||
LoadedMacro::MacroDef(
|
||||
|
@ -2,7 +2,7 @@ use crate::rmeta::table::FixedSizeEncoding;
|
||||
use crate::rmeta::*;
|
||||
|
||||
use log::{debug, trace};
|
||||
use rustc_ast::ast::{self, Ident};
|
||||
use rustc_ast::ast;
|
||||
use rustc_ast::attr;
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
@ -32,7 +32,7 @@ use rustc_middle::ty::{self, SymbolName, Ty, TyCtxt};
|
||||
use rustc_serialize::{opaque, Encodable, Encoder, SpecializedEncoder};
|
||||
use rustc_session::config::CrateType;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::{self, ExternalSource, FileName, SourceFile, Span};
|
||||
use rustc_target::abi::VariantIdx;
|
||||
use std::hash::Hash;
|
||||
@ -989,7 +989,7 @@ impl EncodeContext<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_fn_param_names_for_body(&mut self, body_id: hir::BodyId) -> Lazy<[ast::Name]> {
|
||||
fn encode_fn_param_names_for_body(&mut self, body_id: hir::BodyId) -> Lazy<[Symbol]> {
|
||||
self.tcx.dep_graph.with_ignore(|| {
|
||||
let body = self.tcx.hir().body(body_id);
|
||||
self.lazy(body.params.iter().map(|arg| match arg.pat.kind {
|
||||
@ -999,7 +999,7 @@ impl EncodeContext<'tcx> {
|
||||
})
|
||||
}
|
||||
|
||||
fn encode_fn_param_names(&mut self, param_names: &[ast::Ident]) -> Lazy<[ast::Name]> {
|
||||
fn encode_fn_param_names(&mut self, param_names: &[Ident]) -> Lazy<[Symbol]> {
|
||||
self.lazy(param_names.iter().map(|ident| ident.name))
|
||||
}
|
||||
|
||||
@ -1410,7 +1410,7 @@ impl EncodeContext<'tcx> {
|
||||
self.lazy(deps.iter().map(|&(_, ref dep)| dep))
|
||||
}
|
||||
|
||||
fn encode_lib_features(&mut self) -> Lazy<[(ast::Name, Option<ast::Name>)]> {
|
||||
fn encode_lib_features(&mut self) -> Lazy<[(Symbol, Option<Symbol>)]> {
|
||||
let tcx = self.tcx;
|
||||
let lib_features = tcx.lib_features();
|
||||
self.lazy(lib_features.to_vec())
|
||||
|
@ -215,7 +215,7 @@ crate struct CrateRoot<'tcx> {
|
||||
|
||||
#[derive(RustcEncodable, RustcDecodable)]
|
||||
crate struct CrateDep {
|
||||
pub name: ast::Name,
|
||||
pub name: Symbol,
|
||||
pub hash: Svh,
|
||||
pub host_hash: Option<Svh>,
|
||||
pub kind: DepKind,
|
||||
@ -327,7 +327,7 @@ struct ModData {
|
||||
struct FnData {
|
||||
asyncness: hir::IsAsync,
|
||||
constness: hir::Constness,
|
||||
param_names: Lazy<[ast::Name]>,
|
||||
param_names: Lazy<[Symbol]>,
|
||||
}
|
||||
|
||||
#[derive(RustcEncodable, RustcDecodable)]
|
||||
|
@ -65,7 +65,7 @@ macro_rules! arena_types {
|
||||
[] object_safety_violations: rustc_middle::traits::ObjectSafetyViolation,
|
||||
[] codegen_unit: rustc_middle::mir::mono::CodegenUnit<$tcx>,
|
||||
[] attribute: rustc_ast::ast::Attribute,
|
||||
[] name_set: rustc_data_structures::fx::FxHashSet<rustc_ast::ast::Name>,
|
||||
[] name_set: rustc_data_structures::fx::FxHashSet<rustc_span::symbol::Symbol>,
|
||||
[] hir_id_set: rustc_hir::HirIdSet,
|
||||
|
||||
// Interned types
|
||||
|
@ -1,9 +1,9 @@
|
||||
use crate::ty;
|
||||
|
||||
use rustc_ast::ast;
|
||||
use rustc_hir::def::Res;
|
||||
use rustc_hir::def_id::DefIdMap;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::fmt::Debug;
|
||||
@ -15,7 +15,7 @@ pub type ExportMap<Id> = DefIdMap<Vec<Export<Id>>>;
|
||||
#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable, HashStable)]
|
||||
pub struct Export<Id> {
|
||||
/// The name of the target.
|
||||
pub ident: ast::Ident,
|
||||
pub ident: Ident,
|
||||
/// The resolution of the target.
|
||||
pub res: Res<Id>,
|
||||
/// The span of the target.
|
||||
|
@ -12,10 +12,11 @@
|
||||
//! for the `Code` associated with a particular NodeId.
|
||||
|
||||
use crate::hir::map::Map;
|
||||
use rustc_ast::ast::{Attribute, Ident};
|
||||
use rustc_ast::ast::Attribute;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::intravisit::FnKind;
|
||||
use rustc_hir::{Expr, FnDecl, Node};
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::Span;
|
||||
|
||||
/// An FnLikeNode is a Node that is like a fn, in that it has a decl
|
||||
|
@ -3,7 +3,7 @@ use self::collector::NodeCollector;
|
||||
use crate::hir::{Owner, OwnerNodes};
|
||||
use crate::ty::query::Providers;
|
||||
use crate::ty::TyCtxt;
|
||||
use rustc_ast::ast::{self, Name, NodeId};
|
||||
use rustc_ast::ast::{self, NodeId};
|
||||
use rustc_data_structures::svh::Svh;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
|
||||
@ -14,7 +14,7 @@ use rustc_hir::*;
|
||||
use rustc_index::vec::IndexVec;
|
||||
use rustc_span::hygiene::MacroKind;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::symbol::{kw, Symbol};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
@ -452,7 +452,7 @@ impl<'hir> Map<'hir> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ty_param_name(&self, id: HirId) -> Name {
|
||||
pub fn ty_param_name(&self, id: HirId) -> Symbol {
|
||||
match self.get(id) {
|
||||
Node::Item(&Item { kind: ItemKind::Trait(..) | ItemKind::TraitAlias(..), .. }) => {
|
||||
kw::SelfUpper
|
||||
@ -824,7 +824,7 @@ impl<'hir> Map<'hir> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn opt_name(&self, id: HirId) -> Option<Name> {
|
||||
pub fn opt_name(&self, id: HirId) -> Option<Symbol> {
|
||||
Some(match self.get(id) {
|
||||
Node::Item(i) => i.ident.name,
|
||||
Node::ForeignItem(fi) => fi.ident.name,
|
||||
@ -840,7 +840,7 @@ impl<'hir> Map<'hir> {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn name(&self, id: HirId) -> Name {
|
||||
pub fn name(&self, id: HirId) -> Symbol {
|
||||
match self.opt_name(id) {
|
||||
Some(name) => name,
|
||||
None => bug!("no name for {}", self.node_to_string(id)),
|
||||
@ -952,42 +952,42 @@ impl<'hir> intravisit::Map<'hir> for Map<'hir> {
|
||||
}
|
||||
|
||||
trait Named {
|
||||
fn name(&self) -> Name;
|
||||
fn name(&self) -> Symbol;
|
||||
}
|
||||
|
||||
impl<T: Named> Named for Spanned<T> {
|
||||
fn name(&self) -> Name {
|
||||
fn name(&self) -> Symbol {
|
||||
self.node.name()
|
||||
}
|
||||
}
|
||||
|
||||
impl Named for Item<'_> {
|
||||
fn name(&self) -> Name {
|
||||
fn name(&self) -> Symbol {
|
||||
self.ident.name
|
||||
}
|
||||
}
|
||||
impl Named for ForeignItem<'_> {
|
||||
fn name(&self) -> Name {
|
||||
fn name(&self) -> Symbol {
|
||||
self.ident.name
|
||||
}
|
||||
}
|
||||
impl Named for Variant<'_> {
|
||||
fn name(&self) -> Name {
|
||||
fn name(&self) -> Symbol {
|
||||
self.ident.name
|
||||
}
|
||||
}
|
||||
impl Named for StructField<'_> {
|
||||
fn name(&self) -> Name {
|
||||
fn name(&self) -> Symbol {
|
||||
self.ident.name
|
||||
}
|
||||
}
|
||||
impl Named for TraitItem<'_> {
|
||||
fn name(&self) -> Name {
|
||||
fn name(&self) -> Symbol {
|
||||
self.ident.name
|
||||
}
|
||||
}
|
||||
impl Named for ImplItem<'_> {
|
||||
fn name(&self) -> Name {
|
||||
fn name(&self) -> Symbol {
|
||||
self.ident.name
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ use rustc_target::abi::VariantIdx;
|
||||
|
||||
use polonius_engine::Atom;
|
||||
pub use rustc_ast::ast::Mutability;
|
||||
use rustc_ast::ast::Name;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::graph::dominators::{dominators, Dominators};
|
||||
use rustc_data_structures::graph::{self, GraphSuccessors};
|
||||
@ -968,7 +967,7 @@ impl<'tcx> LocalDecl<'tcx> {
|
||||
/// Debug information pertaining to a user variable.
|
||||
#[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable, TypeFoldable)]
|
||||
pub struct VarDebugInfo<'tcx> {
|
||||
pub name: Name,
|
||||
pub name: Symbol,
|
||||
|
||||
/// Source info of the user variable, including the scope
|
||||
/// within which the variable is visible (to debuginfo)
|
||||
|
@ -640,7 +640,7 @@ rustc_queries! {
|
||||
}
|
||||
|
||||
Other {
|
||||
query fn_arg_names(_: DefId) -> &'tcx [ast::Name] {}
|
||||
query fn_arg_names(_: DefId) -> &'tcx [Symbol] {}
|
||||
/// Gets the rendered value of the specified constant or associated constant.
|
||||
/// Used by rustdoc.
|
||||
query rendered_const(_: DefId) -> String {}
|
||||
@ -1053,7 +1053,7 @@ rustc_queries! {
|
||||
desc { "looking up all possibly unused extern crates" }
|
||||
}
|
||||
query names_imported_by_glob_use(def_id: LocalDefId)
|
||||
-> &'tcx FxHashSet<ast::Name> {
|
||||
-> &'tcx FxHashSet<Symbol> {
|
||||
eval_always
|
||||
desc { |tcx| "names_imported_by_glob_use for `{}`", tcx.def_path_str(def_id.to_def_id()) }
|
||||
}
|
||||
|
@ -13,9 +13,9 @@ use crate::mir::interpret::ErrorHandled;
|
||||
use crate::ty::subst::SubstsRef;
|
||||
use crate::ty::{self, AdtKind, Ty, TyCtxt};
|
||||
|
||||
use rustc_ast::ast;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
@ -207,14 +207,14 @@ pub enum ObligationCauseCode<'tcx> {
|
||||
|
||||
/// Error derived when matching traits/impls; see ObligationCause for more details
|
||||
CompareImplMethodObligation {
|
||||
item_name: ast::Name,
|
||||
item_name: Symbol,
|
||||
impl_item_def_id: DefId,
|
||||
trait_item_def_id: DefId,
|
||||
},
|
||||
|
||||
/// Error derived when matching traits/impls; see ObligationCause for more details
|
||||
CompareImplTypeObligation {
|
||||
item_name: ast::Name,
|
||||
item_name: Symbol,
|
||||
impl_item_def_id: DefId,
|
||||
trait_item_def_id: DefId,
|
||||
},
|
||||
@ -575,10 +575,10 @@ pub enum ObjectSafetyViolation {
|
||||
SupertraitSelf(SmallVec<[Span; 1]>),
|
||||
|
||||
/// Method has something illegal.
|
||||
Method(ast::Name, MethodViolationCode, Span),
|
||||
Method(Symbol, MethodViolationCode, Span),
|
||||
|
||||
/// Associated const.
|
||||
AssocConst(ast::Name, Span),
|
||||
AssocConst(Symbol, Span),
|
||||
}
|
||||
|
||||
impl ObjectSafetyViolation {
|
||||
|
@ -1,11 +1,11 @@
|
||||
use crate::ich::{self, StableHashingContext};
|
||||
use crate::ty::fast_reject::SimplifiedType;
|
||||
use crate::ty::{self, TyCtxt};
|
||||
use rustc_ast::ast::Ident;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_errors::ErrorReported;
|
||||
use rustc_hir::def_id::{DefId, DefIdMap};
|
||||
use rustc_span::symbol::Ident;
|
||||
|
||||
/// A per-trait graph of impls in specialization order. At the moment, this
|
||||
/// graph forms a tree rooted with the trait itself, with all other nodes
|
||||
|
@ -380,7 +380,7 @@ pub struct TypeckTables<'tcx> {
|
||||
|
||||
/// Records the reasons that we picked the kind of each closure;
|
||||
/// not all closures are present in the map.
|
||||
closure_kind_origins: ItemLocalMap<(Span, ast::Name)>,
|
||||
closure_kind_origins: ItemLocalMap<(Span, Symbol)>,
|
||||
|
||||
/// For each fn, records the "liberated" types of its arguments
|
||||
/// and return type. Liberated means that all bound regions
|
||||
@ -625,11 +625,11 @@ impl<'tcx> TypeckTables<'tcx> {
|
||||
self.upvar_capture_map[&upvar_id]
|
||||
}
|
||||
|
||||
pub fn closure_kind_origins(&self) -> LocalTableInContext<'_, (Span, ast::Name)> {
|
||||
pub fn closure_kind_origins(&self) -> LocalTableInContext<'_, (Span, Symbol)> {
|
||||
LocalTableInContext { hir_owner: self.hir_owner, data: &self.closure_kind_origins }
|
||||
}
|
||||
|
||||
pub fn closure_kind_origins_mut(&mut self) -> LocalTableInContextMut<'_, (Span, ast::Name)> {
|
||||
pub fn closure_kind_origins_mut(&mut self) -> LocalTableInContextMut<'_, (Span, Symbol)> {
|
||||
LocalTableInContextMut { hir_owner: self.hir_owner, data: &mut self.closure_kind_origins }
|
||||
}
|
||||
|
||||
@ -945,10 +945,10 @@ pub struct GlobalCtxt<'tcx> {
|
||||
maybe_unused_extern_crates: Vec<(DefId, Span)>,
|
||||
/// A map of glob use to a set of names it actually imports. Currently only
|
||||
/// used in save-analysis.
|
||||
glob_map: FxHashMap<LocalDefId, FxHashSet<ast::Name>>,
|
||||
glob_map: FxHashMap<LocalDefId, FxHashSet<Symbol>>,
|
||||
/// Extern prelude entries. The value is `true` if the entry was introduced
|
||||
/// via `extern crate` item and not `--extern` option or compiler built-in.
|
||||
pub extern_prelude: FxHashMap<ast::Name, bool>,
|
||||
pub extern_prelude: FxHashMap<Symbol, bool>,
|
||||
|
||||
// Internal cache for metadata decoding. No need to track deps on this.
|
||||
pub rcache: Lock<FxHashMap<ty::CReaderCacheKey, Ty<'tcx>>>,
|
||||
|
@ -4,13 +4,14 @@ use crate::mir::{GeneratorLayout, GeneratorSavedLocal};
|
||||
use crate::ty::subst::Subst;
|
||||
use crate::ty::{self, subst::SubstsRef, ReprOptions, Ty, TyCtxt, TypeFoldable};
|
||||
|
||||
use rustc_ast::ast::{self, Ident, IntTy, UintTy};
|
||||
use rustc_ast::ast::{self, IntTy, UintTy};
|
||||
use rustc_attr as attr;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_hir as hir;
|
||||
use rustc_index::bit_set::BitSet;
|
||||
use rustc_index::vec::{Idx, IndexVec};
|
||||
use rustc_session::{DataTypeKind, FieldInfo, SizeKind, VariantInfo};
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
use rustc_span::DUMMY_SP;
|
||||
use rustc_target::abi::call::{
|
||||
ArgAbi, ArgAttribute, ArgAttributes, Conv, FnAbi, PassMode, Reg, RegKind,
|
||||
@ -1628,9 +1629,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
|
||||
let adt_kind = adt_def.adt_kind();
|
||||
let adt_packed = adt_def.repr.pack.is_some();
|
||||
|
||||
let build_variant_info = |n: Option<Ident>,
|
||||
flds: &[ast::Name],
|
||||
layout: TyAndLayout<'tcx>| {
|
||||
let build_variant_info = |n: Option<Ident>, flds: &[Symbol], layout: TyAndLayout<'tcx>| {
|
||||
let mut min_size = Size::ZERO;
|
||||
let field_info: Vec<_> = flds
|
||||
.iter()
|
||||
|
@ -17,7 +17,7 @@ use crate::traits::{self, Reveal};
|
||||
use crate::ty;
|
||||
use crate::ty::subst::{InternalSubsts, Subst, SubstsRef};
|
||||
use crate::ty::util::{Discr, IntTypeExt};
|
||||
use rustc_ast::ast::{self, Ident, Name};
|
||||
use rustc_ast::ast;
|
||||
use rustc_ast::node_id::{NodeId, NodeMap, NodeSet};
|
||||
use rustc_attr as attr;
|
||||
use rustc_data_structures::captures::Captures;
|
||||
@ -38,7 +38,7 @@ use rustc_macros::HashStable;
|
||||
use rustc_serialize::{self, Encodable, Encoder};
|
||||
use rustc_session::DataTypeKind;
|
||||
use rustc_span::hygiene::ExpnId;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::abi::{Align, VariantIdx};
|
||||
|
||||
@ -128,7 +128,7 @@ pub struct ResolverOutputs {
|
||||
pub glob_map: GlobMap,
|
||||
/// Extern prelude entries. The value is `true` if the entry was introduced
|
||||
/// via `extern crate` item and not `--extern` option or compiler built-in.
|
||||
pub extern_prelude: FxHashMap<Name, bool>,
|
||||
pub extern_prelude: FxHashMap<Symbol, bool>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, HashStable)]
|
||||
|
@ -12,7 +12,7 @@ use rustc_hir as hir;
|
||||
use rustc_hir::def::{CtorKind, DefKind, Namespace};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
|
||||
use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
|
||||
use rustc_span::symbol::{kw, Symbol};
|
||||
use rustc_span::symbol::{kw, Ident, Symbol};
|
||||
use rustc_target::abi::{Integer, Size};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
@ -1452,7 +1452,7 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
|
||||
if !self.empty_path {
|
||||
write!(self, "::")?;
|
||||
}
|
||||
if ast::Ident::from_str(&name).is_raw_guess() {
|
||||
if Ident::from_str(&name).is_raw_guess() {
|
||||
write!(self, "r#")?;
|
||||
}
|
||||
write!(self, "{}", name)?;
|
||||
|
@ -4,7 +4,6 @@ use crate::mir::{self, interpret};
|
||||
use crate::ty::codec::{self as ty_codec, TyDecoder, TyEncoder};
|
||||
use crate::ty::context::TyCtxt;
|
||||
use crate::ty::{self, Ty};
|
||||
use rustc_ast::ast::Ident;
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::sync::{HashMapExt, Lock, Lrc, Once};
|
||||
@ -20,6 +19,7 @@ use rustc_serialize::{
|
||||
use rustc_session::{CrateDisambiguator, Session};
|
||||
use rustc_span::hygiene::{ExpnId, SyntaxContext};
|
||||
use rustc_span::source_map::{SourceMap, StableSourceFileId};
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::CachingSourceMapView;
|
||||
use rustc_span::{BytePos, SourceFile, Span, DUMMY_SP};
|
||||
use std::mem;
|
||||
|
@ -16,14 +16,14 @@ use crate::ty::{
|
||||
};
|
||||
use crate::ty::{List, ParamEnv, ParamEnvAnd, TyS};
|
||||
use polonius_engine::Atom;
|
||||
use rustc_ast::ast::{self, Ident};
|
||||
use rustc_ast::ast;
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_errors::ErrorReported;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_index::vec::Idx;
|
||||
use rustc_macros::HashStable;
|
||||
use rustc_span::symbol::{kw, Symbol};
|
||||
use rustc_span::symbol::{kw, Ident, Symbol};
|
||||
use rustc_target::abi::{Size, VariantIdx};
|
||||
use rustc_target::spec::abi;
|
||||
use std::borrow::Cow;
|
||||
|
@ -1,6 +1,5 @@
|
||||
//! This query borrow-checks the MIR to (further) ensure it is not broken.
|
||||
|
||||
use rustc_ast::ast::Name;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::graph::dominators::Dominators;
|
||||
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorReported};
|
||||
@ -22,7 +21,7 @@ use rustc_middle::mir::{Terminator, TerminatorKind};
|
||||
use rustc_middle::ty::query::Providers;
|
||||
use rustc_middle::ty::{self, RegionVid, TyCtxt};
|
||||
use rustc_session::lint::builtin::{MUTABLE_BORROW_RESERVATION_CONFLICT, UNUSED_MUT};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use rustc_span::{Span, Symbol, DUMMY_SP};
|
||||
|
||||
use either::Either;
|
||||
use smallvec::SmallVec;
|
||||
@ -77,7 +76,7 @@ crate use region_infer::RegionInferenceContext;
|
||||
// FIXME(eddyb) perhaps move this somewhere more centrally.
|
||||
#[derive(Debug)]
|
||||
crate struct Upvar {
|
||||
name: Name,
|
||||
name: Symbol,
|
||||
|
||||
var_hir_id: HirId,
|
||||
|
||||
@ -534,7 +533,7 @@ crate struct MirBorrowckCtxt<'cx, 'tcx> {
|
||||
upvars: Vec<Upvar>,
|
||||
|
||||
/// Names of local (user) variables (extracted from `var_debug_info`).
|
||||
local_names: IndexVec<Local, Option<Name>>,
|
||||
local_names: IndexVec<Local, Option<Symbol>>,
|
||||
|
||||
/// Record the region names generated for each region in the given
|
||||
/// MIR def so that we can reuse them later in help/error messages.
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{shim, util};
|
||||
use required_consts::RequiredConstsVisitor;
|
||||
use rustc_ast::ast;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE};
|
||||
@ -11,7 +10,7 @@ use rustc_middle::mir::{traversal, Body, ConstQualifs, MirPhase, Promoted};
|
||||
use rustc_middle::ty::query::Providers;
|
||||
use rustc_middle::ty::steal::Steal;
|
||||
use rustc_middle::ty::{InstanceDef, TyCtxt, TypeFoldable};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::{Span, Symbol};
|
||||
use std::borrow::Cow;
|
||||
|
||||
pub mod add_call_guards;
|
||||
@ -78,7 +77,7 @@ fn mir_keys(tcx: TyCtxt<'_>, krate: CrateNum) -> FxHashSet<LocalDefId> {
|
||||
fn visit_variant_data(
|
||||
&mut self,
|
||||
v: &'tcx hir::VariantData<'tcx>,
|
||||
_: ast::Name,
|
||||
_: Symbol,
|
||||
_: &'tcx hir::Generics<'tcx>,
|
||||
_: hir::HirId,
|
||||
_: Span,
|
||||
|
@ -10,7 +10,6 @@ use crate::build::ForGuard::{self, OutsideGuard, RefWithinGuard};
|
||||
use crate::build::{BlockAnd, BlockAndExtension, Builder};
|
||||
use crate::build::{GuardFrame, GuardFrameLocal, LocalsForNode};
|
||||
use crate::hair::{self, *};
|
||||
use rustc_ast::ast::Name;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_hir::HirId;
|
||||
use rustc_index::bit_set::BitSet;
|
||||
@ -18,6 +17,7 @@ use rustc_middle::middle::region;
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_middle::ty::{self, CanonicalUserTypeAnnotation, Ty};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_target::abi::VariantIdx;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
@ -570,7 +570,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
f: &mut impl FnMut(
|
||||
&mut Self,
|
||||
Mutability,
|
||||
Name,
|
||||
Symbol,
|
||||
BindingMode,
|
||||
HirId,
|
||||
Span,
|
||||
@ -737,7 +737,7 @@ fn traverse_candidate<'pat, 'tcx: 'pat, C, T, I>(
|
||||
struct Binding<'tcx> {
|
||||
span: Span,
|
||||
source: Place<'tcx>,
|
||||
name: Name,
|
||||
name: Symbol,
|
||||
var_id: HirId,
|
||||
var_ty: Ty<'tcx>,
|
||||
mutability: Mutability,
|
||||
@ -1924,7 +1924,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
source_info: SourceInfo,
|
||||
visibility_scope: SourceScope,
|
||||
mutability: Mutability,
|
||||
name: Name,
|
||||
name: Symbol,
|
||||
mode: BindingMode,
|
||||
var_id: HirId,
|
||||
var_ty: Ty<'tcx>,
|
||||
|
@ -24,7 +24,7 @@ use rustc_middle::ty::{self, AdtDef, DefIdTree, Region, Ty, TyCtxt, UserType};
|
||||
use rustc_middle::ty::{
|
||||
CanonicalUserType, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations,
|
||||
};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use rustc_span::{Span, Symbol, DUMMY_SP};
|
||||
use rustc_target::abi::VariantIdx;
|
||||
|
||||
use std::cmp::Ordering;
|
||||
@ -128,7 +128,7 @@ crate enum PatKind<'tcx> {
|
||||
/// `x`, `ref x`, `x @ P`, etc.
|
||||
Binding {
|
||||
mutability: Mutability,
|
||||
name: ast::Name,
|
||||
name: Symbol,
|
||||
mode: BindingMode,
|
||||
var: hir::HirId,
|
||||
ty: Ty<'tcx>,
|
||||
@ -932,7 +932,7 @@ macro_rules! CloneImpls {
|
||||
}
|
||||
|
||||
CloneImpls! { <'tcx>
|
||||
Span, Field, Mutability, ast::Name, hir::HirId, usize, ty::Const<'tcx>,
|
||||
Span, Field, Mutability, Symbol, hir::HirId, usize, ty::Const<'tcx>,
|
||||
Region<'tcx>, Ty<'tcx>, BindingMode, &'tcx AdtDef,
|
||||
SubstsRef<'tcx>, &'tcx GenericArg<'tcx>, UserType<'tcx>,
|
||||
UserTypeProjection, PatTyProj<'tcx>
|
||||
|
@ -1,9 +1,7 @@
|
||||
use super::ty::AllowPlus;
|
||||
use super::{BlockMode, Parser, PathStyle, SemiColonMode, SeqSep, TokenExpectType, TokenType};
|
||||
|
||||
use rustc_ast::ast::{
|
||||
self, BinOpKind, BindingMode, BlockCheckMode, Expr, ExprKind, Ident, Item, Param,
|
||||
};
|
||||
use rustc_ast::ast::{self, BinOpKind, BindingMode, BlockCheckMode, Expr, ExprKind, Item, Param};
|
||||
use rustc_ast::ast::{AttrVec, ItemKind, Mutability, Pat, PatKind, PathSegment, QSelf, Ty, TyKind};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::token::{self, Lit, LitKind, TokenKind};
|
||||
@ -13,7 +11,7 @@ use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::{pluralize, struct_span_err};
|
||||
use rustc_errors::{Applicability, DiagnosticBuilder, Handler, PResult};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::symbol::{kw, Ident};
|
||||
use rustc_span::{MultiSpan, Span, SpanSnippetError, DUMMY_SP};
|
||||
|
||||
use log::{debug, trace};
|
||||
|
@ -4,7 +4,7 @@ use super::{BlockMode, Parser, PathStyle, Restrictions, TokenType};
|
||||
use super::{SemiColonMode, SeqSep, TokenExpectType};
|
||||
use crate::maybe_recover_from_interpolated_ty_qpath;
|
||||
|
||||
use rustc_ast::ast::{self, AttrStyle, AttrVec, CaptureBy, Field, Ident, Lit, UnOp, DUMMY_NODE_ID};
|
||||
use rustc_ast::ast::{self, AttrStyle, AttrVec, CaptureBy, Field, Lit, UnOp, DUMMY_NODE_ID};
|
||||
use rustc_ast::ast::{AnonConst, BinOp, BinOpKind, FnDecl, FnRetTy, MacCall, Param, Ty, TyKind};
|
||||
use rustc_ast::ast::{Arm, Async, BlockCheckMode, Expr, ExprKind, Label, Movability, RangeLimits};
|
||||
use rustc_ast::ptr::P;
|
||||
@ -15,7 +15,7 @@ use rustc_ast::util::parser::{prec_let_scrutinee_needs_par, AssocOp, Fixity};
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_errors::{Applicability, DiagnosticBuilder, PResult};
|
||||
use rustc_span::source_map::{self, Span, Spanned};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use std::mem;
|
||||
|
||||
/// Possibly accepts an `token::Interpolated` expression (a pre-parsed expression
|
||||
|
@ -4,7 +4,7 @@ use super::{FollowedByType, Parser, PathStyle};
|
||||
|
||||
use crate::maybe_whole;
|
||||
|
||||
use rustc_ast::ast::{self, AttrStyle, AttrVec, Attribute, Ident, DUMMY_NODE_ID};
|
||||
use rustc_ast::ast::{self, AttrStyle, AttrVec, Attribute, DUMMY_NODE_ID};
|
||||
use rustc_ast::ast::{AssocItem, AssocItemKind, ForeignItemKind, Item, ItemKind, Mod};
|
||||
use rustc_ast::ast::{Async, Const, Defaultness, IsAuto, Mutability, Unsafe, UseTree, UseTreeKind};
|
||||
use rustc_ast::ast::{BindingMode, Block, FnDecl, FnSig, Param, SelfKind};
|
||||
@ -18,7 +18,7 @@ use rustc_ast_pretty::pprust;
|
||||
use rustc_errors::{struct_span_err, Applicability, PResult, StashKey};
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::source_map::{self, Span};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
|
||||
use log::debug;
|
||||
use std::convert::TryFrom;
|
||||
@ -804,7 +804,7 @@ impl<'a> Parser<'a> {
|
||||
if self.eat_keyword(kw::As) { self.parse_ident_or_underscore().map(Some) } else { Ok(None) }
|
||||
}
|
||||
|
||||
fn parse_ident_or_underscore(&mut self) -> PResult<'a, ast::Ident> {
|
||||
fn parse_ident_or_underscore(&mut self) -> PResult<'a, Ident> {
|
||||
match self.token.ident() {
|
||||
Some((ident @ Ident { name: kw::Underscore, .. }, false)) => {
|
||||
self.bump();
|
||||
@ -834,7 +834,7 @@ impl<'a> Parser<'a> {
|
||||
Ok((item_name, ItemKind::ExternCrate(orig_name)))
|
||||
}
|
||||
|
||||
fn parse_crate_name_with_dashes(&mut self) -> PResult<'a, ast::Ident> {
|
||||
fn parse_crate_name_with_dashes(&mut self) -> PResult<'a, Ident> {
|
||||
let error_msg = "crate name using dashes are not valid in `extern crate` statements";
|
||||
let suggestion_msg = "if the original crate name uses dashes you need to use underscores \
|
||||
in the code";
|
||||
|
@ -14,7 +14,7 @@ use crate::lexer::UnmatchedBrace;
|
||||
|
||||
use log::debug;
|
||||
use rustc_ast::ast::DUMMY_NODE_ID;
|
||||
use rustc_ast::ast::{self, AttrStyle, AttrVec, Const, CrateSugar, Extern, Ident, Unsafe};
|
||||
use rustc_ast::ast::{self, AttrStyle, AttrVec, Const, CrateSugar, Extern, Unsafe};
|
||||
use rustc_ast::ast::{
|
||||
Async, MacArgs, MacDelimiter, Mutability, StrLit, Visibility, VisibilityKind,
|
||||
};
|
||||
@ -26,7 +26,7 @@ use rustc_ast_pretty::pprust;
|
||||
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, FatalError, PResult};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::source_map::{respan, Span, DUMMY_SP};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
|
||||
use std::{cmp, mem, slice};
|
||||
|
||||
@ -424,11 +424,11 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
|
||||
// Public for rustfmt usage.
|
||||
pub fn parse_ident(&mut self) -> PResult<'a, ast::Ident> {
|
||||
pub fn parse_ident(&mut self) -> PResult<'a, Ident> {
|
||||
self.parse_ident_common(true)
|
||||
}
|
||||
|
||||
fn parse_ident_common(&mut self, recover: bool) -> PResult<'a, ast::Ident> {
|
||||
fn parse_ident_common(&mut self, recover: bool) -> PResult<'a, Ident> {
|
||||
match self.token.ident() {
|
||||
Some((ident, is_raw)) => {
|
||||
if !is_raw && ident.is_reserved() {
|
||||
|
@ -1,14 +1,14 @@
|
||||
use super::{Parser, PathStyle};
|
||||
use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole};
|
||||
use rustc_ast::ast::{self, AttrVec, Attribute, FieldPat, MacCall, Pat, PatKind, RangeEnd};
|
||||
use rustc_ast::ast::{BindingMode, Expr, ExprKind, Ident, Mutability, Path, QSelf, RangeSyntax};
|
||||
use rustc_ast::ast::{BindingMode, Expr, ExprKind, Mutability, Path, QSelf, RangeSyntax};
|
||||
use rustc_ast::mut_visit::{noop_visit_mac, noop_visit_pat, MutVisitor};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::token;
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, PResult};
|
||||
use rustc_span::source_map::{respan, Span, Spanned};
|
||||
use rustc_span::symbol::{kw, sym};
|
||||
use rustc_span::symbol::{kw, sym, Ident};
|
||||
|
||||
type Expected = Option<&'static str>;
|
||||
|
||||
|
@ -3,12 +3,12 @@ use super::{Parser, TokenType};
|
||||
use crate::maybe_whole;
|
||||
use rustc_ast::ast::{self, AngleBracketedArg, AngleBracketedArgs, GenericArg, ParenthesizedArgs};
|
||||
use rustc_ast::ast::{AnonConst, AssocTyConstraint, AssocTyConstraintKind, BlockCheckMode};
|
||||
use rustc_ast::ast::{Ident, Path, PathSegment, QSelf};
|
||||
use rustc_ast::ast::{Path, PathSegment, QSelf};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::token::{self, Token};
|
||||
use rustc_errors::{pluralize, Applicability, PResult};
|
||||
use rustc_span::source_map::{BytePos, Span};
|
||||
use rustc_span::symbol::{kw, sym};
|
||||
use rustc_span::symbol::{kw, sym, Ident};
|
||||
|
||||
use log::debug;
|
||||
use std::mem;
|
||||
|
@ -16,7 +16,7 @@ use rustc_middle::ty::{self, DefIdTree, TyCtxt};
|
||||
use rustc_session::lint;
|
||||
|
||||
use rustc_ast::{ast, attr};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
|
||||
// Any local node that may call something in its body block should be
|
||||
// explored. For example, if it's a live Node::Item that is a
|
||||
@ -229,7 +229,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
|
||||
fn visit_variant_data(
|
||||
&mut self,
|
||||
def: &'tcx hir::VariantData<'tcx>,
|
||||
_: ast::Name,
|
||||
_: Symbol,
|
||||
_: &hir::Generics<'_>,
|
||||
_: hir::HirId,
|
||||
_: rustc_span::Span,
|
||||
@ -551,7 +551,7 @@ impl DeadVisitor<'tcx> {
|
||||
&mut self,
|
||||
id: hir::HirId,
|
||||
span: rustc_span::Span,
|
||||
name: ast::Name,
|
||||
name: Symbol,
|
||||
participle: &str,
|
||||
) {
|
||||
if !name.as_str().starts_with('_') {
|
||||
|
@ -96,7 +96,6 @@
|
||||
use self::LiveNodeKind::*;
|
||||
use self::VarKind::*;
|
||||
|
||||
use rustc_ast::ast;
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir as hir;
|
||||
@ -108,7 +107,7 @@ use rustc_middle::hir::map::Map;
|
||||
use rustc_middle::ty::query::Providers;
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_session::lint;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::collections::VecDeque;
|
||||
@ -245,13 +244,13 @@ struct CaptureInfo {
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
struct LocalInfo {
|
||||
id: HirId,
|
||||
name: ast::Name,
|
||||
name: Symbol,
|
||||
is_shorthand: bool,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
enum VarKind {
|
||||
Param(HirId, ast::Name),
|
||||
Param(HirId, Symbol),
|
||||
Local(LocalInfo),
|
||||
CleanExit,
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
//! Used by `rustc` when loading a plugin.
|
||||
|
||||
use crate::Registry;
|
||||
use rustc_ast::ast::{Crate, Ident};
|
||||
use rustc_ast::ast::Crate;
|
||||
use rustc_errors::struct_span_err;
|
||||
use rustc_metadata::locator;
|
||||
use rustc_middle::middle::cstore::MetadataLoader;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::symbol::{sym, Ident};
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::borrow::ToOwned;
|
||||
|
@ -15,7 +15,6 @@ rustc_errors = { path = "../librustc_errors" }
|
||||
rustc_hir = { path = "../librustc_hir" }
|
||||
rustc_typeck = { path = "../librustc_typeck" }
|
||||
rustc_session = { path = "../librustc_session" }
|
||||
rustc_ast = { path = "../librustc_ast" }
|
||||
rustc_span = { path = "../librustc_span" }
|
||||
rustc_data_structures = { path = "../librustc_data_structures" }
|
||||
log = "0.4"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user