Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I don't think we're supposed to leak placeholder types here. They should all be erased here...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We perform substitution with solver-provided substs, so we can have any region that is allowed within substs.
It may be interesting to do the fold before substitution: substs cannot contain ReErased, and unsubstituted bty can only contain ReErased.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, so this is a case where we had a late bound lifetime that was bound deeper than the generator itself. huh, ok, maybe this is fine then.

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;
};
}