Skip to content

Commit b1cc95d

Browse files
Remap early bound lifetimes too
1 parent 1898c34 commit b1cc95d

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

compiler/rustc_hir_analysis/src/check/compare_method.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ pub fn collect_trait_impl_trait_tys<'tcx>(
597597
let num_trait_substs = trait_to_impl_substs.len();
598598
let num_impl_substs = tcx.generics_of(impl_m.container_id(tcx)).params.len();
599599
let ty = tcx.fold_regions(ty, |region, _| {
600-
let ty::ReFree(_) = region.kind() else { return region; };
600+
let (ty::ReFree(_) | ty::ReEarlyBound(_)) = region.kind() else { return region; };
601601
let Some(ty::ReEarlyBound(e)) = map.get(&region.into()).map(|r| r.expect_region().kind())
602602
else {
603603
tcx
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// check-pass
2+
// edition:2021
3+
4+
#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
5+
#![allow(incomplete_features)]
6+
7+
pub trait Foo {
8+
async fn bar<'a: 'a>(&'a mut self);
9+
}
10+
11+
impl Foo for () {
12+
async fn bar<'a: 'a>(&'a mut self) {}
13+
}
14+
15+
pub trait Foo2 {
16+
fn bar<'a: 'a>(&'a mut self) -> impl Sized + 'a;
17+
}
18+
19+
impl Foo2 for () {
20+
fn bar<'a: 'a>(&'a mut self) -> impl Sized + 'a {}
21+
}
22+
23+
fn main() {}

0 commit comments

Comments
 (0)