Skip to content

Commit 11e95d4

Browse files
committed
Name the field in Expander.
For code clarity.
1 parent 1b3fba0 commit 11e95d4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

compiler/rustc_builtin_macros/src/derive.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ use rustc_session::Session;
1010
use rustc_span::symbol::{sym, Ident};
1111
use rustc_span::{ErrorGuaranteed, Span};
1212

13-
pub(crate) struct Expander(pub bool);
13+
pub(crate) struct Expander {
14+
pub is_const: bool,
15+
}
1416

1517
impl MultiItemModifier for Expander {
1618
fn expand(
@@ -58,7 +60,7 @@ impl MultiItemModifier for Expander {
5860
report_path_args(sess, meta);
5961
meta.path.clone()
6062
})
61-
.map(|path| (path, dummy_annotatable(), None, self.0))
63+
.map(|path| (path, dummy_annotatable(), None, self.is_const))
6264
.collect()
6365
}
6466
_ => vec![],

compiler/rustc_builtin_macros/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) {
109109
bench: test::expand_bench,
110110
cfg_accessible: cfg_accessible::Expander,
111111
cfg_eval: cfg_eval::expand,
112-
derive: derive::Expander(false),
113-
derive_const: derive::Expander(true),
112+
derive: derive::Expander { is_const: false },
113+
derive_const: derive::Expander { is_const: true },
114114
global_allocator: global_allocator::expand,
115115
test: test::expand_test,
116116
test_case: test::expand_test_case,

0 commit comments

Comments
 (0)