mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Rollup merge of #103608 - compiler-errors:rpitit-early-lt, r=cjgillot
Remap early bound lifetimes in return-position `impl Trait` in traits too Fixes part of #103457 r? ``@cjgillot,`` though feel free to reassign, just thought you'd have sufficient context to review.
This commit is contained in:
commit
112fd022cd
@ -597,7 +597,7 @@ pub fn collect_trait_impl_trait_tys<'tcx>(
|
||||
let num_trait_substs = trait_to_impl_substs.len();
|
||||
let num_impl_substs = tcx.generics_of(impl_m.container_id(tcx)).params.len();
|
||||
let ty = tcx.fold_regions(ty, |region, _| {
|
||||
let ty::ReFree(_) = region.kind() else { return region; };
|
||||
let (ty::ReFree(_) | ty::ReEarlyBound(_)) = region.kind() else { return region; };
|
||||
let Some(ty::ReEarlyBound(e)) = map.get(®ion.into()).map(|r| r.expect_region().kind())
|
||||
else {
|
||||
tcx
|
||||
|
23
src/test/ui/impl-trait/in-trait/early.rs
Normal file
23
src/test/ui/impl-trait/in-trait/early.rs
Normal file
@ -0,0 +1,23 @@
|
||||
// check-pass
|
||||
// edition:2021
|
||||
|
||||
#![feature(async_fn_in_trait, return_position_impl_trait_in_trait)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
pub trait Foo {
|
||||
async fn bar<'a: 'a>(&'a mut self);
|
||||
}
|
||||
|
||||
impl Foo for () {
|
||||
async fn bar<'a: 'a>(&'a mut self) {}
|
||||
}
|
||||
|
||||
pub trait Foo2 {
|
||||
fn bar<'a: 'a>(&'a mut self) -> impl Sized + 'a;
|
||||
}
|
||||
|
||||
impl Foo2 for () {
|
||||
fn bar<'a: 'a>(&'a mut self) -> impl Sized + 'a {}
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user