File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
compiler/rustc_builtin_macros/src Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -122,11 +122,7 @@ pub fn expand_test_or_bench(
122
122
let ast::ItemKind::Fn(fn_) = &item.kind else {
123
123
not_testable_error(cx, attr_sp, Some(&item));
124
124
return if is_stmt {
125
- vec![Annotatable::Stmt(P(ast::Stmt {
126
- id: ast::DUMMY_NODE_ID,
127
- span: item.span,
128
- kind: ast::StmtKind::Item(item),
129
- }))]
125
+ vec![Annotatable::Stmt(P(cx.stmt_item(item.span, item)))]
130
126
} else {
131
127
vec![Annotatable::Item(item)]
132
128
};
@@ -138,7 +134,11 @@ pub fn expand_test_or_bench(
138
134
if (!is_bench && !has_test_signature(cx, &item))
139
135
|| (is_bench && !has_bench_signature(cx, &item))
140
136
{
141
- return vec![Annotatable::Item(item)];
137
+ return if is_stmt {
138
+ vec![Annotatable::Stmt(P(cx.stmt_item(item.span, item)))]
139
+ } else {
140
+ vec![Annotatable::Item(item)]
141
+ };
142
142
}
143
143
144
144
let sp = cx.with_def_site_ctxt(item.span);
You can’t perform that action at this time.
0 commit comments