rust-lang / rust-lang/reference

Mismatch between 'Warning' in 'Method call expressions' section and compiler behaviour

Open
#1,522 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-method-call Language Cleanup
Dominant language
Rust
Stars
1.6k
Forks
607
PR merge metrics
PR metrics pending

Description

The warning text in the doc says:

'Warning: For trait objects, if there is an inherent method of the same name as a trait method, it will give a compiler error when trying to call the method in a method call expression.'
https://doc.rust-lang.org/reference/expressions/method-call-expr.html

However, the following Playground code compiles and calls the trait object method: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=ee3edd82619f479bdc9980c03b2f201f

This suggests that the warning is incorrect, and should be deleted.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Method call expressions section of the Rust Reference page linked in the issue and compare its warning with the linked Playground example. Done means the documentation accurately describes the compiler behavior, including removing the warning if the example confirms it is incorrect.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.