From 8ad149a0e0810cb2ef17b2b0aef18c9a2a9062b0 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Sun, 22 Mar 2020 14:45:32 +0200 Subject: [PATCH] typeck/type_of: only early-bound and (free) late-bound lifetimes are parameters. --- src/librustc_typeck/collect/type_of.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librustc_typeck/collect/type_of.rs b/src/librustc_typeck/collect/type_of.rs index c2a32ffe482..d45c8270068 100644 --- a/src/librustc_typeck/collect/type_of.rs +++ b/src/librustc_typeck/collect/type_of.rs @@ -411,7 +411,9 @@ fn check(&mut self, def_id: DefId) { for (i, arg) in substs.iter().enumerate() { let arg_is_param = match arg.unpack() { GenericArgKind::Type(ty) => matches!(ty.kind, ty::Param(_)), - GenericArgKind::Lifetime(lt) => !matches!(lt, ty::ReStatic), + GenericArgKind::Lifetime(lt) => { + matches!(lt, ty::ReEarlyBound(_) | ty::ReFree(_)) + } GenericArgKind::Const(ct) => matches!(ct.val, ty::ConstKind::Param(_)), }; -- 2.44.0