Skip to content

Commit

Permalink
Merge pull request #1495 from drewtato/impl-trait-and-generics
Browse files Browse the repository at this point in the history
Remove outdated info about impl Trait in parameters and generics in the same function
  • Loading branch information
traviscross authored Jun 18, 2024
2 parents 0b805c6 + c8179f6 commit 431d20e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/types/impl-trait.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ That is, `impl Trait` in argument position is syntactic sugar for a generic type
> **Note:**
> For function parameters, generic type parameters and `impl Trait` are not exactly equivalent.
> With a generic parameter such as `<T: Trait>`, the caller has the option to explicitly specify the generic argument for `T` at the call site using [_GenericArgs_], for example, `foo::<usize>(1)`.
> If `impl Trait` is the type of *any* function parameter, then the caller can't ever provide any generic arguments when calling that function.
This includes generic arguments for the return type or any const generics.
>
> Therefore, changing the function signature from either one to the other can constitute a breaking change for the callers of a function.
> Changing a parameter from either one to the other can constitute a breaking change for the callers of a function, since this changes the number of generic arguments.
## Abstract return types

Expand Down

0 comments on commit 431d20e

Please sign in to comment.