diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-06-10 16:17:38 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-06-12 08:53:59 +0000 |
| commit | 4e0af7cc6176b7410fa95c3324381c2baa9ad769 (patch) | |
| tree | f600cecc33cb0c463feb2295285b64b69f49aabd | |
| parent | 0eb782ba13d34c75de2c3d72343a1c946e57d7d3 (diff) | |
| download | rust-4e0af7cc6176b7410fa95c3324381c2baa9ad769.tar.gz rust-4e0af7cc6176b7410fa95c3324381c2baa9ad769.zip | |
Require any function with a tait in its signature to actually constrain a hidden type
| -rw-r--r-- | example/issue-72793.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/example/issue-72793.rs b/example/issue-72793.rs index 166b0060043..2e08fbca8ef 100644 --- a/example/issue-72793.rs +++ b/example/issue-72793.rs @@ -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()); |
