We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
hygienic_lexical_parent
1 parent 0d08467 commit 56f6353Copy full SHA for 56f6353
src/librustc_resolve/lib.rs
@@ -1644,7 +1644,7 @@ impl<'a> Resolver<'a> {
1644
}
1645
1646
if let ModuleKind::Block(..) = module.kind {
1647
- return Some(module.parent.unwrap());
+ return Some(module.parent.unwrap().nearest_item_scope());
1648
1649
1650
None
src/test/ui/resolve/block-with-trait-parent.rs
@@ -0,0 +1,14 @@
1
+// check-pass
2
+
3
+trait Trait {
4
+ fn method(&self) {
5
+ // Items inside a block turn it into a module internally.
6
+ struct S;
7
+ impl Trait for S {}
8
9
+ // OK, `Trait` is in scope here from method resolution point of view.
10
+ S.method();
11
+ }
12
+}
13
14
+fn main() {}
0 commit comments