Skip to content

Add some links to Disambiguating Function Calls. #829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/expressions/call-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ let name: &'static str = (|| "Rust")();

## Disambiguating Function Calls

Rust treats all function calls as sugar for a more explicit, fully-qualified
syntax. Upon compilation, Rust will desugar all function calls into the explicit
Rust treats all function calls as sugar for a more explicit, [fully-qualified
syntax]. Upon compilation, Rust will desugar all function calls into the explicit
form. Rust may sometimes require you to qualify function calls with trait,
depending on the ambiguity of a call in light of in-scope items.

Expand All @@ -42,8 +42,8 @@ referent of method or associated function calls. These situations may include:
* Multiple in-scope traits define methods with the same name for the same types
* Auto-`deref` is undesirable; for example, distinguishing between methods on a
smart pointer itself and the pointer's referent
* Methods which take no arguments, like `default()`, and return properties of a
type, like `size_of()`
* Methods which take no arguments, like [`default()`], and return properties of a
type, like [`size_of()`]

To resolve the ambiguity, the programmer may refer to their desired method or
function using more specific paths, types, or traits.
Expand Down Expand Up @@ -93,9 +93,11 @@ fn main() {

Refer to [RFC 132] for further details and motivations.

[`std::ops::Fn`]: ../../std/ops/trait.Fn.html
[`std::ops::FnMut`]: ../../std/ops/trait.FnMut.html
[`std::ops::FnOnce`]: ../../std/ops/trait.FnOnce.html
[RFC 132]: https://github.com/rust-lang/rfcs/blob/master/text/0132-ufcs.md

[_Expression_]: ../expressions.md
[`default()`]: ../../std/default/trait.Default.html#tymethod.default
[`size_of()`]: ../../std/mem/fn.size_of.html
[`std::ops::FnMut`]: ../../std/ops/trait.FnMut.html
[`std::ops::FnOnce`]: ../../std/ops/trait.FnOnce.html
[`std::ops::Fn`]: ../../std/ops/trait.Fn.html
[fully-qualified syntax]: ../paths.md#qualified-paths