mozilla/rust — Issue #1920: absolute path names are not correct for crates not in root namespace
Author: nikomatsakis
Created: 2012-03-03 01:02:13+00:00
State: open

Right now, if you get the absolute path of an item using the `ty::item_path()` function, and that item is an external crate `x`, you always get a path like `x::foo::bar` where `foo::bar` is the path to the item within the crate `x`. This is usually right but not always, because it is possible that the crate `x` is not linked into the root namespace.

For example, you might have:

```
mod local_mod {
use x;
...
}
```

in which case the right path would be `local_mod::x::foo::bar`.

To fix this, we ought to store some valid path to the crate along with the crate metadata (preferably a shortest path [there could be more than one shortest path]). We can then prepend this path. The function `csearch.rs:get_item_path()` would be the primary one to change.