mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Require any function with a tait in its signature to actually constrain a hidden type
This commit is contained in:
parent
0eb782ba13
commit
4e0af7cc61
@ -2,20 +2,23 @@
|
|||||||
|
|
||||||
#![feature(type_alias_impl_trait)]
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
trait T {
|
mod helper {
|
||||||
|
pub trait T {
|
||||||
type Item;
|
type Item;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Alias<'a> = impl T<Item = &'a ()>;
|
pub type Alias<'a> = impl T<Item = &'a ()>;
|
||||||
|
|
||||||
struct S;
|
struct S;
|
||||||
impl<'a> T for &'a S {
|
impl<'a> T for &'a S {
|
||||||
type Item = &'a ();
|
type Item = &'a ();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn filter_positive<'a>() -> Alias<'a> {
|
pub fn filter_positive<'a>() -> Alias<'a> {
|
||||||
&S
|
&S
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
use helper::*;
|
||||||
|
|
||||||
fn with_positive(fun: impl Fn(Alias<'_>)) {
|
fn with_positive(fun: impl Fn(Alias<'_>)) {
|
||||||
fun(filter_positive());
|
fun(filter_positive());
|
||||||
|
Loading…
Reference in New Issue
Block a user