Skip to content

Commit

Permalink
Add regression test for jump to def static method calls
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jan 4, 2024
1 parent 35ad2ae commit 5bc7687
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/rustdoc/check-source-code-urls-to-def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub trait AnotherTrait2 {}

// @has - '//pre[@class="rust"]//a[@href="#61"]' 'AnotherTrait2'
pub fn foo4() {
let x: Vec<AnotherTrait2> = Vec::new();
let x: Vec<&dyn AnotherTrait2> = Vec::new();
}

// @has - '//pre[@class="rust"]//a[@href="../../foo/primitive.bool.html"]' 'bool'
Expand Down
27 changes: 27 additions & 0 deletions tests/rustdoc/jump-to-def-doc-links-calls.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// compile-flags: -Zunstable-options --generate-link-to-definition

#![crate_name = "foo"]

// @has 'src/foo/jump-to-def-doc-links-calls.rs.html'

// @has - '//a[@href="../../foo/struct.Bar.html"]' 'Bar'
pub struct Bar;

impl std::default::Default for Bar {
// @has - '//a[@href="#20-22"]' 'Self::new'
fn default() -> Self {
Self::new()
}
}

// @has - '//a[@href="#8"]' 'Bar'
impl Bar {
// @has - '//a[@href="#24-26"]' 'Self::bar'
pub fn new()-> Self {
Self::bar()
}

pub fn bar() -> Self {
Self
}
}

0 comments on commit 5bc7687

Please sign in to comment.