mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Support doc links that resolve to fields
This commit is contained in:
parent
70fa270637
commit
0c433c23b1
5 changed files with 219 additions and 68 deletions
|
@ -517,6 +517,62 @@ fn function();
|
|||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn doc_links_field() {
|
||||
check_doc_links(
|
||||
r#"
|
||||
/// [`S::f`]
|
||||
/// [`S2::f`]
|
||||
/// [`T::0`]
|
||||
/// [`U::a`]
|
||||
/// [`E::A::f`]
|
||||
/// [`E::B::0`]
|
||||
struct S$0 {
|
||||
f: i32,
|
||||
//^ S::f
|
||||
//^ S2::f
|
||||
}
|
||||
type S2 = S;
|
||||
struct T(i32);
|
||||
//^^^ T::0
|
||||
union U {
|
||||
a: i32,
|
||||
//^ U::a
|
||||
}
|
||||
enum E {
|
||||
A { f: i32 },
|
||||
//^ E::A::f
|
||||
B(i32),
|
||||
//^^^ E::B::0
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn doc_links_field_via_self() {
|
||||
check_doc_links(
|
||||
r#"
|
||||
/// [`Self::f`]
|
||||
struct S$0 {
|
||||
f: i32,
|
||||
//^ Self::f
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn doc_links_tuple_field_via_self() {
|
||||
check_doc_links(
|
||||
r#"
|
||||
/// [`Self::0`]
|
||||
struct S$0(i32);
|
||||
//^^^ Self::0
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rewrite_html_root_url() {
|
||||
check_rewrite(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue