Skip to content

Commit 1e42bb6

Browse files
committed
collect attrs in const block expr
1 parent 1d96de2 commit 1e42bb6

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)