Skip to content

Commit 6257bd2

Browse files
committed
rustdoc: clean up method path index
This removes a special case that doesn't seem to do anything any more.
1 parent bb4ecc3 commit 6257bd2

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

src/librustdoc/formats/cache.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -288,15 +288,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
288288
// for where the type was defined. On the other
289289
// hand, `paths` always has the right
290290
// information if present.
291-
Some(&(
292-
ref fqp,
293-
ItemType::Trait
294-
| ItemType::Struct
295-
| ItemType::Union
296-
| ItemType::Enum
297-
| ItemType::Typedef,
298-
)) => Some(&fqp[..fqp.len() - 1]),
299-
Some(..) => Some(&*self.cache.stack),
291+
Some(&(ref fqp, _)) => Some(&fqp[..fqp.len() - 1]),
300292
None => None,
301293
};
302294
((Some(*last), path), true)
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const QUERY = 'MyForeignType::my_method';
2+
3+
const EXPECTED = {
4+
'others': [
5+
// Test case for https://github.com/rust-lang/rust/pull/96887#pullrequestreview-967154358
6+
// Validates that the parent path for a foreign type method is correct.
7+
{ 'path': 'foreign_type_path::aaaaaaa::MyForeignType', 'name': 'my_method' },
8+
],
9+
};
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![feature(extern_types)]
2+
3+
pub mod aaaaaaa {
4+
5+
extern {
6+
pub type MyForeignType;
7+
}
8+
9+
impl MyForeignType {
10+
pub fn my_method() {}
11+
}
12+
13+
}

0 commit comments

Comments
 (0)