mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Rollup merge of #96887 - notriddle:notriddle/as-raw-fd, r=jsha
rustdoc: correct path to type alias methods Fixes #83991
This commit is contained in:
commit
ed9faeedda
@ -288,14 +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,
|
||||
)) => Some(&fqp[..fqp.len() - 1]),
|
||||
Some(..) => Some(&*self.cache.stack),
|
||||
Some(&(ref fqp, _)) => Some(&fqp[..fqp.len() - 1]),
|
||||
None => None,
|
||||
};
|
||||
((Some(*last), path), true)
|
||||
|
14
src/test/rustdoc-js-std/asrawfd.js
Normal file
14
src/test/rustdoc-js-std/asrawfd.js
Normal file
@ -0,0 +1,14 @@
|
||||
// ignore-order
|
||||
|
||||
const QUERY = 'RawFd::as_raw_fd';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
// Reproduction test for https://github.com/rust-lang/rust/issues/78724
|
||||
// Validate that type alias methods get the correct path.
|
||||
{ 'path': 'std::os::unix::io::AsRawFd', 'name': 'as_raw_fd' },
|
||||
{ 'path': 'std::os::wasi::io::AsRawFd', 'name': 'as_raw_fd' },
|
||||
{ 'path': 'std::os::linux::process::PidFd', 'name': 'as_raw_fd' },
|
||||
{ 'path': 'std::os::unix::io::RawFd', 'name': 'as_raw_fd' },
|
||||
],
|
||||
};
|
9
src/test/rustdoc-js/foreign-type-path.js
Normal file
9
src/test/rustdoc-js/foreign-type-path.js
Normal 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' },
|
||||
],
|
||||
};
|
13
src/test/rustdoc-js/foreign-type-path.rs
Normal file
13
src/test/rustdoc-js/foreign-type-path.rs
Normal file
@ -0,0 +1,13 @@
|
||||
#![feature(extern_types)]
|
||||
|
||||
pub mod aaaaaaa {
|
||||
|
||||
extern {
|
||||
pub type MyForeignType;
|
||||
}
|
||||
|
||||
impl MyForeignType {
|
||||
pub fn my_method() {}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user