mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-30 06:43:20 +03:00
Use lifetimes on type-alias-impl-trait used in function signatures to infer output type lifetimes
This commit is contained in:
@@ -1349,7 +1349,7 @@ fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
// ignore the inputs to a projection, as they may not appear
|
||||
// in the normalized form
|
||||
if self.just_constrained {
|
||||
if let ty::Projection(..) | ty::Opaque(..) = t.kind() {
|
||||
if let ty::Projection(..) = t.kind() {
|
||||
return ControlFlow::CONTINUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// check-pass
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
mod foo {
|
||||
type Ty<'a> = impl Sized;
|
||||
fn defining(s: &str) -> Ty<'_> { s }
|
||||
fn execute(ty: Ty<'_>) -> &str { todo!() }
|
||||
}
|
||||
|
||||
mod bar {
|
||||
type Ty<'a> = impl FnOnce() -> &'a str;
|
||||
fn defining(s: &str) -> Ty<'_> { move || s }
|
||||
fn execute(ty: Ty<'_>) -> &str { ty() }
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
Reference in New Issue
Block a user