Merge pull request #2435 from smanilov/patch-19

Add opaque type attributes
This commit is contained in:
Tshepang Mbambo 2025-06-02 11:55:19 +02:00 committed by GitHub
commit 08e9bce01c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -13,13 +13,16 @@ it can work across functions and function bodies.
To help explain how it works, let's consider an example.
```rust
#![feature(type_alias_impl_trait)]
mod m {
pub type Seq<T> = impl IntoIterator<Item = T>;
#[define_opaque(Seq)]
pub fn produce_singleton<T>(t: T) -> Seq<T> {
vec![t]
}
#[define_opaque(Seq)]
pub fn produce_doubleton<T>(t: T, u: T) -> Seq<T> {
vec![t, u]
}