Implement #[define_opaque]
attribute for functions.
This commit is contained in:
parent
2c6a12ec44
commit
cb4751d4b8
653 changed files with 2911 additions and 2580 deletions
|
@ -2,23 +2,21 @@
|
|||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
mod helper {
|
||||
pub trait T {
|
||||
type Item;
|
||||
}
|
||||
|
||||
pub type Alias<'a> = impl T<Item = &'a ()>;
|
||||
|
||||
struct S;
|
||||
impl<'a> T for &'a S {
|
||||
type Item = &'a ();
|
||||
}
|
||||
|
||||
pub fn filter_positive<'a>() -> Alias<'a> {
|
||||
&S
|
||||
}
|
||||
pub trait T {
|
||||
type Item;
|
||||
}
|
||||
|
||||
pub type Alias<'a> = impl T<Item = &'a ()>;
|
||||
|
||||
struct S;
|
||||
impl<'a> T for &'a S {
|
||||
type Item = &'a ();
|
||||
}
|
||||
|
||||
#[define_opaque(Alias)]
|
||||
pub fn filter_positive<'a>() -> Alias<'a> {
|
||||
&S
|
||||
}
|
||||
use helper::*;
|
||||
|
||||
fn with_positive(fun: impl Fn(Alias<'_>)) {
|
||||
fun(filter_positive());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue