Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #96931

Merged
merged 19 commits into from
May 11, 2022
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rustdoc: clean up method path index
This removes a special case that doesn't seem to do anything
any more.
notriddle committed May 10, 2022
commit 6257bd2f4ef748d9bad0c60d0df5201e824f4fde
10 changes: 1 addition & 9 deletions src/librustdoc/formats/cache.rs
Original file line number Diff line number Diff line change
@@ -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)
9 changes: 9 additions & 0 deletions src/test/rustdoc-js/foreign-type-path.js
Original file line number Diff line number Diff line change
@@ -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' },
],
};
13 changes: 13 additions & 0 deletions src/test/rustdoc-js/foreign-type-path.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#![feature(extern_types)]

pub mod aaaaaaa {

extern {
pub type MyForeignType;
}

impl MyForeignType {
pub fn my_method() {}
}

}