about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-11-06 14:34:38 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2022-11-24 17:49:42 +0000
commit5de9c841402d40ef30426b096c7696b1e01f2892 (patch)
treee22df7689dd320a9df652ec09ca0ef0d1f4e94c9
parent1c737d69979b36a33e80241c12565e5228bd75a5 (diff)
downloadrust-5de9c841402d40ef30426b096c7696b1e01f2892.tar.gz
rust-5de9c841402d40ef30426b096c7696b1e01f2892.zip
Fix rustc_pass_by_value.
-rw-r--r--compiler/rustc_hir/src/hir.rs2
-rw-r--r--compiler/rustc_lint/src/pass_by_value.rs2
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 @@ impl LifetimeName {
 
 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())
                 }