From 5de9c841402d40ef30426b096c7696b1e01f2892 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 6 Nov 2022 14:34:38 +0000 Subject: [PATCH] Fix rustc_pass_by_value. --- compiler/rustc_hir/src/hir.rs | 2 +- compiler/rustc_lint/src/pass_by_value.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 0f216457c87..208d2fb42e4 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -132,7 +132,7 @@ pub fn is_elided(&self) -> bool { impl fmt::Display for Lifetime { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - self.ident.fmt(f) + if self.ident.name != kw::Empty { self.ident.name.fmt(f) } else { "'_".fmt(f) } } } diff --git a/compiler/rustc_lint/src/pass_by_value.rs b/compiler/rustc_lint/src/pass_by_value.rs index ac0cfa64d42..cf1d82f4c06 100644 --- a/compiler/rustc_lint/src/pass_by_value.rs +++ b/compiler/rustc_lint/src/pass_by_value.rs @@ -78,7 +78,7 @@ fn gen_args(cx: &LateContext<'_>, segment: &PathSegment<'_>) -> String { .args .iter() .map(|arg| match arg { - GenericArg::Lifetime(lt) => lt.ident.to_string(), + GenericArg::Lifetime(lt) => lt.to_string(), GenericArg::Type(ty) => { cx.tcx.sess.source_map().span_to_snippet(ty.span).unwrap_or_else(|_| "_".into()) } -- 2.44.0