Skip to content

Commit d63f82e

Browse files
committed
Use lifetimes on type-alias-impl-trait used in function signatures to infer output type lifetimes
1 parent c51871c commit d63f82e

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

compiler/rustc_middle/src/ty/fold.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ impl<'tcx> TypeVisitor<'tcx> for LateBoundRegionsCollector {
13491349
// ignore the inputs to a projection, as they may not appear
13501350
// in the normalized form
13511351
if self.just_constrained {
1352-
if let ty::Projection(..) | ty::Opaque(..) = t.kind() {
1352+
if let ty::Projection(..) = t.kind() {
13531353
return ControlFlow::CONTINUE;
13541354
}
13551355
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// check-pass
2+
3+
#![feature(type_alias_impl_trait)]
4+
5+
mod foo {
6+
type Ty<'a> = impl Sized;
7+
fn defining(s: &str) -> Ty<'_> { s }
8+
fn execute(ty: Ty<'_>) -> &str { todo!() }
9+
}
10+
11+
mod bar {
12+
type Ty<'a> = impl FnOnce() -> &'a str;
13+
fn defining(s: &str) -> Ty<'_> { move || s }
14+
fn execute(ty: Ty<'_>) -> &str { ty() }
15+
}
16+
17+
fn main() {}

0 commit comments

Comments
 (0)