rust/tests/ui/impl-trait/issues/issue-89312.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
433 B
Rust
Raw Normal View History

2022-02-17 13:55:58 +00:00
#![feature(type_alias_impl_trait)]
//@ check-pass
mod helper {
pub trait T {
type Item;
}
2022-02-17 13:55:58 +00:00
pub type Alias<'a> = impl T<Item = &'a ()>;
2022-02-17 13:55:58 +00:00
struct S;
impl<'a> T for &'a S {
type Item = &'a ();
}
2022-02-17 13:55:58 +00:00
pub fn filter_positive<'a>() -> Alias<'a> {
&S
}
2022-02-17 13:55:58 +00:00
}
use helper::*;
2022-02-17 13:55:58 +00:00
fn with_positive(fun: impl Fn(Alias<'_>)) {
fun(filter_positive());
}
fn main() {
with_positive(|_| ());
}