Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e36e4bd

Browse files
committedSep 2, 2020
Auto merge of rust-lang#76231 - tmandry:rollup-ilvs9fq, r=tmandry
Rollup of 14 pull requests Successful merges: - rust-lang#74880 (Add trailing comma support to matches macro) - rust-lang#76074 (Add new `-Z dump-mir-spanview` option) - rust-lang#76088 (Add more examples to lexicographic cmp on Iterators.) - rust-lang#76099 (Add info about `!` and `impl Trait`) - rust-lang#76126 (Use "Fira Sans" for crate list font) - rust-lang#76132 (Factor out StmtKind::MacCall fields into `MacCallStmt` struct) - rust-lang#76143 (Give a better error message for duplicate built-in macros) - rust-lang#76158 (Stabilise link-self-contained option) - rust-lang#76201 (Move to intra-doc links for library/core/src/panic.rs) - rust-lang#76206 (Make all methods of `std::net::Ipv6Addr` const) - rust-lang#76207 (# Move to intra-doc links for library/core/src/clone.rs) - rust-lang#76212 (Document lint missing_doc_code_examples is nightly-only) - rust-lang#76218 (lexer: Tiny improvement to shebang detection) - rust-lang#76221 (Clean up header in `iter` docs for `for` loops) Failed merges: r? @ghost
2 parents 130359c + 4dd75f8 commit e36e4bd

File tree

47 files changed

+1064
-99
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1064
-99
lines changed
 

‎compiler/rustc_ast/src/ast.rs

+15-4
Original file line numberDiff line numberDiff line change
@@ -922,9 +922,13 @@ impl Stmt {
922922
pub fn add_trailing_semicolon(mut self) -> Self {
923923
self.kind = match self.kind {
924924
StmtKind::Expr(expr) => StmtKind::Semi(expr),
925-
StmtKind::MacCall(mac) => StmtKind::MacCall(
926-
mac.map(|(mac, _style, attrs)| (mac, MacStmtStyle::Semicolon, attrs)),
927-
),
925+
StmtKind::MacCall(mac) => {
926+
StmtKind::MacCall(mac.map(|MacCallStmt { mac, style: _, attrs }| MacCallStmt {
927+
mac,
928+
style: MacStmtStyle::Semicolon,
929+
attrs,
930+
}))
931+
}
928932
kind => kind,
929933
};
930934
self
@@ -958,7 +962,14 @@ pub enum StmtKind {
958962
/// Just a trailing semi-colon.
959963
Empty,
960964
/// Macro.
961-
MacCall(P<(MacCall, MacStmtStyle, AttrVec)>),
965+
MacCall(P<MacCallStmt>),
966+
}
967+
968+
#[derive(Clone, Encodable, Decodable, Debug)]
969+
pub struct MacCallStmt {
970+
pub mac: MacCall,
971+
pub style: MacStmtStyle,
972+
pub attrs: AttrVec,
962973
}
963974

964975
#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug)]

‎compiler/rustc_ast/src/attr/mod.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use rustc_span::symbol::{sym, Ident, Symbol};
1616
use rustc_span::Span;
1717

1818
use std::iter;
19-
use std::ops::DerefMut;
2019

2120
pub struct MarkedAttrs(GrowableBitSet<AttrId>);
2221

@@ -634,10 +633,7 @@ impl HasAttrs for StmtKind {
634633
StmtKind::Local(ref local) => local.attrs(),
635634
StmtKind::Expr(ref expr) | StmtKind::Semi(ref expr) => expr.attrs(),
636635
StmtKind::Empty | StmtKind::Item(..) => &[],
637-
StmtKind::MacCall(ref mac) => {
638-
let (_, _, ref attrs) = **mac;
639-
attrs.attrs()
640-
}
636+
StmtKind::MacCall(ref mac) => mac.attrs.attrs(),
641637
}
642638
}
643639

@@ -647,8 +643,7 @@ impl HasAttrs for StmtKind {
647643
StmtKind::Expr(expr) | StmtKind::Semi(expr) => expr.visit_attrs(f),
648644
StmtKind::Empty | StmtKind::Item(..) => {}
649645
StmtKind::MacCall(mac) => {
650-
let (_mac, _style, attrs) = mac.deref_mut();
651-
attrs.visit_attrs(f);
646+
mac.attrs.visit_attrs(f);
652647
}
653648
}
654649
}

0 commit comments

Comments
 (0)
Please sign in to comment.