forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#96667 - oli-obk:collect_hidden_types, r=Mar…
…k-Simulacrum Add regression test fixes rust-lang#69785 This issue seems to have been fixed in the meantime.
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/test/ui/type-alias-impl-trait/auxiliary/collect_hidden_types.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |