diff options
| author | bors <bors@rust-lang.org> | 2018-06-17 09:48:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-06-17 09:48:10 +0000 |
| commit | 594b05dd9786c09c916745c1b1c281a3c54cdbd1 (patch) | |
| tree | 2b277ef34c86f1d97de5494eb492218c26fa5c25 /src/rustllvm/RustWrapper.cpp | |
| parent | aec00f97e1cdcea2b079e209a7e759201ba6ca7c (diff) | |
| parent | 903e2c8afe6907b8828202345f2677a8e14f78fa (diff) | |
| download | rust-594b05dd9786c09c916745c1b1c281a3c54cdbd1.tar.gz rust-594b05dd9786c09c916745c1b1c281a3c54cdbd1.zip | |
Auto merge of #51425 - QuietMisdreavus:thats-def-a-namespace-there, r=petrochenkov
refactor: create multiple HIR items for imports When lowering `use` statements into HIR, they get a `Def` of the thing they're pointing at. This is great for things that need to know what was just pulled into scope. However, this is a bit misleading, because a `use` statement can pull things from multiple namespaces if their names collide. This is a problem for rustdoc, because if there are a module and a function with the same name (for example) then it will only document the module import, because that's that the lowered `use` statement points to. The current version of this PR does the following: * Whenever the resolver comes across a `use` statement, it loads the definitions into a new `import_map` instead of the existing `def_map`. This keeps the resolutions per-namespace so that all the target definitions are available. * When lowering `use` statements, it looks up the resolutions in the `import_map` and creates multiple `Item`s if there is more than one resolution. * To ensure the `NodeId`s are properly tracked in the lowered module, they need to be created in the AST, and pulled out as needed if multiple resolutions are available. Fixes https://github.com/rust-lang/rust/issues/34843
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
