diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-07-06 11:20:42 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-07-06 11:20:42 +0200 |
commit | e9381670d610d4525a89b3dc65d43a58329a4aa5 (patch) | |
tree | 924c59c7dc246c2a8c2e485ec96b57755ac2c2dc /src | |
parent | 9b4bd6bff754e6b654f85fc676288ff660dbc6b3 (diff) |
ir: Properly skip inline namespaces when building names.
Fixes #789
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/item.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ir/item.rs b/src/ir/item.rs index 3564c6e8..cfda4953 100644 --- a/src/ir/item.rs +++ b/src/ir/item.rs @@ -768,9 +768,19 @@ impl Item { .ancestors(ctx) .filter(|id| *id != ctx.root_module()) .take_while(|id| { - // Stop iterating ancestors once we reach a namespace. + // Stop iterating ancestors once we reach a non-inline namespace + // when opt.within_namespaces is set. !opt.within_namespaces || !ctx.resolve_item(*id).is_module() }) + .filter(|id| { + if !ctx.options().conservative_inline_namespaces { + if let ItemKind::Module(ref module) = *ctx.resolve_item(*id).kind() { + return !module.is_inline(); + } + } + + true + }) .map(|id| { let item = ctx.resolve_item(id); let target = ctx.resolve_item(item.name_target(ctx)); |