This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
src/test/ui/type-alias-impl-trait Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 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 number Diff line number Diff line change 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 ( ) { }
You can’t perform that action at this time.
0 commit comments