]> git.proxmox.com Git - rustc.git/blame - src/test/ui/impl-trait/issues/issue-70877.rs
Merge tag 'debian/1.52.1+dfsg1-1_exp2' into proxmox/buster
[rustc.git] / src / test / ui / impl-trait / issues / issue-70877.rs
CommitLineData
6a06907d
XL
1// revisions: min_tait full_tait
2#![feature(min_type_alias_impl_trait)]
3#![cfg_attr(full_tait, feature(type_alias_impl_trait))]
29967ef6
XL
4#![feature(impl_trait_in_bindings)]
5#![allow(incomplete_features)]
6
7type FooArg<'a> = &'a dyn ToString;
8type FooRet = impl std::fmt::Debug;
9
10type FooItem = Box<dyn Fn(FooArg) -> FooRet>;
11type Foo = impl Iterator<Item = FooItem>; //~ ERROR: type mismatch
12
13#[repr(C)]
14struct Bar(u8);
15
16impl Iterator for Bar {
17 type Item = FooItem;
18
19 fn next(&mut self) -> Option<Self::Item> {
20 Some(Box::new(quux))
21 }
22}
23
24fn quux(st: FooArg) -> FooRet {
25 Some(st.to_string())
26}
27
28fn ham() -> Foo {
29 Bar(1)
30}
31
32fn oof() -> impl std::fmt::Debug {
33 let mut bar = ham();
34 let func = bar.next().unwrap();
35 return func(&"oof");
36}
37
38fn main() {
39 let _ = oof();
40}