mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Use nearest non block module as the correct parent module
This commit is contained in:
@@ -3097,6 +3097,8 @@ pub(crate) fn find_cfg_stripped(&self, err: &mut Diag<'_>, segment: &Symbol, mod
|
||||
continue;
|
||||
}
|
||||
|
||||
let parent_module = self.get_nearest_non_block_module(parent_scope).def_id();
|
||||
|
||||
fn comes_from_same_module_for_glob(
|
||||
r: &Resolver<'_, '_>,
|
||||
parent_module: DefId,
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
//@ edition: 2015
|
||||
|
||||
pub(in a) mod aa { //~ ERROR cannot find module or crate `a` in the crate root
|
||||
}
|
||||
mod test {
|
||||
#[cfg(test)]
|
||||
use super::a;
|
||||
}
|
||||
fn main() {}
|
||||
@@ -0,0 +1,21 @@
|
||||
error[E0433]: cannot find module or crate `a` in the crate root
|
||||
--> $DIR/pub-in-path-153848.rs:3:8
|
||||
|
|
||||
LL | pub(in a) mod aa {
|
||||
| ^ use of unresolved module or unlinked crate `a`
|
||||
|
|
||||
note: found an item that was configured out
|
||||
--> $DIR/pub-in-path-153848.rs:7:16
|
||||
|
|
||||
LL | #[cfg(test)]
|
||||
| ---- the item is gated here
|
||||
LL | use super::a;
|
||||
| ^
|
||||
help: you might be missing a crate named `a`, add it to your project and import it in your code
|
||||
|
|
||||
LL + extern crate a;
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0433`.
|
||||
Reference in New Issue
Block a user