mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
Auto merge of #100564 - nnethercote:box-ast-MacCall, r=spastorino
Box the `MacCall` in various types. r? `@spastorino`
This commit is contained in:
commit
dd01122b5c
@ -770,7 +770,7 @@ pub enum PatKind {
|
|||||||
Paren(P<Pat>),
|
Paren(P<Pat>),
|
||||||
|
|
||||||
/// A macro pattern; pre-expansion.
|
/// A macro pattern; pre-expansion.
|
||||||
MacCall(MacCall),
|
MacCall(P<MacCall>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Copy)]
|
||||||
@ -980,7 +980,7 @@ pub enum StmtKind {
|
|||||||
|
|
||||||
#[derive(Clone, Encodable, Decodable, Debug)]
|
#[derive(Clone, Encodable, Decodable, Debug)]
|
||||||
pub struct MacCallStmt {
|
pub struct MacCallStmt {
|
||||||
pub mac: MacCall,
|
pub mac: P<MacCall>,
|
||||||
pub style: MacStmtStyle,
|
pub style: MacStmtStyle,
|
||||||
pub attrs: AttrVec,
|
pub attrs: AttrVec,
|
||||||
pub tokens: Option<LazyTokenStream>,
|
pub tokens: Option<LazyTokenStream>,
|
||||||
@ -1437,7 +1437,7 @@ pub enum ExprKind {
|
|||||||
InlineAsm(P<InlineAsm>),
|
InlineAsm(P<InlineAsm>),
|
||||||
|
|
||||||
/// A macro invocation; pre-expansion.
|
/// A macro invocation; pre-expansion.
|
||||||
MacCall(MacCall),
|
MacCall(P<MacCall>),
|
||||||
|
|
||||||
/// A struct literal expression.
|
/// A struct literal expression.
|
||||||
///
|
///
|
||||||
@ -2040,7 +2040,7 @@ pub enum TyKind {
|
|||||||
/// Inferred type of a `self` or `&self` argument in a method.
|
/// Inferred type of a `self` or `&self` argument in a method.
|
||||||
ImplicitSelf,
|
ImplicitSelf,
|
||||||
/// A macro in the type position.
|
/// A macro in the type position.
|
||||||
MacCall(MacCall),
|
MacCall(P<MacCall>),
|
||||||
/// Placeholder for a kind that has failed to be defined.
|
/// Placeholder for a kind that has failed to be defined.
|
||||||
Err,
|
Err,
|
||||||
/// Placeholder for a `va_list`.
|
/// Placeholder for a `va_list`.
|
||||||
@ -2877,7 +2877,7 @@ pub enum ItemKind {
|
|||||||
/// A macro invocation.
|
/// A macro invocation.
|
||||||
///
|
///
|
||||||
/// E.g., `foo!(..)`.
|
/// E.g., `foo!(..)`.
|
||||||
MacCall(MacCall),
|
MacCall(P<MacCall>),
|
||||||
|
|
||||||
/// A macro definition.
|
/// A macro definition.
|
||||||
MacroDef(MacroDef),
|
MacroDef(MacroDef),
|
||||||
@ -2951,7 +2951,7 @@ pub enum AssocItemKind {
|
|||||||
/// An associated type.
|
/// An associated type.
|
||||||
TyAlias(Box<TyAlias>),
|
TyAlias(Box<TyAlias>),
|
||||||
/// A macro expanding to associated items.
|
/// A macro expanding to associated items.
|
||||||
MacCall(MacCall),
|
MacCall(P<MacCall>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AssocItemKind {
|
impl AssocItemKind {
|
||||||
@ -3000,7 +3000,7 @@ pub enum ForeignItemKind {
|
|||||||
/// An foreign type.
|
/// An foreign type.
|
||||||
TyAlias(Box<TyAlias>),
|
TyAlias(Box<TyAlias>),
|
||||||
/// A macro expanding to foreign items.
|
/// A macro expanding to foreign items.
|
||||||
MacCall(MacCall),
|
MacCall(P<MacCall>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ForeignItemKind> for ItemKind {
|
impl From<ForeignItemKind> for ItemKind {
|
||||||
@ -3036,15 +3036,15 @@ mod size_asserts {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use rustc_data_structures::static_assert_size;
|
use rustc_data_structures::static_assert_size;
|
||||||
// These are in alphabetical order, which is easy to maintain.
|
// These are in alphabetical order, which is easy to maintain.
|
||||||
static_assert_size!(AssocItem, 160);
|
static_assert_size!(AssocItem, 120);
|
||||||
static_assert_size!(AssocItemKind, 72);
|
static_assert_size!(AssocItemKind, 32);
|
||||||
static_assert_size!(Attribute, 32);
|
static_assert_size!(Attribute, 32);
|
||||||
static_assert_size!(Block, 48);
|
static_assert_size!(Block, 48);
|
||||||
static_assert_size!(Expr, 104);
|
static_assert_size!(Expr, 104);
|
||||||
static_assert_size!(ExprKind, 72);
|
static_assert_size!(ExprKind, 72);
|
||||||
static_assert_size!(Fn, 192);
|
static_assert_size!(Fn, 192);
|
||||||
static_assert_size!(ForeignItem, 160);
|
static_assert_size!(ForeignItem, 112);
|
||||||
static_assert_size!(ForeignItemKind, 72);
|
static_assert_size!(ForeignItemKind, 24);
|
||||||
static_assert_size!(GenericBound, 88);
|
static_assert_size!(GenericBound, 88);
|
||||||
static_assert_size!(Generics, 72);
|
static_assert_size!(Generics, 72);
|
||||||
static_assert_size!(Impl, 200);
|
static_assert_size!(Impl, 200);
|
||||||
|
@ -52,7 +52,7 @@ pub fn expand_assert<'cx>(
|
|||||||
let expr = if let Some(tokens) = custom_message {
|
let expr = if let Some(tokens) = custom_message {
|
||||||
let then = cx.expr(
|
let then = cx.expr(
|
||||||
call_site_span,
|
call_site_span,
|
||||||
ExprKind::MacCall(MacCall {
|
ExprKind::MacCall(P(MacCall {
|
||||||
path: panic_path(),
|
path: panic_path(),
|
||||||
args: P(MacArgs::Delimited(
|
args: P(MacArgs::Delimited(
|
||||||
DelimSpan::from_single(call_site_span),
|
DelimSpan::from_single(call_site_span),
|
||||||
@ -60,7 +60,7 @@ pub fn expand_assert<'cx>(
|
|||||||
tokens,
|
tokens,
|
||||||
)),
|
)),
|
||||||
prior_type_ascription: None,
|
prior_type_ascription: None,
|
||||||
}),
|
})),
|
||||||
);
|
);
|
||||||
expr_if_not(cx, call_site_span, cond_expr, then, None)
|
expr_if_not(cx, call_site_span, cond_expr, then, None)
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ impl<'cx, 'a> Context<'cx, 'a> {
|
|||||||
});
|
});
|
||||||
self.cx.expr(
|
self.cx.expr(
|
||||||
self.span,
|
self.span,
|
||||||
ExprKind::MacCall(MacCall {
|
ExprKind::MacCall(P(MacCall {
|
||||||
path: panic_path,
|
path: panic_path,
|
||||||
args: P(MacArgs::Delimited(
|
args: P(MacArgs::Delimited(
|
||||||
DelimSpan::from_single(self.span),
|
DelimSpan::from_single(self.span),
|
||||||
@ -185,7 +185,7 @@ impl<'cx, 'a> Context<'cx, 'a> {
|
|||||||
initial.into_iter().chain(captures).collect::<TokenStream>(),
|
initial.into_iter().chain(captures).collect::<TokenStream>(),
|
||||||
)),
|
)),
|
||||||
prior_type_ascription: None,
|
prior_type_ascription: None,
|
||||||
}),
|
})),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ fn expand<'cx>(
|
|||||||
MacEager::expr(
|
MacEager::expr(
|
||||||
cx.expr(
|
cx.expr(
|
||||||
sp,
|
sp,
|
||||||
ExprKind::MacCall(MacCall {
|
ExprKind::MacCall(P(MacCall {
|
||||||
path: Path {
|
path: Path {
|
||||||
span: sp,
|
span: sp,
|
||||||
segments: cx
|
segments: cx
|
||||||
@ -64,7 +64,7 @@ fn expand<'cx>(
|
|||||||
tts,
|
tts,
|
||||||
)),
|
)),
|
||||||
prior_type_ascription: None,
|
prior_type_ascription: None,
|
||||||
}),
|
})),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@ pub struct Invocation {
|
|||||||
|
|
||||||
pub enum InvocationKind {
|
pub enum InvocationKind {
|
||||||
Bang {
|
Bang {
|
||||||
mac: ast::MacCall,
|
mac: P<ast::MacCall>,
|
||||||
span: Span,
|
span: Span,
|
||||||
},
|
},
|
||||||
Attr {
|
Attr {
|
||||||
@ -1017,7 +1017,7 @@ trait InvocationCollectorNode: HasAttrs + HasNodeId + Sized {
|
|||||||
fn is_mac_call(&self) -> bool {
|
fn is_mac_call(&self) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
fn take_mac_call(self) -> (ast::MacCall, Self::AttrsTy, AddSemicolon) {
|
fn take_mac_call(self) -> (P<ast::MacCall>, Self::AttrsTy, AddSemicolon) {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
fn pre_flat_map_node_collect_attr(_cfg: &StripUnconfigured<'_>, _attr: &ast::Attribute) {}
|
fn pre_flat_map_node_collect_attr(_cfg: &StripUnconfigured<'_>, _attr: &ast::Attribute) {}
|
||||||
@ -1046,7 +1046,7 @@ impl InvocationCollectorNode for P<ast::Item> {
|
|||||||
fn is_mac_call(&self) -> bool {
|
fn is_mac_call(&self) -> bool {
|
||||||
matches!(self.kind, ItemKind::MacCall(..))
|
matches!(self.kind, ItemKind::MacCall(..))
|
||||||
}
|
}
|
||||||
fn take_mac_call(self) -> (ast::MacCall, Self::AttrsTy, AddSemicolon) {
|
fn take_mac_call(self) -> (P<ast::MacCall>, Self::AttrsTy, AddSemicolon) {
|
||||||
let node = self.into_inner();
|
let node = self.into_inner();
|
||||||
match node.kind {
|
match node.kind {
|
||||||
ItemKind::MacCall(mac) => (mac, node.attrs, AddSemicolon::No),
|
ItemKind::MacCall(mac) => (mac, node.attrs, AddSemicolon::No),
|
||||||
@ -1154,7 +1154,7 @@ impl InvocationCollectorNode for AstNodeWrapper<P<ast::AssocItem>, TraitItemTag>
|
|||||||
fn is_mac_call(&self) -> bool {
|
fn is_mac_call(&self) -> bool {
|
||||||
matches!(self.wrapped.kind, AssocItemKind::MacCall(..))
|
matches!(self.wrapped.kind, AssocItemKind::MacCall(..))
|
||||||
}
|
}
|
||||||
fn take_mac_call(self) -> (ast::MacCall, Self::AttrsTy, AddSemicolon) {
|
fn take_mac_call(self) -> (P<ast::MacCall>, Self::AttrsTy, AddSemicolon) {
|
||||||
let item = self.wrapped.into_inner();
|
let item = self.wrapped.into_inner();
|
||||||
match item.kind {
|
match item.kind {
|
||||||
AssocItemKind::MacCall(mac) => (mac, item.attrs, AddSemicolon::No),
|
AssocItemKind::MacCall(mac) => (mac, item.attrs, AddSemicolon::No),
|
||||||
@ -1179,7 +1179,7 @@ impl InvocationCollectorNode for AstNodeWrapper<P<ast::AssocItem>, ImplItemTag>
|
|||||||
fn is_mac_call(&self) -> bool {
|
fn is_mac_call(&self) -> bool {
|
||||||
matches!(self.wrapped.kind, AssocItemKind::MacCall(..))
|
matches!(self.wrapped.kind, AssocItemKind::MacCall(..))
|
||||||
}
|
}
|
||||||
fn take_mac_call(self) -> (ast::MacCall, Self::AttrsTy, AddSemicolon) {
|
fn take_mac_call(self) -> (P<ast::MacCall>, Self::AttrsTy, AddSemicolon) {
|
||||||
let item = self.wrapped.into_inner();
|
let item = self.wrapped.into_inner();
|
||||||
match item.kind {
|
match item.kind {
|
||||||
AssocItemKind::MacCall(mac) => (mac, item.attrs, AddSemicolon::No),
|
AssocItemKind::MacCall(mac) => (mac, item.attrs, AddSemicolon::No),
|
||||||
@ -1202,7 +1202,7 @@ impl InvocationCollectorNode for P<ast::ForeignItem> {
|
|||||||
fn is_mac_call(&self) -> bool {
|
fn is_mac_call(&self) -> bool {
|
||||||
matches!(self.kind, ForeignItemKind::MacCall(..))
|
matches!(self.kind, ForeignItemKind::MacCall(..))
|
||||||
}
|
}
|
||||||
fn take_mac_call(self) -> (ast::MacCall, Self::AttrsTy, AddSemicolon) {
|
fn take_mac_call(self) -> (P<ast::MacCall>, Self::AttrsTy, AddSemicolon) {
|
||||||
let node = self.into_inner();
|
let node = self.into_inner();
|
||||||
match node.kind {
|
match node.kind {
|
||||||
ForeignItemKind::MacCall(mac) => (mac, node.attrs, AddSemicolon::No),
|
ForeignItemKind::MacCall(mac) => (mac, node.attrs, AddSemicolon::No),
|
||||||
@ -1323,7 +1323,7 @@ impl InvocationCollectorNode for ast::Stmt {
|
|||||||
StmtKind::Local(..) | StmtKind::Empty => false,
|
StmtKind::Local(..) | StmtKind::Empty => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn take_mac_call(self) -> (ast::MacCall, Self::AttrsTy, AddSemicolon) {
|
fn take_mac_call(self) -> (P<ast::MacCall>, Self::AttrsTy, AddSemicolon) {
|
||||||
// We pull macro invocations (both attributes and fn-like macro calls) out of their
|
// We pull macro invocations (both attributes and fn-like macro calls) out of their
|
||||||
// `StmtKind`s and treat them as statement macro invocations, not as items or expressions.
|
// `StmtKind`s and treat them as statement macro invocations, not as items or expressions.
|
||||||
let (add_semicolon, mac, attrs) = match self.kind {
|
let (add_semicolon, mac, attrs) = match self.kind {
|
||||||
@ -1387,7 +1387,7 @@ impl InvocationCollectorNode for P<ast::Ty> {
|
|||||||
fn is_mac_call(&self) -> bool {
|
fn is_mac_call(&self) -> bool {
|
||||||
matches!(self.kind, ast::TyKind::MacCall(..))
|
matches!(self.kind, ast::TyKind::MacCall(..))
|
||||||
}
|
}
|
||||||
fn take_mac_call(self) -> (ast::MacCall, Self::AttrsTy, AddSemicolon) {
|
fn take_mac_call(self) -> (P<ast::MacCall>, Self::AttrsTy, AddSemicolon) {
|
||||||
let node = self.into_inner();
|
let node = self.into_inner();
|
||||||
match node.kind {
|
match node.kind {
|
||||||
TyKind::MacCall(mac) => (mac, Vec::new(), AddSemicolon::No),
|
TyKind::MacCall(mac) => (mac, Vec::new(), AddSemicolon::No),
|
||||||
@ -1411,7 +1411,7 @@ impl InvocationCollectorNode for P<ast::Pat> {
|
|||||||
fn is_mac_call(&self) -> bool {
|
fn is_mac_call(&self) -> bool {
|
||||||
matches!(self.kind, PatKind::MacCall(..))
|
matches!(self.kind, PatKind::MacCall(..))
|
||||||
}
|
}
|
||||||
fn take_mac_call(self) -> (ast::MacCall, Self::AttrsTy, AddSemicolon) {
|
fn take_mac_call(self) -> (P<ast::MacCall>, Self::AttrsTy, AddSemicolon) {
|
||||||
let node = self.into_inner();
|
let node = self.into_inner();
|
||||||
match node.kind {
|
match node.kind {
|
||||||
PatKind::MacCall(mac) => (mac, Vec::new(), AddSemicolon::No),
|
PatKind::MacCall(mac) => (mac, Vec::new(), AddSemicolon::No),
|
||||||
@ -1439,7 +1439,7 @@ impl InvocationCollectorNode for P<ast::Expr> {
|
|||||||
fn is_mac_call(&self) -> bool {
|
fn is_mac_call(&self) -> bool {
|
||||||
matches!(self.kind, ExprKind::MacCall(..))
|
matches!(self.kind, ExprKind::MacCall(..))
|
||||||
}
|
}
|
||||||
fn take_mac_call(self) -> (ast::MacCall, Self::AttrsTy, AddSemicolon) {
|
fn take_mac_call(self) -> (P<ast::MacCall>, Self::AttrsTy, AddSemicolon) {
|
||||||
let node = self.into_inner();
|
let node = self.into_inner();
|
||||||
match node.kind {
|
match node.kind {
|
||||||
ExprKind::MacCall(mac) => (mac, node.attrs, AddSemicolon::No),
|
ExprKind::MacCall(mac) => (mac, node.attrs, AddSemicolon::No),
|
||||||
@ -1466,7 +1466,7 @@ impl InvocationCollectorNode for AstNodeWrapper<P<ast::Expr>, OptExprTag> {
|
|||||||
fn is_mac_call(&self) -> bool {
|
fn is_mac_call(&self) -> bool {
|
||||||
matches!(self.wrapped.kind, ast::ExprKind::MacCall(..))
|
matches!(self.wrapped.kind, ast::ExprKind::MacCall(..))
|
||||||
}
|
}
|
||||||
fn take_mac_call(self) -> (ast::MacCall, Self::AttrsTy, AddSemicolon) {
|
fn take_mac_call(self) -> (P<ast::MacCall>, Self::AttrsTy, AddSemicolon) {
|
||||||
let node = self.wrapped.into_inner();
|
let node = self.wrapped.into_inner();
|
||||||
match node.kind {
|
match node.kind {
|
||||||
ExprKind::MacCall(mac) => (mac, node.attrs, AddSemicolon::No),
|
ExprKind::MacCall(mac) => (mac, node.attrs, AddSemicolon::No),
|
||||||
@ -1512,7 +1512,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
|
|||||||
placeholder(fragment_kind, NodeId::placeholder_from_expn_id(expn_id), vis)
|
placeholder(fragment_kind, NodeId::placeholder_from_expn_id(expn_id), vis)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn collect_bang(&mut self, mac: ast::MacCall, kind: AstFragmentKind) -> AstFragment {
|
fn collect_bang(&mut self, mac: P<ast::MacCall>, kind: AstFragmentKind) -> AstFragment {
|
||||||
// cache the macro call span so that it can be
|
// cache the macro call span so that it can be
|
||||||
// easily adjusted for incremental compilation
|
// easily adjusted for incremental compilation
|
||||||
let span = mac.span();
|
let span = mac.span();
|
||||||
|
@ -15,12 +15,12 @@ pub fn placeholder(
|
|||||||
id: ast::NodeId,
|
id: ast::NodeId,
|
||||||
vis: Option<ast::Visibility>,
|
vis: Option<ast::Visibility>,
|
||||||
) -> AstFragment {
|
) -> AstFragment {
|
||||||
fn mac_placeholder() -> ast::MacCall {
|
fn mac_placeholder() -> P<ast::MacCall> {
|
||||||
ast::MacCall {
|
P(ast::MacCall {
|
||||||
path: ast::Path { span: DUMMY_SP, segments: Vec::new(), tokens: None },
|
path: ast::Path { span: DUMMY_SP, segments: Vec::new(), tokens: None },
|
||||||
args: P(ast::MacArgs::Empty),
|
args: P(ast::MacArgs::Empty),
|
||||||
prior_type_ascription: None,
|
prior_type_ascription: None,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
let ident = Ident::empty();
|
let ident = Ident::empty();
|
||||||
|
@ -1492,11 +1492,11 @@ impl<'a> Parser<'a> {
|
|||||||
self.struct_span_err(path.span, "macros cannot use qualified paths").emit();
|
self.struct_span_err(path.span, "macros cannot use qualified paths").emit();
|
||||||
}
|
}
|
||||||
let lo = path.span;
|
let lo = path.span;
|
||||||
let mac = MacCall {
|
let mac = P(MacCall {
|
||||||
path,
|
path,
|
||||||
args: self.parse_mac_args()?,
|
args: self.parse_mac_args()?,
|
||||||
prior_type_ascription: self.last_type_ascription,
|
prior_type_ascription: self.last_type_ascription,
|
||||||
};
|
});
|
||||||
(lo.to(self.prev_token.span), ExprKind::MacCall(mac))
|
(lo.to(self.prev_token.span), ExprKind::MacCall(mac))
|
||||||
} else if self.check(&token::OpenDelim(Delimiter::Brace)) &&
|
} else if self.check(&token::OpenDelim(Delimiter::Brace)) &&
|
||||||
let Some(expr) = self.maybe_parse_struct_expr(qself.as_ref(), &path) {
|
let Some(expr) = self.maybe_parse_struct_expr(qself.as_ref(), &path) {
|
||||||
|
@ -287,7 +287,7 @@ impl<'a> Parser<'a> {
|
|||||||
return Ok(None);
|
return Ok(None);
|
||||||
} else if macros_allowed && self.check_path() {
|
} else if macros_allowed && self.check_path() {
|
||||||
// MACRO INVOCATION ITEM
|
// MACRO INVOCATION ITEM
|
||||||
(Ident::empty(), ItemKind::MacCall(self.parse_item_macro(vis)?))
|
(Ident::empty(), ItemKind::MacCall(P(self.parse_item_macro(vis)?)))
|
||||||
} else {
|
} else {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
};
|
};
|
||||||
|
@ -665,7 +665,7 @@ impl<'a> Parser<'a> {
|
|||||||
fn parse_pat_mac_invoc(&mut self, path: Path) -> PResult<'a, PatKind> {
|
fn parse_pat_mac_invoc(&mut self, path: Path) -> PResult<'a, PatKind> {
|
||||||
self.bump();
|
self.bump();
|
||||||
let args = self.parse_mac_args()?;
|
let args = self.parse_mac_args()?;
|
||||||
let mac = MacCall { path, args, prior_type_ascription: self.last_type_ascription };
|
let mac = P(MacCall { path, args, prior_type_ascription: self.last_type_ascription });
|
||||||
Ok(PatKind::MacCall(mac))
|
Ok(PatKind::MacCall(mac))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ impl<'a> Parser<'a> {
|
|||||||
None => unreachable!(),
|
None => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mac = MacCall { path, args, prior_type_ascription: self.last_type_ascription };
|
let mac = P(MacCall { path, args, prior_type_ascription: self.last_type_ascription });
|
||||||
|
|
||||||
let kind = if (style == MacStmtStyle::Braces
|
let kind = if (style == MacStmtStyle::Braces
|
||||||
&& self.token != token::Dot
|
&& self.token != token::Dot
|
||||||
|
@ -598,11 +598,11 @@ impl<'a> Parser<'a> {
|
|||||||
let path = self.parse_path_inner(PathStyle::Type, ty_generics)?;
|
let path = self.parse_path_inner(PathStyle::Type, ty_generics)?;
|
||||||
if self.eat(&token::Not) {
|
if self.eat(&token::Not) {
|
||||||
// Macro invocation in type position
|
// Macro invocation in type position
|
||||||
Ok(TyKind::MacCall(MacCall {
|
Ok(TyKind::MacCall(P(MacCall {
|
||||||
path,
|
path,
|
||||||
args: self.parse_mac_args()?,
|
args: self.parse_mac_args()?,
|
||||||
prior_type_ascription: self.last_type_ascription,
|
prior_type_ascription: self.last_type_ascription,
|
||||||
}))
|
})))
|
||||||
} else if allow_plus == AllowPlus::Yes && self.check_plus() {
|
} else if allow_plus == AllowPlus::Yes && self.check_plus() {
|
||||||
// `Trait1 + Trait2 + 'a`
|
// `Trait1 + Trait2 + 'a`
|
||||||
self.parse_remaining_bounds_path(Vec::new(), path, lo, true)
|
self.parse_remaining_bounds_path(Vec::new(), path, lo, true)
|
||||||
|
@ -3,7 +3,7 @@ PRE EXPANSION AST STATS
|
|||||||
|
|
||||||
Name Accumulated Size Count Item Size
|
Name Accumulated Size Count Item Size
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
ExprField 48 ( 0.5%) 1 48
|
ExprField 48 ( 0.6%) 1 48
|
||||||
Attribute 64 ( 0.7%) 2 32
|
Attribute 64 ( 0.7%) 2 32
|
||||||
- Normal 32 ( 0.4%) 1
|
- Normal 32 ( 0.4%) 1
|
||||||
- DocComment 32 ( 0.4%) 1
|
- DocComment 32 ( 0.4%) 1
|
||||||
@ -14,48 +14,48 @@ WherePredicate 72 ( 0.8%) 1 72
|
|||||||
- BoundPredicate 72 ( 0.8%) 1
|
- BoundPredicate 72 ( 0.8%) 1
|
||||||
Crate 72 ( 0.8%) 1 72
|
Crate 72 ( 0.8%) 1 72
|
||||||
Arm 96 ( 1.1%) 2 48
|
Arm 96 ( 1.1%) 2 48
|
||||||
|
ForeignItem 112 ( 1.3%) 1 112
|
||||||
|
- Fn 112 ( 1.3%) 1
|
||||||
FieldDef 160 ( 1.8%) 2 80
|
FieldDef 160 ( 1.8%) 2 80
|
||||||
ForeignItem 160 ( 1.8%) 1 160
|
|
||||||
- Fn 160 ( 1.8%) 1
|
|
||||||
Stmt 160 ( 1.8%) 5 32
|
Stmt 160 ( 1.8%) 5 32
|
||||||
- Local 32 ( 0.4%) 1
|
- Local 32 ( 0.4%) 1
|
||||||
- MacCall 32 ( 0.4%) 1
|
- MacCall 32 ( 0.4%) 1
|
||||||
- Expr 96 ( 1.1%) 3
|
- Expr 96 ( 1.1%) 3
|
||||||
Param 160 ( 1.8%) 4 40
|
Param 160 ( 1.8%) 4 40
|
||||||
FnDecl 200 ( 2.2%) 5 40
|
FnDecl 200 ( 2.3%) 5 40
|
||||||
Variant 240 ( 2.7%) 2 120
|
Variant 240 ( 2.8%) 2 120
|
||||||
Block 288 ( 3.2%) 6 48
|
Block 288 ( 3.3%) 6 48
|
||||||
GenericBound 352 ( 4.0%) 4 88
|
GenericBound 352 ( 4.0%) 4 88
|
||||||
- Trait 352 ( 4.0%) 4
|
- Trait 352 ( 4.0%) 4
|
||||||
GenericParam 520 ( 5.8%) 5 104
|
AssocItem 480 ( 5.5%) 4 120
|
||||||
AssocItem 640 ( 7.2%) 4 160
|
- TyAlias 240 ( 2.8%) 2
|
||||||
- TyAlias 320 ( 3.6%) 2
|
- Fn 240 ( 2.8%) 2
|
||||||
- Fn 320 ( 3.6%) 2
|
GenericParam 520 ( 6.0%) 5 104
|
||||||
PathSegment 720 ( 8.1%) 30 24
|
PathSegment 720 ( 8.3%) 30 24
|
||||||
Expr 832 ( 9.3%) 8 104
|
Expr 832 ( 9.6%) 8 104
|
||||||
- Path 104 ( 1.2%) 1
|
- Path 104 ( 1.2%) 1
|
||||||
- Match 104 ( 1.2%) 1
|
- Match 104 ( 1.2%) 1
|
||||||
- Struct 104 ( 1.2%) 1
|
- Struct 104 ( 1.2%) 1
|
||||||
- Lit 208 ( 2.3%) 2
|
- Lit 208 ( 2.4%) 2
|
||||||
- Block 312 ( 3.5%) 3
|
- Block 312 ( 3.6%) 3
|
||||||
Pat 840 ( 9.4%) 7 120
|
Pat 840 ( 9.7%) 7 120
|
||||||
- Struct 120 ( 1.3%) 1
|
- Struct 120 ( 1.4%) 1
|
||||||
- Wild 120 ( 1.3%) 1
|
- Wild 120 ( 1.4%) 1
|
||||||
- Ident 600 ( 6.7%) 5
|
- Ident 600 ( 6.9%) 5
|
||||||
Ty 1_344 (15.1%) 14 96
|
Ty 1_344 (15.5%) 14 96
|
||||||
- Rptr 96 ( 1.1%) 1
|
- Rptr 96 ( 1.1%) 1
|
||||||
- Ptr 96 ( 1.1%) 1
|
- Ptr 96 ( 1.1%) 1
|
||||||
- ImplicitSelf 192 ( 2.2%) 2
|
- ImplicitSelf 192 ( 2.2%) 2
|
||||||
- Path 960 (10.8%) 10
|
- Path 960 (11.0%) 10
|
||||||
Item 1_800 (20.2%) 9 200
|
Item 1_800 (20.7%) 9 200
|
||||||
- Trait 200 ( 2.2%) 1
|
- Trait 200 ( 2.3%) 1
|
||||||
- Enum 200 ( 2.2%) 1
|
- Enum 200 ( 2.3%) 1
|
||||||
- ForeignMod 200 ( 2.2%) 1
|
- ForeignMod 200 ( 2.3%) 1
|
||||||
- Impl 200 ( 2.2%) 1
|
- Impl 200 ( 2.3%) 1
|
||||||
- Fn 400 ( 4.5%) 2
|
- Fn 400 ( 4.6%) 2
|
||||||
- Use 600 ( 6.7%) 3
|
- Use 600 ( 6.9%) 3
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
Total 8_904
|
Total 8_696
|
||||||
|
|
||||||
|
|
||||||
POST EXPANSION AST STATS
|
POST EXPANSION AST STATS
|
||||||
@ -65,18 +65,18 @@ Name Accumulated Size Count Item Size
|
|||||||
ExprField 48 ( 0.5%) 1 48
|
ExprField 48 ( 0.5%) 1 48
|
||||||
GenericArgs 64 ( 0.7%) 1 64
|
GenericArgs 64 ( 0.7%) 1 64
|
||||||
- AngleBracketed 64 ( 0.7%) 1
|
- AngleBracketed 64 ( 0.7%) 1
|
||||||
Local 72 ( 0.7%) 1 72
|
Local 72 ( 0.8%) 1 72
|
||||||
WherePredicate 72 ( 0.7%) 1 72
|
WherePredicate 72 ( 0.8%) 1 72
|
||||||
- BoundPredicate 72 ( 0.7%) 1
|
- BoundPredicate 72 ( 0.8%) 1
|
||||||
Crate 72 ( 0.7%) 1 72
|
Crate 72 ( 0.8%) 1 72
|
||||||
Arm 96 ( 1.0%) 2 48
|
Arm 96 ( 1.0%) 2 48
|
||||||
InlineAsm 120 ( 1.2%) 1 120
|
ForeignItem 112 ( 1.2%) 1 112
|
||||||
Attribute 128 ( 1.3%) 4 32
|
- Fn 112 ( 1.2%) 1
|
||||||
|
InlineAsm 120 ( 1.3%) 1 120
|
||||||
|
Attribute 128 ( 1.4%) 4 32
|
||||||
- DocComment 32 ( 0.3%) 1
|
- DocComment 32 ( 0.3%) 1
|
||||||
- Normal 96 ( 1.0%) 3
|
- Normal 96 ( 1.0%) 3
|
||||||
FieldDef 160 ( 1.7%) 2 80
|
FieldDef 160 ( 1.7%) 2 80
|
||||||
ForeignItem 160 ( 1.7%) 1 160
|
|
||||||
- Fn 160 ( 1.7%) 1
|
|
||||||
Stmt 160 ( 1.7%) 5 32
|
Stmt 160 ( 1.7%) 5 32
|
||||||
- Local 32 ( 0.3%) 1
|
- Local 32 ( 0.3%) 1
|
||||||
- Semi 32 ( 0.3%) 1
|
- Semi 32 ( 0.3%) 1
|
||||||
@ -85,39 +85,39 @@ Param 160 ( 1.7%) 4 40
|
|||||||
FnDecl 200 ( 2.1%) 5 40
|
FnDecl 200 ( 2.1%) 5 40
|
||||||
Variant 240 ( 2.5%) 2 120
|
Variant 240 ( 2.5%) 2 120
|
||||||
Block 288 ( 3.0%) 6 48
|
Block 288 ( 3.0%) 6 48
|
||||||
GenericBound 352 ( 3.6%) 4 88
|
GenericBound 352 ( 3.7%) 4 88
|
||||||
- Trait 352 ( 3.6%) 4
|
- Trait 352 ( 3.7%) 4
|
||||||
GenericParam 520 ( 5.4%) 5 104
|
AssocItem 480 ( 5.1%) 4 120
|
||||||
AssocItem 640 ( 6.6%) 4 160
|
- TyAlias 240 ( 2.5%) 2
|
||||||
- TyAlias 320 ( 3.3%) 2
|
- Fn 240 ( 2.5%) 2
|
||||||
- Fn 320 ( 3.3%) 2
|
GenericParam 520 ( 5.5%) 5 104
|
||||||
PathSegment 792 ( 8.2%) 33 24
|
PathSegment 792 ( 8.4%) 33 24
|
||||||
Pat 840 ( 8.7%) 7 120
|
Pat 840 ( 8.9%) 7 120
|
||||||
- Struct 120 ( 1.2%) 1
|
- Struct 120 ( 1.3%) 1
|
||||||
- Wild 120 ( 1.2%) 1
|
- Wild 120 ( 1.3%) 1
|
||||||
- Ident 600 ( 6.2%) 5
|
- Ident 600 ( 6.3%) 5
|
||||||
Expr 936 ( 9.7%) 9 104
|
Expr 936 ( 9.9%) 9 104
|
||||||
- Path 104 ( 1.1%) 1
|
- Path 104 ( 1.1%) 1
|
||||||
- Match 104 ( 1.1%) 1
|
- Match 104 ( 1.1%) 1
|
||||||
- Struct 104 ( 1.1%) 1
|
- Struct 104 ( 1.1%) 1
|
||||||
- InlineAsm 104 ( 1.1%) 1
|
- InlineAsm 104 ( 1.1%) 1
|
||||||
- Lit 208 ( 2.2%) 2
|
- Lit 208 ( 2.2%) 2
|
||||||
- Block 312 ( 3.2%) 3
|
- Block 312 ( 3.3%) 3
|
||||||
Ty 1_344 (13.9%) 14 96
|
Ty 1_344 (14.2%) 14 96
|
||||||
- Rptr 96 ( 1.0%) 1
|
- Rptr 96 ( 1.0%) 1
|
||||||
- Ptr 96 ( 1.0%) 1
|
- Ptr 96 ( 1.0%) 1
|
||||||
- ImplicitSelf 192 ( 2.0%) 2
|
- ImplicitSelf 192 ( 2.0%) 2
|
||||||
- Path 960 ( 9.9%) 10
|
- Path 960 (10.2%) 10
|
||||||
Item 2_200 (22.8%) 11 200
|
Item 2_200 (23.3%) 11 200
|
||||||
- Trait 200 ( 2.1%) 1
|
- Trait 200 ( 2.1%) 1
|
||||||
- Enum 200 ( 2.1%) 1
|
- Enum 200 ( 2.1%) 1
|
||||||
- ExternCrate 200 ( 2.1%) 1
|
- ExternCrate 200 ( 2.1%) 1
|
||||||
- ForeignMod 200 ( 2.1%) 1
|
- ForeignMod 200 ( 2.1%) 1
|
||||||
- Impl 200 ( 2.1%) 1
|
- Impl 200 ( 2.1%) 1
|
||||||
- Fn 400 ( 4.1%) 2
|
- Fn 400 ( 4.2%) 2
|
||||||
- Use 800 ( 8.3%) 4
|
- Use 800 ( 8.5%) 4
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
Total 9_664
|
Total 9_456
|
||||||
|
|
||||||
|
|
||||||
HIR STATS
|
HIR STATS
|
||||||
|
Loading…
Reference in New Issue
Block a user