Skip to content

Commit b2f078f

Browse files
committed
fix: lower all opaque type lifetime to early bound in async bounds lowering
1 parent 7a9b149 commit b2f078f

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

crates/hir-ty/src/lower.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@ impl<'db, 'a> TyLoweringContext<'db, 'a> {
594594
|index, param @ (id, data), _| {
595595
if let GenericParamDataRef::LifetimeParamData(lt) = data
596596
&& lt.is_late_bound()
597+
&& !self.is_lowering_impl_trait_bounds
597598
{
598599
let GenericParamId::LifetimeParamId(id) = id else {
599600
unreachable!()

crates/hir-ty/src/tests/traits.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5315,3 +5315,27 @@ fn bar() {
53155315
"#,
53165316
);
53175317
}
5318+
5319+
#[test]
5320+
fn async_impl_trait() {
5321+
check_no_mismatches(
5322+
r#"
5323+
//- minicore: future
5324+
trait Reader {}
5325+
5326+
struct Path {}
5327+
struct Result<T> { v: T }
5328+
5329+
impl Reader for () {}
5330+
5331+
async fn read<'a>(path: &'a Path) -> Result<impl Reader + 'a> {
5332+
Result { v: () }
5333+
}
5334+
5335+
fn foo() {
5336+
let p = Path {};
5337+
let v = read(&p);
5338+
}
5339+
"#,
5340+
);
5341+
}

0 commit comments

Comments
 (0)