Skip to content

Commit 3f5f3b2

Browse files
authored
Remove use of ignore from examples.
1 parent 5f49f2d commit 3f5f3b2

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/types/impl-trait.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ The caller must provide a type that satisfies the bounds declared by the anonymo
3131

3232
For example, these two forms are almost equivalent:
3333

34-
```rust,ignore
34+
```rust
3535
trait Trait {}
3636

3737
// generic type parameter
38-
fn foo<T: Trait>(arg: T) {
38+
fn with_generic_type<T: Trait>(arg: T) {
3939
}
4040

4141
// impl Trait in argument position
42-
fn foo(arg: impl Trait) {
42+
fn with_impl_trait(arg: impl Trait) {
4343
}
4444
```
4545

@@ -96,17 +96,23 @@ With `impl Trait`, unlike with a generic type parameter, the function chooses th
9696

9797
The function:
9898

99-
```rust,ignore
99+
```rust
100+
# trait Trait {}
100101
fn foo<T: Trait>() -> T {
102+
// ...
103+
# panic!()
101104
}
102105
```
103106

104107
allows the caller to determine the return type, `T`, and the function returns that type.
105108

106109
The function:
107110

108-
```rust,ignore
111+
```rust
112+
# trait Trait {}
113+
# impl Trait for () {}
109114
fn foo() -> impl Trait {
115+
// ...
110116
}
111117
```
112118

0 commit comments

Comments
 (0)