Require any function with a tait in its signature to actually constrain a hidden type
This commit is contained in:
parent
39e7bf6826
commit
0bc2001879
116 changed files with 1524 additions and 708 deletions
|
@ -2,20 +2,23 @@
|
|||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
trait T {
|
||||
type Item;
|
||||
}
|
||||
mod helper {
|
||||
pub trait T {
|
||||
type Item;
|
||||
}
|
||||
|
||||
type Alias<'a> = impl T<Item = &'a ()>;
|
||||
pub type Alias<'a> = impl T<Item = &'a ()>;
|
||||
|
||||
struct S;
|
||||
impl<'a> T for &'a S {
|
||||
type Item = &'a ();
|
||||
}
|
||||
struct S;
|
||||
impl<'a> T for &'a S {
|
||||
type Item = &'a ();
|
||||
}
|
||||
|
||||
fn filter_positive<'a>() -> Alias<'a> {
|
||||
&S
|
||||
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