Skip to content

Commit

Permalink
Require any function with a tait in its signature to actually constra…
Browse files Browse the repository at this point in the history
…in a hidden type
  • Loading branch information
oli-obk committed Jun 12, 2024
1 parent 0eb782b commit 4e0af7c
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions example/issue-72793.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 4e0af7c

Please sign in to comment.