mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-08 13:02:50 +00:00
Suggest f() for functions and add a test case
This commit is contained in:
parent
fc273a035d
commit
2dad90d8b5
@ -893,6 +893,8 @@ impl Disambiguator {
|
||||
fn display_for(kind: DefKind, path_str: &str) -> String {
|
||||
if kind == DefKind::Macro(MacroKind::Bang) {
|
||||
return format!("{}!", path_str);
|
||||
} else if kind == DefKind::Fn || kind == DefKind::AssocFn {
|
||||
return format!("{}()", path_str);
|
||||
}
|
||||
let prefix = match kind {
|
||||
DefKind::Struct => "struct",
|
||||
@ -904,7 +906,6 @@ impl Disambiguator {
|
||||
"const"
|
||||
}
|
||||
DefKind::Static => "static",
|
||||
DefKind::Fn | DefKind::AssocFn => "fn",
|
||||
DefKind::Macro(MacroKind::Derive) => "derive",
|
||||
// Now handle things that don't have a specific disambiguator
|
||||
_ => match kind
|
||||
|
@ -60,4 +60,9 @@ trait T {}
|
||||
//~^ ERROR incompatible link kind for `c`
|
||||
//~| NOTE this link resolved
|
||||
//~| HELP use its disambiguator
|
||||
|
||||
/// Link to [const@f]
|
||||
//~^ ERROR incompatible link kind for `f`
|
||||
//~| NOTE this link resolved
|
||||
//~| HELP use its disambiguator
|
||||
pub fn f() {}
|
||||
|
@ -83,5 +83,13 @@ LL | /// Link to [c()]
|
||||
|
|
||||
= note: this link resolved to a constant, which is not a function
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
error: incompatible link kind for `f`
|
||||
--> $DIR/intra-links-disambiguator-mismatch.rs:64:14
|
||||
|
|
||||
LL | /// Link to [const@f]
|
||||
| ^^^^^^^ help: to link to the function, use its disambiguator: `f()`
|
||||
|
|
||||
= note: this link resolved to a function, which is not a constant
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user