Skip to content

Commit 52de679

Browse files
committed
Add regression test
1 parent 5428983 commit 52de679

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#![feature(type_alias_impl_trait)]
2+
3+
// edition:2018
4+
5+
use std::future::Future;
6+
7+
pub trait Service<Request> {
8+
type Future: Future<Output = ()>;
9+
fn call(&mut self, req: Request) -> Self::Future;
10+
}
11+
12+
// NOTE: the pub(crate) here is critical
13+
pub(crate) fn new() -> () {}
14+
15+
pub struct A;
16+
impl Service<()> for A {
17+
type Future = impl Future<Output = ()>;
18+
fn call(&mut self, _: ()) -> Self::Future {
19+
async { new() }
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// aux-build:collect_hidden_types.rs
2+
use collect_hidden_types::Service;
3+
use std::future::Future;
4+
use std::pin::Pin;
5+
use std::task::Context;
6+
7+
// build-pass
8+
9+
// edition:2018
10+
11+
extern crate collect_hidden_types;
12+
13+
fn broken(mut a: collect_hidden_types::A, cx: &mut Context<'_>) {
14+
let mut fut = a.call(());
15+
let _ = unsafe { Pin::new_unchecked(&mut fut) }.poll(cx);
16+
}
17+
18+
pub async fn meeb(cx: &mut Context<'_>) {
19+
broken(collect_hidden_types::A, cx);
20+
}
21+
22+
fn main() {}

0 commit comments

Comments
 (0)