# Context-independent item paths

**URL:** <https://internals.rust-lang.org/t/context-independent-item-paths/3364>\
**Category:** Uncategorized\
**Created:** [April 12, 2016, 12:41am UTC](https://internals.rust-lang.org/t/context-independent-item-paths/3364 "2016-04-12T00:41:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kha](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/kha/32/6055_2.png) [@Kha](https://internals.rust-lang.org/u/Kha)\
**Post date:** [April 12, 2016, 12:41am UTC](https://internals.rust-lang.org/t/context-independent-item-paths/3364/1 "2016-04-12T00:41:40Z")

</div>

Hi all,

I’m using librustc in an experimental project to analyze definitions in crates, including `core` and `std`. To export the findings in a format that is both human-readable and unambiguous, I’ve relied on `ctxt::item_path_str` until now. However, with the current nightly, I now get some ambiguous paths, even after switching to `absolute_item_path_str`:

```rust
<u32 as num::One>::one # in core
...
<u32 as core::num::One>::one # in std
...
<u32 as std::num::One>::one # outside of std

```

The problem seems to be that `absolute_item_path_str` indirectly calls `item_path_str`, e.g. via `TraitRef`'s `Display` implementation. Is this behavior expected? I don’t expect you to change your internal APIs just for my sake, but I’m wondering whether this could also negatively affect symbol names (the only internal user of `Absolute`, afaik). For example, dylibs or incremental compilation.

PS: I know that `absolute_item_path_str` isn’t guaranteed to produce unique output, but I can live with some rare collisions.

---

<div class="post-metadata">

**Author:** ![Kha](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/kha/32/6055_2.png) [@Kha](https://internals.rust-lang.org/u/Kha)\
**Post date:** [April 14, 2016, 11:58am UTC](https://internals.rust-lang.org/t/context-independent-item-paths/3364/2 "2016-04-14T11:58:09Z")

</div>

Ok, after finding [a similar issue](https://github.com/rust-lang/rust/issues/32554), I’m convinced that this change is indeed unintended, and have opened [https://github.com/rust-lang/rust/issues/32948](https://github.com/rust-lang/rust/issues/32948).

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [March 25, 2019, 8:26am UTC](https://internals.rust-lang.org/t/context-independent-item-paths/3364/3 "2019-03-25T08:26:03Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
