Skip to content

Commit

Permalink
Auto merge of #130587 - coolreader18:field-variant-doclink-disambig, …
Browse files Browse the repository at this point in the history
…r=notriddle,jyn514

Add `field@` and `variant@` doc-link disambiguators

I'm not sure if this is big enough to need an fcp or not, but this is something I found missing when trying to refer to a field in macro-generated docs, not knowing if a method might be defined as well. Obviously, there are definitely other uses.

In the case where it's not disambiguated, methods (and I suppose other associated items in the value namespace) still take priority, which `@jyn514` said was an oversight but I think is probably the desired behavior 99% of the time anyway - shadowing a field with an accessor method is a very common pattern. If fields and methods with the same name started conflicting, it would be a breaking change. Though, to quote them:

> jyn: maybe you can break this only if both [the method and the field] are public
> jyn: rustc has some future-incompat warning level
> jyn: that gets through -A warnings and --cap-lints from cargo

That'd be out of scope of this PR, though.

Fixes #80283
  • Loading branch information
bors committed Oct 1, 2024
2 parents 84e0a55 + 1cdcb63 commit cf60e96
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit cf60e96

Please sign in to comment.