Skip to content

Commit 951e579

Browse files
committed
Auto merge of rust-lang#130373 - compiler-errors:crater-rollup, r=<try>
[CRATER] Crater rollup This is a crater rollup of: * rust-lang#124141 * rust-lang#130285 * rust-lang#130367 **What is a crater rollup?** It's simply a (manually set-up) crater job that is run on all of the containing PRs together, and then we can set the crates list for each of these jobs to *just* the list of failures after it's done. It should cut out on the bulk of "normal" crates that do nothing and simply just waste time to build without being affected by the union of all of these changes. After this is finished, I will adjust all of the jobs to use only the list of failed crates. That should significantly speed up these jobs from taking like ~6 days to taking ~2. See the last time I did this: rust-lang#129660. Given that rust-lang#130285 is running in build-and-test mode, let's run all of them in build-and-test mode.
2 parents 5e3ede2 + 29ed873 commit 951e579

File tree

149 files changed

+1722
-1390
lines changed

Some content is hidden

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

149 files changed

+1722
-1390
lines changed

Diff for: compiler/rustc_ast/src/ast_traits.rs

-30
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use std::fmt;
66
use std::marker::PhantomData;
77

88
use crate::ptr::P;
9-
use crate::token::Nonterminal;
109
use crate::tokenstream::LazyAttrTokenStream;
1110
use crate::{
1211
Arm, AssocItem, AttrItem, AttrKind, AttrVec, Attribute, Block, Crate, Expr, ExprField,
@@ -196,35 +195,6 @@ impl HasTokens for Attribute {
196195
}
197196
}
198197

