-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add regression test #96667
Add regression test #96667
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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() } | ||
} | ||
} |
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure we parse these (at least yet -- unless we already merged the compiletest PR Pietro was working on here)? I'd rather they be at the top of the file regardless. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have many other such cases in our test suite. The comments only get ignored after the first item, possibly even allowed after use statements. |
||
|
||
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() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, I think this probably should be at the top of the file, I'm not sure it gets picked up by current compiletest otherwise.