Skip to content

Commit f9cc030

Browse files
Fix url for intra link provided method
1 parent 135f334 commit f9cc030

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

src/librustdoc/clean/mod.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,13 @@ fn resolve(cx: &DocContext, path_str: &str, is_val: bool) -> Result<(Def, Option
11011101
let kind = match item.kind {
11021102
ty::AssociatedKind::Const if is_val => "associatedconstant",
11031103
ty::AssociatedKind::Type if !is_val => "associatedtype",
1104-
ty::AssociatedKind::Method if is_val => "tymethod",
1104+
ty::AssociatedKind::Method if is_val => {
1105+
if item.defaultness.has_value() {
1106+
"method"
1107+
} else {
1108+
"tymethod"
1109+
}
1110+
}
11051111
_ => return Err(())
11061112
};
11071113

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![crate_name = "foo"]
12+
13+
// @has foo/trait.Foo.html '//a[@href="../foo/trait.Foo.html#tymethod.req"]' 'req'
14+
// @has foo/trait.Foo.html '//a[@href="../foo/trait.Foo.html#method.prov"]' 'prov'
15+
16+
/// Always make sure to implement [`req`], but you don't have to implement [`prov`].
17+
///
18+
/// [`req`]: Foo::req
19+
/// [`prov`]: Foo::prov
20+
pub trait Foo {
21+
/// Required
22+
fn req();
23+
/// Provided
24+
fn prov() {}
25+
}

0 commit comments

Comments
 (0)