Skip to content

Commit 3d422ae

Browse files
committed
fix(hygiene): Resolve relative paths through inline const parents
Treat inline const blocks as transparent scopes when finding relative paths to adjacent local definitions.
1 parent a6d2c30 commit 3d422ae

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

mutest-emit/src/analysis/res.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ pub fn locally_visible_def_path<'tcx>(tcx: TyCtxt<'tcx>, def_id: hir::DefId, mut
514514
| hir::DefKind::Trait | hir::DefKind::Impl { .. } | hir::DefKind::TraitAlias
515515
| hir::DefKind::Fn | hir::DefKind::Const | hir::DefKind::Static { .. } | hir::DefKind::Ctor(..)
516516
| hir::DefKind::AssocTy | hir::DefKind::AssocFn | hir::DefKind::AssocConst
517-
| hir::DefKind::AnonConst
517+
| hir::DefKind::AnonConst | hir::DefKind::InlineConst
518518
);
519519
while is_transparent(tcx.def_kind(scope)) && let Some(parent_scope) = tcx.opt_parent(scope) {
520520
scope = parent_scope;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@ build
2+
//@ stderr: empty
3+
4+
#![feature(decl_macro)]
5+
6+
macro m() {
7+
// TEST: Relative path to item in parent scope through transparent inline const block.
8+
const _: () = {
9+
const fn f() {}
10+
const { f() };
11+
};
12+
}
13+
14+
m!();

0 commit comments

Comments
 (0)