Skip to content

Commit

Permalink
Fix an assertion failure in bind_generator_hidden_types_above.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed May 2, 2023
1 parent 9ecda8d commit 2fc0483
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3016,6 +3016,7 @@ fn bind_generator_hidden_types_above<'tcx>(
counter += 1;
tcx.mk_re_late_bound(current_depth, br)
}
ty::RePlaceholder(_) => r,
r => bug!("unexpected region: {r:?}"),
})
}
Expand Down
37 changes: 37 additions & 0 deletions tests/ui/regions/issue-110941.rs
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;
};
}

0 comments on commit 2fc0483

Please sign in to comment.