Skip to content

Commit f267718

Browse files
authored
Add opaque type attributes
This allows for the code to compile on `nightly`.
1 parent e76d93c commit f267718

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/opaque-types-impl-trait-inference.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ it can work across functions and function bodies.
1313
To help explain how it works, let's consider an example.
1414

1515
```rust
16+
#![feature(type_alias_impl_trait)]
1617
mod m {
1718
pub type Seq<T> = impl IntoIterator<Item = T>;
1819

20+
#[define_opaque(Seq)]
1921
pub fn produce_singleton<T>(t: T) -> Seq<T> {
2022
vec![t]
2123
}
2224

25+
#[define_opaque(Seq)]
2326
pub fn produce_doubleton<T>(t: T, u: T) -> Seq<T> {
2427
vec![t, u]
2528
}

0 commit comments

Comments
 (0)