Skip to content

Commit 7e294a5

Browse files
Fix tests/ui/rust-2018/removing-extern-crate-malformed-cfg.rs test
1 parent 219d6bb commit 7e294a5

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

compiler/rustc_expand/src/config.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use std::iter;
44

5+
use rustc_ast::attr::data_structures::CfgEntry;
56
use rustc_ast::token::{Delimiter, Token, TokenKind};
67
use rustc_ast::tokenstream::{
78
AttrTokenStream, AttrTokenTree, LazyAttrTokenStream, Spacing, TokenTree, WithTokens,
@@ -254,7 +255,10 @@ impl<'a> StripUnconfigured<'a> {
254255
self.features,
255256
self.lint_node_id,
256257
) else {
257-
return vec![];
258+
let trace_attr = cfg_attr.clone().convert_normal_to_synthetic(
259+
SyntheticAttr::CfgAttrTrace(CfgEntry::Bool(true, cfg_attr.span)),
260+
);
261+
return vec![trace_attr];
258262
};
259263

260264
// Lint on zero attributes in source.

0 commit comments

Comments
 (0)