Skip to content

Commit ddd20ef

Browse files
committed
expand: Do not allocate Lrc for allow_internal_unstable list unless necessary
1 parent a15f484 commit ddd20ef

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/rustc_expand/src/base.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ impl SyntaxExtension {
757757
attrs: &[ast::Attribute],
758758
) -> SyntaxExtension {
759759
let allow_internal_unstable =
760-
Some(attr::allow_internal_unstable(sess, &attrs).collect::<Vec<Symbol>>().into());
760+
attr::allow_internal_unstable(sess, &attrs).collect::<Vec<Symbol>>();
761761

762762
let mut local_inner_macros = false;
763763
if let Some(macro_export) = sess.find_by_name(attrs, sym::macro_export) {
@@ -779,7 +779,8 @@ impl SyntaxExtension {
779779
SyntaxExtension {
780780
kind,
781781
span,
782-
allow_internal_unstable,
782+
allow_internal_unstable: (!allow_internal_unstable.is_empty())
783+
.then(|| allow_internal_unstable.into()),
783784
allow_internal_unsafe: sess.contains_name(attrs, sym::allow_internal_unsafe),
784785
local_inner_macros,
785786
stability,

0 commit comments

Comments
 (0)