Skip to content

Commit

Permalink
Rollup merge of #96667 - oli-obk:collect_hidden_types, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Add regression test

fixes #69785

This issue seems to have been fixed in the meantime.
  • Loading branch information
matthiaskrgr committed May 7, 2022
2 parents eecc046 + 52de679 commit f995b67
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#![feature(type_alias_impl_trait)]

// edition:2018

use std::future::Future;

pub trait Service<Request> {
type Future: Future<Output = ()>;
fn call(&mut self, req: Request) -> Self::Future;
}

// NOTE: the pub(crate) here is critical
pub(crate) fn new() -> () {}

pub struct A;
impl Service<()> for A {
type Future = impl Future<Output = ()>;
fn call(&mut self, _: ()) -> Self::Future {
async { new() }
}
}
22 changes: 22 additions & 0 deletions src/test/ui/type-alias-impl-trait/collect_hidden_types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// aux-build:collect_hidden_types.rs
use collect_hidden_types::Service;
use std::future::Future;
use std::pin::Pin;
use std::task::Context;

// build-pass

// edition:2018

extern crate collect_hidden_types;

fn broken(mut a: collect_hidden_types::A, cx: &mut Context<'_>) {
let mut fut = a.call(());
let _ = unsafe { Pin::new_unchecked(&mut fut) }.poll(cx);
}

pub async fn meeb(cx: &mut Context<'_>) {
broken(collect_hidden_types::A, cx);
}

fn main() {}

0 comments on commit f995b67

Please sign in to comment.