Skip to content

Commit 48d970e

Browse files
committed
impl-trait: don't talk about future Rust
Rename and rework the "Using `impl Trait` in more places" into a "Limitations" section.
1 parent d9264ab commit 48d970e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/types/impl-trait.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,10 @@ With `impl Trait`, the function asserts that the return type will implement this
160160
So with `impl Trait`, unlike with a generic type parameter for the return type, the caller can't choose the return type, and the function itself gets to choose.
161161
If we tried to define parse with `Result<impl F,...` as the return type, it wouldn't work.
162162

163-
### Using `impl Trait` in more places
163+
## Limitations
164164

165-
As previously mentioned, as a start, you will only be able to use `impl Trait` as the argument or return type of a free or inherent function.
166-
However, `impl Trait` can't be used inside implementations of traits, nor can it be used as the type of a let binding or inside a type alias.
167-
Some of these restrictions will eventually be lifted.
168-
For more information, see the [tracking issue on `impl Trait`](https://github.com/rust-lang/rust/issues/34511).
165+
`impl Trait` can only appear as the argument or return type of a free or inherent function.
166+
It cannot appear inside implementations of traits, nor can it be the type of a let binding or appear inside a type alias.
169167

170168
[closures]: closure.md
171169
[_GenericArgs_]: ../paths.md#paths-in-expressions

0 commit comments

Comments
 (0)