You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
absolute path names are not correct for crates not in root namespace #1920
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.
@nikomatsakis , I share @cmr's lack of understanding of what the issue actually is here. And it's been a loooong time. So, without some code to reproduce, I'm giving this a close.
mod foo {
extern crate core;
}
fn assert_clone<T>() where T : Clone { }
fn main() {
assert_clone::<foo::core::atomic::AtomicBool>();
}
csguest@itl:~$ rustc foo.rs
foo.rs:8:2: 8:47 error: the trait `core::clone::Clone` is not implemented for the type `core::atomic::AtomicBool`
foo.rs:8 assert_clone::<foo::core::atomic::AtomicBool>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:8:5: 8:56 error: the trait `foo::core::clone::Clone` is not implemented for the type `foo::core::sync::atomic::AtomicBool` [E0277]
<anon>:8 assert_clone::<foo::core::sync::atomic::AtomicBool>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The nightly is fine, stable isn't, so this looks fixed.
Activity
catamorphism commentedon Mar 8, 2012
assigning this to @nikomatsakis since you seem to be the author of the relevant code :-)
emberian commentedon Jul 1, 2013
@nikomatsakis can you clarify this, possibly with a broken test case? I don't quite understand the description.
thestinger commentedon Aug 19, 2013
Triage bump.
emberian commentedon Mar 18, 2014
Visiting for triage. Presumably still an issue.
steveklabnik commentedon Jan 20, 2015
@nikomatsakis , I share @cmr's lack of understanding of what the issue actually is here. And it's been a loooong time. So, without some code to reproduce, I'm giving this a close.
emberian commentedon Jan 20, 2015
I get this now, seeing if I can repro.
emberian commentedon Jan 20, 2015
Repro:
emberian commentedon Jan 20, 2015
(note that there is a fixme in the code, as suggested by the issue description)
steveklabnik commentedon Jan 20, 2015
👍 ❤️
nikomatsakis commentedon Feb 2, 2015
Another related issue here is that we have no way to take into account re-exports -- see the reference to
core, for example, and notstd.nikomatsakis commentedon Feb 2, 2015
(Handling re-exports may require some sort of annotations though.)
nikomatsakis commentedon Feb 2, 2015
ps I remember filing this bug and can hardly believe it's still a thing. ;)
2 remaining items
nikomatsakis commentedon Oct 4, 2015
Hmm. There was an effort to fix this. Not sure why it is not handling that test case.I will investigate.
mitaa commentedon Oct 5, 2015
There is a compile-fail test for this case, so this should work, though this change is not in stable rust yet.
jonas-schievink commentedon Oct 29, 2015
But it looks correct?
The nightly is fine, stable isn't, so this looks fixed.
nikomatsakis commentedon Oct 29, 2015
Closing as fixed, thanks!
Validate function/method stubs (rust-lang#1920)
Update run-make test description (rust-lang#1920)
Update run-make test description (rust-lang#1920)
Merge pull request rust-lang#1920 from a4lg/clippy-warnings-2025.09
Merge pull request rust-lang#1920 from a4lg/clippy-warnings-2025.09
Merge pull request rust-lang#1920 from a4lg/clippy-warnings-2025.09
Merge pull request rust-lang#1920 from a4lg/clippy-warnings-2025.09
Merge rust-lang#1928