summaryrefslogtreecommitdiffstats
path: root/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr')
-rw-r--r--src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr
new file mode 100644
index 000000000..93f16f5ba
--- /dev/null
+++ b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr
@@ -0,0 +1,59 @@
+error: lifetime parameter `'a` only used once
+ --> $DIR/one-use-in-fn-argument.rs:8:6
+ |
+LL | fn a<'a>(x: &'a u32) {
+ | ^^ -- ...is used only here
+ | |
+ | this lifetime...
+ |
+note: the lint level is defined here
+ --> $DIR/one-use-in-fn-argument.rs:1:9
+ |
+LL | #![deny(single_use_lifetimes)]
+ | ^^^^^^^^^^^^^^^^^^^^
+help: elide the single-use lifetime
+ |
+LL - fn a<'a>(x: &'a u32) {
+LL + fn a(x: &u32) {
+ |
+
+error: lifetime parameter `'m` only used once
+ --> $DIR/one-use-in-fn-argument.rs:15:11
+ |
+LL | fn center<'m>(_: Single<'m>) {}
+ | ^^ -- ...is used only here
+ | |
+ | this lifetime...
+ |
+help: elide the single-use lifetime
+ |
+LL - fn center<'m>(_: Single<'m>) {}
+LL + fn center(_: Single<'_>) {}
+ |
+
+error: lifetime parameter `'y` only used once
+ --> $DIR/one-use-in-fn-argument.rs:17:13
+ |
+LL | fn left<'x, 'y>(foo: Double<'x, 'y>) -> &'x u32 { foo.f }
+ | ^^ this lifetime... -- ...is used only here
+ |
+help: elide the single-use lifetime
+ |
+LL - fn left<'x, 'y>(foo: Double<'x, 'y>) -> &'x u32 { foo.f }
+LL + fn left<'x>(foo: Double<'x, '_>) -> &'x u32 { foo.f }
+ |
+
+error: lifetime parameter `'x` only used once
+ --> $DIR/one-use-in-fn-argument.rs:19:10
+ |
+LL | fn right<'x, 'y>(foo: Double<'x, 'y>) -> &'y u32 { foo.f }
+ | ^^ this lifetime... -- ...is used only here
+ |
+help: elide the single-use lifetime
+ |
+LL - fn right<'x, 'y>(foo: Double<'x, 'y>) -> &'y u32 { foo.f }
+LL + fn right<'y>(foo: Double<'_, 'y>) -> &'y u32 { foo.f }
+ |
+
+error: aborting due to 4 previous errors
+