Skip to content

Commit cff5644

Browse files
authored
Unrolled build for rust-lang#121829
Rollup merge of rust-lang#121829 - nnethercote:dummy-tweaks-2, r=petrochenkov Dummy tweaks (attempt 2) r? `````@petrochenkov`````
2 parents 62415e2 + a9dff2d commit cff5644

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

compiler/rustc_ast/src/mut_visit.rs

+4-14
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,10 @@ pub fn noop_visit_capture_by<T: MutVisitor>(capture_by: &mut CaptureBy, vis: &mu
16041604
}
16051605
}
16061606

1607-
/// Some value for the AST node that is valid but possibly meaningless.
1607+
/// Some value for the AST node that is valid but possibly meaningless. Similar
1608+
/// to `Default` but not intended for wide use. The value will never be used
1609+
/// meaningfully, it exists just to support unwinding in `visit_clobber` in the
1610+
/// case where its closure panics.
16081611
pub trait DummyAstNode {
16091612
fn dummy() -> Self;
16101613
}
@@ -1679,19 +1682,6 @@ impl DummyAstNode for Stmt {
16791682
}
16801683
}
16811684

1682-
impl DummyAstNode for Block {
1683-
fn dummy() -> Self {
1684-
Block {
1685-
stmts: Default::default(),
1686-
id: DUMMY_NODE_ID,
1687-
rules: BlockCheckMode::Default,
1688-
span: Default::default(),
1689-
tokens: Default::default(),
1690-
could_be_bare_literal: Default::default(),
1691-
}
1692-
}
1693-
}
1694-
16951685
impl DummyAstNode for Crate {
16961686
fn dummy() -> Self {
16971687
Crate {

compiler/rustc_expand/src/base.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::expand::{self, AstFragment, Invocation};
44
use crate::module::DirOwnership;
55

66
use rustc_ast::attr::MarkedAttrs;
7-
use rustc_ast::mut_visit::DummyAstNode;
87
use rustc_ast::ptr::P;
98
use rustc_ast::token::{self, Nonterminal};
109
use rustc_ast::tokenstream::TokenStream;
@@ -582,6 +581,17 @@ impl DummyResult {
582581
tokens: None,
583582
})
584583
}
584+
585+
/// A plain dummy crate.
586+
pub fn raw_crate() -> ast::Crate {
587+
ast::Crate {
588+
attrs: Default::default(),
589+
items: Default::default(),
590+
spans: Default::default(),
591+
id: ast::DUMMY_NODE_ID,
592+
is_placeholder: Default::default(),
593+
}
594+
}
585595
}
586596

587597
impl MacResult for DummyResult {
@@ -650,7 +660,7 @@ impl MacResult for DummyResult {
650660
}
651661

652662
fn make_crate(self: Box<DummyResult>) -> Option<ast::Crate> {
653-
Some(DummyAstNode::dummy())
663+
Some(DummyResult::raw_crate())
654664
}
655665
}
656666

0 commit comments

Comments
 (0)