diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index 863553670dee2..2be1e52f30481 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -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:?}"), }) } diff --git a/tests/ui/regions/issue-110941.rs b/tests/ui/regions/issue-110941.rs new file mode 100644 index 0000000000000..12a0e99a874f6 --- /dev/null +++ b/tests/ui/regions/issue-110941.rs @@ -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(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(self, _fun: F) -> AndThen { + unimplemented!() + } +} +struct AndThen { + _marker: std::marker::PhantomData, +} +pub async fn run(_: F) { + let _ = connect(&()).await; +} +fn main() { + let _ = async { + let server = Server; + let verification_route = server.and_then(read); + run(verification_route).await; + }; +}