Skip to content

absolute path names are not correct for crates not in root namespace #1920

Closed
@nikomatsakis

Description

@nikomatsakis

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.

Metadata

Metadata

Assignees

Labels

A-frontendArea: Compiler frontend (errors, parsing and HIR)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions