forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix an assertion failure in
bind_generator_hidden_types_above
.
Fixes rust-lang#110941.
- Loading branch information
1 parent
9ecda8d
commit 2fc0483
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
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
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,37 @@ | ||
// run-pass | ||
// compile-flags: --edition=2018 -Zdrop-tracking-mir=yes | ||
|
||
use std::future::{Future, Ready}; | ||
async fn read() {} | ||
async fn connect<A: ToSocketAddr>(addr: A) { | ||
let _ = addr.to_socket_addr().await; | ||
} | ||
pub trait ToSocketAddr { | ||
type Future: Future; | ||
fn to_socket_addr(&self) -> Self::Future; | ||
} | ||
impl ToSocketAddr for &() { | ||
type Future = Ready<()>; | ||
fn to_socket_addr(&self) -> Self::Future { | ||
unimplemented!() | ||
} | ||
} | ||
struct Server; | ||
impl Server { | ||
fn and_then<F>(self, _fun: F) -> AndThen<F> { | ||
unimplemented!() | ||
} | ||
} | ||
struct AndThen<F> { | ||
_marker: std::marker::PhantomData<F>, | ||
} | ||
pub async fn run<F>(_: F) { | ||
let _ = connect(&()).await; | ||
} | ||
fn main() { | ||
let _ = async { | ||
let server = Server; | ||
let verification_route = server.and_then(read); | ||
run(verification_route).await; | ||
}; | ||
} |