diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-05-07 22:44:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-07 22:44:38 +0200 |
| commit | f995b67a4cbc32fd256dc5f26b76ab1944aa5880 (patch) | |
| tree | d2efb1e7d11fa63a7c9db3d446f4ea9333bbff3d | |
| parent | eecc0469f5c6866fb89868e7bb2348ff81157422 (diff) | |
| parent | 52de679c193c249d771d84fdaa1cce0bf70404a4 (diff) | |
| download | rust-f995b67a4cbc32fd256dc5f26b76ab1944aa5880.tar.gz rust-f995b67a4cbc32fd256dc5f26b76ab1944aa5880.zip | |
Rollup merge of #96667 - oli-obk:collect_hidden_types, r=Mark-Simulacrum
Add regression test fixes #69785 This issue seems to have been fixed in the meantime.
| -rw-r--r-- | src/test/ui/type-alias-impl-trait/auxiliary/collect_hidden_types.rs | 21 | ||||
| -rw-r--r-- | src/test/ui/type-alias-impl-trait/collect_hidden_types.rs | 22 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/test/ui/type-alias-impl-trait/auxiliary/collect_hidden_types.rs b/src/test/ui/type-alias-impl-trait/auxiliary/collect_hidden_types.rs new file mode 100644 index 00000000000..75d20a6fef9 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/auxiliary/collect_hidden_types.rs @@ -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() } + } +} diff --git a/src/test/ui/type-alias-impl-trait/collect_hidden_types.rs b/src/test/ui/type-alias-impl-trait/collect_hidden_types.rs new file mode 100644 index 00000000000..e78f178e464 --- /dev/null +++ b/src/test/ui/type-alias-impl-trait/collect_hidden_types.rs @@ -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() {} |
