Closed
Description
The following code compiles correctly:
struct Foo;
mod inner {
use super::Foo;
}
However, when wrapped in a function:
fn outer() {
struct Foo;
mod inner {
use super::Foo;
}
}
it gives the following error:
error[E0432]: unresolved import `super::Foo`
--> src/lib.rs:4:13
|
4 | use super::Foo;
| ^^^^^^^^^^ no `Foo` in the root
error: aborting due to previous error
This can make it difficult to write attribute macros which expand to module declarations. Ideally, such macros would be useeable no matter where the annotated type is declared. However, this issue prevents such macros from being used on a type declared within a function.