How to disambiguate for a field in rustdoc?

Consider the following piece of documented code:

pub struct S {
    pub a: i32,

impl S {
    pub fn a(&self, modifier: i32) -> i32 {
        self.a * modifier

/// Link to function: [S::a]
/// Link to function: [S::a](fn@S)
/// Link to field: [S::a](???@S)
pub fn documented() {}

The link [S::a] is ambiguous (but rustdoc does not warn about this), and automatically resolves to the member function. In the documentation about disambiguators, there is a mention of fn@ to disambiguate to the function on a name clash. However there is no mention on how to disambiguate to the field.

Not that, if we remove the function, then [S::a] links to the field.

How can I disambiguate [S::a] to the field, if both the field and the function are present?

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.