summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/crashes
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/crashes')
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-2774.stderr5
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-rust-107877.rs17
-rw-r--r--src/tools/clippy/tests/ui/crashes/needless_lifetimes_impl_trait.stderr5
-rw-r--r--src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.rs9
-rw-r--r--src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.stderr15
5 files changed, 51 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/crashes/ice-2774.stderr b/src/tools/clippy/tests/ui/crashes/ice-2774.stderr
index 1f26c7f4d..c5ea0b16d 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-2774.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-2774.stderr
@@ -5,6 +5,11 @@ LL | pub fn add_barfoos_to_foos<'a>(bars: &HashSet<&'a Bar>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::needless-lifetimes` implied by `-D warnings`
+help: elide the lifetimes
+ |
+LL - pub fn add_barfoos_to_foos<'a>(bars: &HashSet<&'a Bar>) {
+LL + pub fn add_barfoos_to_foos(bars: &HashSet<&Bar>) {
+ |
error: aborting due to previous error
diff --git a/src/tools/clippy/tests/ui/crashes/ice-rust-107877.rs b/src/tools/clippy/tests/ui/crashes/ice-rust-107877.rs
new file mode 100644
index 000000000..7f5bae60d
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/ice-rust-107877.rs
@@ -0,0 +1,17 @@
+#![allow(dead_code)]
+
+struct Foo;
+
+impl<'a> std::convert::TryFrom<&'a String> for Foo {
+ type Error = std::convert::Infallible;
+
+ fn try_from(_: &'a String) -> Result<Self, Self::Error> {
+ Ok(Foo)
+ }
+}
+
+fn find<E>(_: impl std::convert::TryInto<Foo, Error = E>) {}
+
+fn main() {
+ find(&String::new());
+}
diff --git a/src/tools/clippy/tests/ui/crashes/needless_lifetimes_impl_trait.stderr b/src/tools/clippy/tests/ui/crashes/needless_lifetimes_impl_trait.stderr
index 875d5ab4f..0b0e0ad26 100644
--- a/src/tools/clippy/tests/ui/crashes/needless_lifetimes_impl_trait.stderr
+++ b/src/tools/clippy/tests/ui/crashes/needless_lifetimes_impl_trait.stderr
@@ -9,6 +9,11 @@ note: the lint level is defined here
|
LL | #![deny(clippy::needless_lifetimes)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: elide the lifetimes
+ |
+LL - fn baz<'a>(&'a self) -> impl Foo + 'a {
+LL + fn baz(&self) -> impl Foo + '_ {
+ |
error: aborting due to previous error
diff --git a/src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.rs b/src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.rs
new file mode 100644
index 000000000..dd3d8b8b6
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.rs
@@ -0,0 +1,9 @@
+// https://github.com/rust-lang/rust/issues/107147
+
+#![warn(clippy::needless_pass_by_value)]
+
+struct Foo<'a>(&'a [(); 100]);
+
+fn test(x: Foo<'_>) {}
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.stderr b/src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.stderr
new file mode 100644
index 000000000..7a0a64897
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.stderr
@@ -0,0 +1,15 @@
+error: this argument is passed by value, but not consumed in the function body
+ --> $DIR/needless_pass_by_value-w-late-bound.rs:7:12
+ |
+LL | fn test(x: Foo<'_>) {}
+ | ^^^^^^^ help: consider taking a reference instead: `&Foo<'_>`
+ |
+help: consider marking this type as `Copy`
+ --> $DIR/needless_pass_by_value-w-late-bound.rs:5:1
+ |
+LL | struct Foo<'a>(&'a [(); 100]);
+ | ^^^^^^^^^^^^^^
+ = note: `-D clippy::needless-pass-by-value` implied by `-D warnings`
+
+error: aborting due to previous error
+