Skip to content

Commit 435a80b

Browse files
authored
Unrolled build for rust-lang#126735
Rollup merge of rust-lang#126735 - bvanjoi:fix-126647, r=petrochenkov collect attrs in const block expr Fixes rust-lang#126516 Fixes rust-lang#126647 It was forgotten to collect these attributes in the const block expression. r? `@petrochenkov`
2 parents cb8a7ea + 1e42bb6 commit 435a80b

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

compiler/rustc_resolve/src/def_collector.rs

+3
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> {
343343
self.create_def(expr.id, kw::Empty, DefKind::Closure, expr.span)
344344
}
345345
ExprKind::ConstBlock(ref constant) => {
346+
for attr in &expr.attrs {
347+
visit::walk_attribute(self, attr);
348+
}
346349
let def = self.create_def(
347350
constant.id,
348351
kw::Empty,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// issue#126516
2+
// issue#126647
3+
4+
fn main() {
5+
const {
6+
#![path = foo!()]
7+
//~^ ERROR: cannot find macro `foo` in this scope
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: cannot find macro `foo` in this scope
2+
--> $DIR/path-attr-in-const-block.rs:6:19
3+
|
4+
LL | #![path = foo!()]
5+
| ^^^
6+
7+
error: aborting due to 1 previous error
8+

0 commit comments

Comments
 (0)