199-
impl HasTokens for Nonterminal {
200-
fn tokens(&self) -> Option<&LazyAttrTokenStream> {
201-
match self {
202-
Nonterminal::NtItem(item) => item.tokens(),
203-
Nonterminal::NtStmt(stmt) => stmt.tokens(),
204-
Nonterminal::NtExpr(expr) | Nonterminal::NtLiteral(expr) => expr.tokens(),
205-
Nonterminal::NtPat(pat) => pat.tokens(),
206-
Nonterminal::NtTy(ty) => ty.tokens(),
207-
Nonterminal::NtMeta(attr_item) => attr_item.tokens(),
208-
Nonterminal::NtPath(path) => path.tokens(),
209-
Nonterminal::NtVis(vis) => vis.tokens(),
210-
Nonterminal::NtBlock(block) => block.tokens(),
211-
}
212-
}
213-
fn tokens_mut(&mut self) -> Option<&mut Option<LazyAttrTokenStream>> {
214-
match self {
215-
Nonterminal::NtItem(item) => item.tokens_mut(),
216-
Nonterminal::NtStmt(stmt) => stmt.tokens_mut(),
217-
Nonterminal::NtExpr(expr) | Nonterminal::NtLiteral(expr) => expr.tokens_mut(),
218-
Nonterminal::NtPat(pat) => pat.tokens_mut(),
219-
Nonterminal::NtTy(ty) => ty.tokens_mut(),
220-
Nonterminal::NtMeta(attr_item) => attr_item.tokens_mut(),
221-
Nonterminal::NtPath(path) => path.tokens_mut(),
222-
Nonterminal::NtVis(vis) => vis.tokens_mut(),
223-
Nonterminal::NtBlock(block) => block.tokens_mut(),
224-
}
225-
}
226-
}
227-
228198
/// A trait for AST nodes having (or not having) attributes.
229199
pub trait HasAttrs {
230200
/// This is `true` if this `HasAttrs` might support 'custom' (proc-macro) inner

Diff for: compiler/rustc_ast/src/attr/mod.rs

+14-8
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::ast::{
1515
PathSegment, Safety, DUMMY_NODE_ID,
1616
};
1717
use crate::ptr::P;
18-
use crate::token::{self, CommentKind, Delimiter, Token};
18+
use crate::token::{self, CommentKind, Delimiter, InvisibleOrigin, MetaVarKind, Token};
1919
use crate::tokenstream::{DelimSpan, LazyAttrTokenStream, Spacing, TokenStream, TokenTree};
2020
use crate::util::comments;
2121
use crate::util::literal::escape_string_symbol;
@@ -364,11 +364,17 @@ impl MetaItem {
364364
let span = span.with_hi(segments.last().unwrap().ident.span.hi());
365365
Path { span, segments, tokens: None }
366366
}
367-
Some(TokenTree::Token(Token { kind: token::Interpolated(nt), .. }, _)) => match &**nt {
368-
token::Nonterminal::NtMeta(item) => return item.meta(item.path.span),
369-
token::Nonterminal::NtPath(path) => (**path).clone(),
370-
_ => return None,
371-
},
367+
Some(TokenTree::Delimited(
368+
_span,
369+
_spacing,
370+
Delimiter::Invisible(InvisibleOrigin::MetaVar(
371+
MetaVarKind::Meta | MetaVarKind::Path,
372+
)),
373+
_stream,
374+
)) => {
375+
// This path is currently unreachable in the test suite.
376+
unreachable!()
377+
}
372378
Some(TokenTree::Token(
373379
Token { kind: token::OpenDelim(_) | token::CloseDelim(_), .. },
374380
_,
@@ -411,7 +417,7 @@ impl MetaItemKind {
411417
tokens: &mut impl Iterator<Item = &'a TokenTree>,
412418
) -> Option<MetaItemKind> {
413419
match tokens.next() {
414-
Some(TokenTree::Delimited(.., Delimiter::Invisible, inner_tokens)) => {
420+
Some(TokenTree::Delimited(.., Delimiter::Invisible(_), inner_tokens)) => {
415421
MetaItemKind::name_value_from_tokens(&mut inner_tokens.trees())
416422
}
417423
Some(TokenTree::Token(token, _)) => {
@@ -549,7 +555,7 @@ impl NestedMetaItem {
549555
tokens.next();
550556
return Some(NestedMetaItem::Lit(lit));
551557
}
552-
Some(TokenTree::Delimited(.., Delimiter::Invisible, inner_tokens)) => {
558+
Some(TokenTree::Delimited(.., Delimiter::Invisible(_), inner_tokens)) => {
553559
tokens.next();
554560
return NestedMetaItem::from_tokens(&mut inner_tokens.trees().peekable());
555561
}

Diff for: compiler/rustc_ast/src/mut_visit.rs

+3-61
Original file line numberDiff line numberDiff line change
@@ -745,9 +745,9 @@ fn visit_lazy_tts<T: MutVisitor>(vis: &mut T, lazy_tts: &mut Option<LazyAttrToke
745745
visit_lazy_tts_opt_mut(vis, lazy_tts.as_mut());
746746
}
747747

748-
/// Applies ident visitor if it's an ident; applies other visits to interpolated nodes.
749-
/// In practice the ident part is not actually used by specific visitors right now,
750-
/// but there's a test below checking that it works.
748+
/// Applies ident visitor if it's an ident. In practice this is not actually
749+
/// used by specific visitors right now, but there's a test below checking that
750+
/// it works.
751751
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
752752
pub fn visit_token<T: MutVisitor>(vis: &mut T, t: &mut Token) {
753753
let Token { kind, span } = t;
@@ -765,69 +765,11 @@ pub fn visit_token<T: MutVisitor>(vis: &mut T, t: &mut Token) {
765765
token::NtLifetime(ident, _is_raw) => {
766766
vis.visit_ident(ident);
767767
}
768-
token::Interpolated(nt) => {
769-
let nt = Lrc::make_mut(nt);
770-
visit_nonterminal(vis, nt);
771-
}
772768
_ => {}
773769
}
774770
vis.visit_span(span);
775771
}
776772

777-
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
778-
/// Applies the visitor to elements of interpolated nodes.
779-
//
780-
// N.B., this can occur only when applying a visitor to partially expanded
781-
// code, where parsed pieces have gotten implanted ito *other* macro
782-
// invocations. This is relevant for macro hygiene, but possibly not elsewhere.
783-
//
784-
// One problem here occurs because the types for flat_map_item, flat_map_stmt,
785-
// etc., allow the visitor to return *multiple* items; this is a problem for the
786-
// nodes here, because they insist on having exactly one piece. One solution
787-
// would be to mangle the MutVisitor trait to include one-to-many and
788-
// one-to-one versions of these entry points, but that would probably confuse a
789-
// lot of people and help very few. Instead, I'm just going to put in dynamic
790-
// checks. I think the performance impact of this will be pretty much
791-
// nonexistent. The danger is that someone will apply a `MutVisitor` to a
792-
// partially expanded node, and will be confused by the fact that their
793-
// `flat_map_item` or `flat_map_stmt` isn't getting called on `NtItem` or `NtStmt`
794-
// nodes. Hopefully they'll wind up reading this comment, and doing something
795-
// appropriate.
796-
//
797-
// BTW, design choice: I considered just changing the type of, e.g., `NtItem` to
798-
// contain multiple items, but decided against it when I looked at
799-
// `parse_item_or_view_item` and tried to figure out what I would do with
800-
// multiple items there....
801-
fn visit_nonterminal<T: MutVisitor>(vis: &mut T, nt: &mut token::Nonterminal) {
802-
match nt {
803-
token::NtItem(item) => visit_clobber(item, |item| {
804-
// This is probably okay, because the only visitors likely to
805-
// peek inside interpolated nodes will be renamings/markings,
806-
// which map single items to single items.
807-
vis.flat_map_item(item).expect_one("expected visitor to produce exactly one item")
808-
}),
809-
token::NtBlock(block) => vis.visit_block(block),
810-
token::NtStmt(stmt) => visit_clobber(stmt, |stmt| {
811-
// See reasoning above.
812-
stmt.map(|stmt| {
813-
vis.flat_map_stmt(stmt).expect_one("expected visitor to produce exactly one item")
814-
})
815-
}),
816-
token::NtPat(pat) => vis.visit_pat(pat),
817-
token::NtExpr(expr) => vis.visit_expr(expr),
818-
token::NtTy(ty) => vis.visit_ty(ty),
819-
token::NtLiteral(expr) => vis.visit_expr(expr),
820-
token::NtMeta(item) => {
821-
let AttrItem { unsafety: _, path, args, tokens } = item.deref_mut();
822-
vis.visit_path(path);
823-
visit_attr_args(vis, args);
824-
visit_lazy_tts(vis, tokens);
825-
}
826-
token::NtPath(path) => vis.visit_path(path),
827-
token::NtVis(visib) => vis.visit_vis(visib),
828-
}
829-
}
830-
831773
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
832774
fn visit_defaultness<T: MutVisitor>(vis: &mut T, defaultness: &mut Defaultness) {
833775
match defaultness {

0 commit comments

Comments
 (0)