rustdoc: clean up method path index

This removes a special case that doesn't seem to do anything
any more.
This commit is contained in:
Michael Howell 2022-05-10 08:59:59 -07:00
parent bb4ecc3fd8
commit 6257bd2f4e
3 changed files with 23 additions and 9 deletions

View file

@ -288,15 +288,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
// for where the type was defined. On the other
// hand, `paths` always has the right
// information if present.
Some(&(
ref fqp,
ItemType::Trait
| ItemType::Struct
| ItemType::Union
| ItemType::Enum
| ItemType::Typedef,
)) => Some(&fqp[..fqp.len() - 1]),
Some(..) => Some(&*self.cache.stack),
Some(&(ref fqp, _)) => Some(&fqp[..fqp.len() - 1]),
None => None,
};
((Some(*last), path), true)

View file

@ -0,0 +1,9 @@
const QUERY = 'MyForeignType::my_method';
const EXPECTED = {
'others': [
// Test case for https://github.com/rust-lang/rust/pull/96887#pullrequestreview-967154358
// Validates that the parent path for a foreign type method is correct.
{ 'path': 'foreign_type_path::aaaaaaa::MyForeignType', 'name': 'my_method' },
],
};

View file

@ -0,0 +1,13 @@
#![feature(extern_types)]
pub mod aaaaaaa {
extern {
pub type MyForeignType;
}
impl MyForeignType {
pub fn my_method() {}
}
}