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/auxiliary/ice-7868-aux.rs2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-10148.rs4
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-10148.stderr1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-10645.stderr1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-10912.rs4
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-10912.stderr5
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-11337.rs9
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-11422.fixed25
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-11422.rs25
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-11422.stderr16
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-2774.fixed29
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-2774.rs2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-2774.stderr1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-360.rs6
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-360.stderr30
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-3717.fixed11
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-3717.rs1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-3741.rs2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-3891.rs1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-3969.rs6
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-3969.stderr9
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-5835.fixed11
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-5835.rs2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-5835.stderr1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-5872.fixed7
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-5872.rs2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-5872.stderr1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-6250.rs2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-6251.rs2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-6251.stderr2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-6252.rs1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-6252.stderr6
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-6254.rs2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-6254.stderr1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-7169.fixed13
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-7169.rs2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-7169.stderr1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-7868.stderr1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-7869.rs1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-7869.stderr2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-8250.fixed8
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-8250.rs2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-8250.stderr1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-8821.fixed10
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-8821.rs2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-8821.stderr1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-8850.fixed31
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-8850.rs4
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-8850.stderr5
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-9041.rs4
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-9041.stderr1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-9405.stderr2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-9445.rs2
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-9445.stderr1
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-9463.rs4
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-9463.stderr4
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-96721.fixed10
-rw-r--r--src/tools/clippy/tests/ui/crashes/needless_lifetimes_impl_trait.fixed21
-rw-r--r--src/tools/clippy/tests/ui/crashes/needless_lifetimes_impl_trait.rs1
-rw-r--r--src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.fixed10
-rw-r--r--src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.rs1
-rw-r--r--src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.stderr1
62 files changed, 347 insertions, 29 deletions
diff --git a/src/tools/clippy/tests/ui/crashes/auxiliary/ice-7868-aux.rs b/src/tools/clippy/tests/ui/crashes/auxiliary/ice-7868-aux.rs
index bee29894b..882b66d67 100644
--- a/src/tools/clippy/tests/ui/crashes/auxiliary/ice-7868-aux.rs
+++ b/src/tools/clippy/tests/ui/crashes/auxiliary/ice-7868-aux.rs
@@ -1,3 +1,5 @@
fn zero() {
unsafe { 0 };
+ //~^ ERROR: unsafe block missing a safety comment
+ //~| NOTE: `-D clippy::undocumented-unsafe-blocks` implied by `-D warnings`
}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-10148.rs b/src/tools/clippy/tests/ui/crashes/ice-10148.rs
index 0df22f413..d89d94edb 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-10148.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-10148.rs
@@ -1,5 +1,5 @@
-//@aux-build:../auxiliary/proc_macros.rs:proc-macro
-
+//@aux-build:../auxiliary/proc_macros.rs
+//@no-rustfix
extern crate proc_macros;
use proc_macros::with_span;
diff --git a/src/tools/clippy/tests/ui/crashes/ice-10148.stderr b/src/tools/clippy/tests/ui/crashes/ice-10148.stderr
index f23e4433f..4d436e3aa 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-10148.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-10148.stderr
@@ -7,6 +7,7 @@ LL | println!(with_span!(""something ""));
| help: remove the empty string
|
= note: `-D clippy::println-empty-string` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::println_empty_string)]`
error: aborting due to previous error
diff --git a/src/tools/clippy/tests/ui/crashes/ice-10645.stderr b/src/tools/clippy/tests/ui/crashes/ice-10645.stderr
index 0055fe061..fc5347c86 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-10645.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-10645.stderr
@@ -11,6 +11,7 @@ LL | pub async fn bar<'a, T: 'a>(_: T) {}
| ^ has type `T` which is not `Send`
= note: `T` doesn't implement `std::marker::Send`
= note: `-D clippy::future-not-send` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::future_not_send)]`
warning: 1 warning emitted
diff --git a/src/tools/clippy/tests/ui/crashes/ice-10912.rs b/src/tools/clippy/tests/ui/crashes/ice-10912.rs
index 69d7f2f39..8dfce1942 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-10912.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-10912.rs
@@ -1,4 +1,8 @@
#![warn(clippy::unreadable_literal)]
+//@no-rustfix
fn f2() -> impl Sized { && 3.14159265358979323846E }
+//~^ ERROR: expected at least one digit in exponent
+//~| ERROR: long literal lacking separators
+//~| NOTE: `-D clippy::unreadable-literal` implied by `-D warnings`
fn main() {}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-10912.stderr b/src/tools/clippy/tests/ui/crashes/ice-10912.stderr
index a74ce7315..2be297b56 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-10912.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-10912.stderr
@@ -1,16 +1,17 @@
error: expected at least one digit in exponent
- --> $DIR/ice-10912.rs:2:28
+ --> $DIR/ice-10912.rs:3:28
|
LL | fn f2() -> impl Sized { && 3.14159265358979323846E }
| ^^^^^^^^^^^^^^^^^^^^^^^
error: long literal lacking separators
- --> $DIR/ice-10912.rs:2:28
+ --> $DIR/ice-10912.rs:3:28
|
LL | fn f2() -> impl Sized { && 3.14159265358979323846E }
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider: `3.141_592_653_589_793_238_46`
|
= note: `-D clippy::unreadable-literal` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::unreadable_literal)]`
error: aborting due to 2 previous errors
diff --git a/src/tools/clippy/tests/ui/crashes/ice-11337.rs b/src/tools/clippy/tests/ui/crashes/ice-11337.rs
new file mode 100644
index 000000000..0bed4035f
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/ice-11337.rs
@@ -0,0 +1,9 @@
+#![feature(trait_alias)]
+
+trait Confusing<F> = Fn(i32) where F: Fn(u32);
+
+fn alias<T: Confusing<F>, F>(_: T, _: F) {}
+
+fn main() {
+ alias(|_| {}, |_| {});
+}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-11422.fixed b/src/tools/clippy/tests/ui/crashes/ice-11422.fixed
new file mode 100644
index 000000000..ca5721cbb
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/ice-11422.fixed
@@ -0,0 +1,25 @@
+#![warn(clippy::implied_bounds_in_impls)]
+
+use std::fmt::Debug;
+use std::ops::*;
+
+fn gen() -> impl PartialOrd + Debug {}
+
+struct Bar {}
+trait Foo<T = Self> {}
+trait FooNested<T = Option<Self>> {}
+impl Foo for Bar {}
+impl FooNested for Bar {}
+
+fn foo() -> impl Foo + FooNested {
+ Bar {}
+}
+
+fn test_impl_ops() -> impl Add + Sub + Mul + Div {
+ 1
+}
+fn test_impl_assign_ops() -> impl AddAssign + SubAssign + MulAssign + DivAssign {
+ 1
+}
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-11422.rs b/src/tools/clippy/tests/ui/crashes/ice-11422.rs
new file mode 100644
index 000000000..355ec2480
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/ice-11422.rs
@@ -0,0 +1,25 @@
+#![warn(clippy::implied_bounds_in_impls)]
+
+use std::fmt::Debug;
+use std::ops::*;
+
+fn gen() -> impl PartialOrd + PartialEq + Debug {}
+
+struct Bar {}
+trait Foo<T = Self> {}
+trait FooNested<T = Option<Self>> {}
+impl Foo for Bar {}
+impl FooNested for Bar {}
+
+fn foo() -> impl Foo + FooNested {
+ Bar {}
+}
+
+fn test_impl_ops() -> impl Add + Sub + Mul + Div {
+ 1
+}
+fn test_impl_assign_ops() -> impl AddAssign + SubAssign + MulAssign + DivAssign {
+ 1
+}
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-11422.stderr b/src/tools/clippy/tests/ui/crashes/ice-11422.stderr
new file mode 100644
index 000000000..fb80b5b14
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/ice-11422.stderr
@@ -0,0 +1,16 @@
+error: this bound is already specified as the supertrait of `PartialOrd`
+ --> $DIR/ice-11422.rs:6:31
+ |
+LL | fn gen() -> impl PartialOrd + PartialEq + Debug {}
+ | ^^^^^^^^^
+ |
+ = note: `-D clippy::implied-bounds-in-impls` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::implied_bounds_in_impls)]`
+help: try removing this bound
+ |
+LL - fn gen() -> impl PartialOrd + PartialEq + Debug {}
+LL + fn gen() -> impl PartialOrd + Debug {}
+ |
+
+error: aborting due to previous error
+
diff --git a/src/tools/clippy/tests/ui/crashes/ice-2774.fixed b/src/tools/clippy/tests/ui/crashes/ice-2774.fixed
new file mode 100644
index 000000000..96cf0d854
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/ice-2774.fixed
@@ -0,0 +1,29 @@
+use std::collections::HashSet;
+
+// See rust-lang/rust-clippy#2774.
+
+#[derive(Eq, PartialEq, Debug, Hash)]
+pub struct Bar {
+ foo: Foo,
+}
+
+#[derive(Eq, PartialEq, Debug, Hash)]
+pub struct Foo;
+
+#[allow(clippy::implicit_hasher)]
+// This should not cause a "cannot relate bound region" ICE.
+pub fn add_barfoos_to_foos(bars: &HashSet<&Bar>) {
+ //~^ ERROR: the following explicit lifetimes could be elided: 'a
+ //~| NOTE: `-D clippy::needless-lifetimes` implied by `-D warnings`
+ let mut foos = HashSet::new();
+ foos.extend(bars.iter().map(|b| &b.foo));
+}
+
+#[allow(clippy::implicit_hasher)]
+// Also, this should not cause a "cannot relate bound region" ICE.
+pub fn add_barfoos_to_foos2(bars: &HashSet<&Bar>) {
+ let mut foos = HashSet::new();
+ foos.extend(bars.iter().map(|b| &b.foo));
+}
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-2774.rs b/src/tools/clippy/tests/ui/crashes/ice-2774.rs
index 88cfa1f92..464d7891c 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-2774.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-2774.rs
@@ -13,6 +13,8 @@ pub struct Foo;
#[allow(clippy::implicit_hasher)]
// This should not cause a "cannot relate bound region" ICE.
pub fn add_barfoos_to_foos<'a>(bars: &HashSet<&'a Bar>) {
+ //~^ ERROR: the following explicit lifetimes could be elided: 'a
+ //~| NOTE: `-D clippy::needless-lifetimes` implied by `-D warnings`
let mut foos = HashSet::new();
foos.extend(bars.iter().map(|b| &b.foo));
}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-2774.stderr b/src/tools/clippy/tests/ui/crashes/ice-2774.stderr
index a166ccb3e..ae9610c9a 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-2774.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-2774.stderr
@@ -5,6 +5,7 @@ LL | pub fn add_barfoos_to_foos<'a>(bars: &HashSet<&'a Bar>) {
| ^^ ^^
|
= note: `-D clippy::needless-lifetimes` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::needless_lifetimes)]`
help: elide the lifetimes
|
LL - pub fn add_barfoos_to_foos<'a>(bars: &HashSet<&'a Bar>) {
diff --git a/src/tools/clippy/tests/ui/crashes/ice-360.rs b/src/tools/clippy/tests/ui/crashes/ice-360.rs
index 6555c19ca..0d10932b0 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-360.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-360.rs
@@ -1,12 +1,16 @@
fn main() {}
-
+//@no-rustfix
fn no_panic<T>(slice: &[T]) {
let mut iter = slice.iter();
loop {
+ //~^ ERROR: this loop never actually loops
+ //~| ERROR: this loop could be written as a `while let` loop
+ //~| NOTE: `-D clippy::while-let-loop` implied by `-D warnings`
let _ = match iter.next() {
Some(ele) => ele,
None => break,
};
loop {}
+ //~^ ERROR: empty `loop {}` wastes CPU cycles
}
}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-360.stderr b/src/tools/clippy/tests/ui/crashes/ice-360.stderr
index a2e2ab8fd..a84697a9f 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-360.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-360.stderr
@@ -1,25 +1,41 @@
+error: this loop never actually loops
+ --> $DIR/ice-360.rs:5:5
+ |
+LL | / loop {
+LL | |
+LL | |
+LL | |
+... |
+LL | |
+LL | | }
+ | |_____^
+ |
+ = note: `#[deny(clippy::never_loop)]` on by default
+
error: this loop could be written as a `while let` loop
--> $DIR/ice-360.rs:5:5
|
LL | / loop {
-LL | | let _ = match iter.next() {
-LL | | Some(ele) => ele,
-LL | | None => break,
-LL | | };
-LL | | loop {}
+LL | |
+LL | |
+LL | |
+... |
+LL | |
LL | | }
| |_____^ help: try: `while let Some(ele) = iter.next() { .. }`
|
= note: `-D clippy::while-let-loop` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::while_let_loop)]`
error: empty `loop {}` wastes CPU cycles
- --> $DIR/ice-360.rs:10:9
+ --> $DIR/ice-360.rs:13:9
|
LL | loop {}
| ^^^^^^^
|
= help: you should either use `panic!()` or add `std::thread::sleep(..);` to the loop body
= note: `-D clippy::empty-loop` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::empty_loop)]`
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
diff --git a/src/tools/clippy/tests/ui/crashes/ice-3717.fixed b/src/tools/clippy/tests/ui/crashes/ice-3717.fixed
new file mode 100644
index 000000000..3f54b3269
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/ice-3717.fixed
@@ -0,0 +1,11 @@
+#![deny(clippy::implicit_hasher)]
+
+use std::collections::HashSet;
+
+fn main() {}
+
+pub fn ice_3717<S: ::std::hash::BuildHasher + Default>(_: &HashSet<usize, S>) {
+ //~^ ERROR: parameter of type `HashSet` should be generalized over different hashers
+ let _ = [0u8; 0];
+ let _: HashSet<usize> = HashSet::default();
+}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-3717.rs b/src/tools/clippy/tests/ui/crashes/ice-3717.rs
index f50714643..2890a9277 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-3717.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-3717.rs
@@ -5,6 +5,7 @@ use std::collections::HashSet;
fn main() {}
pub fn ice_3717(_: &HashSet<usize>) {
+ //~^ ERROR: parameter of type `HashSet` should be generalized over different hashers
let _ = [0u8; 0];
let _: HashSet<usize> = HashSet::new();
}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-3741.rs b/src/tools/clippy/tests/ui/crashes/ice-3741.rs
index 268c5ba0a..3106a2e72 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-3741.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-3741.rs
@@ -1,4 +1,4 @@
-//@aux-build:proc_macro_crash.rs:proc-macro
+//@aux-build:proc_macro_crash.rs
#![warn(clippy::suspicious_else_formatting)]
diff --git a/src/tools/clippy/tests/ui/crashes/ice-3891.rs b/src/tools/clippy/tests/ui/crashes/ice-3891.rs
index 05c5134c8..a3f1ccad7 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-3891.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-3891.rs
@@ -1,3 +1,4 @@
fn main() {
1x;
+ //~^ ERROR: invalid suffix `x` for number literal
}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-3969.rs b/src/tools/clippy/tests/ui/crashes/ice-3969.rs
index 9b68cac7f..d5676cbd9 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-3969.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-3969.rs
@@ -18,10 +18,13 @@ struct Dst<X: ?Sized> {
struct TwoStrs(str, str)
where
str: Sized;
+//~^ ERROR: trait bound str: std::marker::Sized does not depend on any type or lifetim
+//~| NOTE: `-D trivial-bounds` implied by `-D warnings`
fn unsized_local()
where
for<'a> Dst<dyn A + 'a>: Sized,
+ //~^ ERROR: trait bound for<'a> Dst<(dyn A + 'a)>: std::marker::Sized does not depend
{
let x: Dst<dyn A> = *(Box::new(Dst { x: 1 }) as Box<Dst<dyn A>>);
}
@@ -29,6 +32,7 @@ where
fn return_str() -> str
where
str: Sized,
+ //~^ ERROR: trait bound str: std::marker::Sized does not depend on any type or lifetim
{
*"Sized".to_string().into_boxed_str()
}
@@ -36,6 +40,7 @@ where
fn use_op(s: String) -> String
where
String: ::std::ops::Neg<Output = String>,
+ //~^ ERROR: trait bound std::string::String: std::ops::Neg does not depend on any type
{
-s
}
@@ -43,6 +48,7 @@ where
fn use_for()
where
i32: Iterator,
+ //~^ ERROR: trait bound i32: std::iter::Iterator does not depend on any type or lifeti
{
for _ in 2i32 {}
}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-3969.stderr b/src/tools/clippy/tests/ui/crashes/ice-3969.stderr
index 790180808..c6bef3004 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-3969.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-3969.stderr
@@ -5,27 +5,28 @@ LL | str: Sized;
| ^^^^^
|
= note: `-D trivial-bounds` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(trivial_bounds)]`
error: trait bound for<'a> Dst<(dyn A + 'a)>: std::marker::Sized does not depend on any type or lifetime parameters
- --> $DIR/ice-3969.rs:24:30
+ --> $DIR/ice-3969.rs:26:30
|
LL | for<'a> Dst<dyn A + 'a>: Sized,
| ^^^^^
error: trait bound str: std::marker::Sized does not depend on any type or lifetime parameters
- --> $DIR/ice-3969.rs:31:10
+ --> $DIR/ice-3969.rs:34:10
|
LL | str: Sized,
| ^^^^^
error: trait bound std::string::String: std::ops::Neg does not depend on any type or lifetime parameters
- --> $DIR/ice-3969.rs:38:13
+ --> $DIR/ice-3969.rs:42:13
|
LL | String: ::std::ops::Neg<Output = String>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: trait bound i32: std::iter::Iterator does not depend on any type or lifetime parameters
- --> $DIR/ice-3969.rs:45:10
+ --> $DIR/ice-3969.rs:50:10
|
LL | i32: Iterator,
| ^^^^^^^^
diff --git a/src/tools/clippy/tests/ui/crashes/ice-5835.fixed b/src/tools/clippy/tests/ui/crashes/ice-5835.fixed
new file mode 100644
index 000000000..c0532d685
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/ice-5835.fixed
@@ -0,0 +1,11 @@
+#[rustfmt::skip]
+pub struct Foo {
+ /// 位
+ //~^ ERROR: using tabs in doc comments is not recommended
+ //~| NOTE: `-D clippy::tabs-in-doc-comments` implied by `-D warnings`
+ /// ^ Do not remove this tab character.
+ /// It was required to trigger the ICE.
+ pub bar: u8,
+}
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-5835.rs b/src/tools/clippy/tests/ui/crashes/ice-5835.rs
index 5e99cb432..122bddd6a 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-5835.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-5835.rs
@@ -1,6 +1,8 @@
#[rustfmt::skip]
pub struct Foo {
/// 位
+ //~^ ERROR: using tabs in doc comments is not recommended
+ //~| NOTE: `-D clippy::tabs-in-doc-comments` implied by `-D warnings`
/// ^ Do not remove this tab character.
/// It was required to trigger the ICE.
pub bar: u8,
diff --git a/src/tools/clippy/tests/ui/crashes/ice-5835.stderr b/src/tools/clippy/tests/ui/crashes/ice-5835.stderr
index c972bcb60..74d99a348 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-5835.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-5835.stderr
@@ -5,6 +5,7 @@ LL | /// 位
| ^^^^ help: consider using four spaces per tab
|
= note: `-D clippy::tabs-in-doc-comments` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::tabs_in_doc_comments)]`
error: aborting due to previous error
diff --git a/src/tools/clippy/tests/ui/crashes/ice-5872.fixed b/src/tools/clippy/tests/ui/crashes/ice-5872.fixed
new file mode 100644
index 000000000..c8e870c62
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/ice-5872.fixed
@@ -0,0 +1,7 @@
+#![warn(clippy::needless_collect)]
+
+fn main() {
+ let _ = vec![1, 2, 3].into_iter().next().is_none();
+ //~^ ERROR: avoid using `collect()` when not needed
+ //~| NOTE: `-D clippy::needless-collect` implied by `-D warnings`
+}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-5872.rs b/src/tools/clippy/tests/ui/crashes/ice-5872.rs
index 68afa8f8c..c6ed31365 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-5872.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-5872.rs
@@ -2,4 +2,6 @@
fn main() {
let _ = vec![1, 2, 3].into_iter().collect::<Vec<_>>().is_empty();
+ //~^ ERROR: avoid using `collect()` when not needed
+ //~| NOTE: `-D clippy::needless-collect` implied by `-D warnings`
}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-5872.stderr b/src/tools/clippy/tests/ui/crashes/ice-5872.stderr
index a60ca345c..75a26ee31 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-5872.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-5872.stderr
@@ -5,6 +5,7 @@ LL | let _ = vec![1, 2, 3].into_iter().collect::<Vec<_>>().is_empty();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `next().is_none()`
|
= note: `-D clippy::needless-collect` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::needless_collect)]`
error: aborting due to previous error
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6250.rs b/src/tools/clippy/tests/ui/crashes/ice-6250.rs
index c33580ff6..32849f2ca 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6250.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-6250.rs
@@ -1,6 +1,6 @@
// originally from glacier/fixed/77218.rs
// ice while adjusting...
-
+//@no-rustfix
pub struct Cache {
data: Vec<i32>,
}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6251.rs b/src/tools/clippy/tests/ui/crashes/ice-6251.rs
index 6aa779aae..a81137a64 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6251.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-6251.rs
@@ -1,6 +1,6 @@
// originally from glacier/fixed/77329.rs
// assertion failed: `(left == right) ; different DefIds
-
+//@no-rustfix
fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {
std::iter::empty()
}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6251.stderr b/src/tools/clippy/tests/ui/crashes/ice-6251.stderr
index 68a5766c9..11081dc80 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6251.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-6251.stderr
@@ -27,7 +27,7 @@ LL | fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {
| ^^^^^^^^^^^ expected `usize`, found closure
|
= note: expected type `usize`
- found closure `[closure@$DIR/ice-6251.rs:4:44: 4:53]`
+ found closure `{closure@$DIR/ice-6251.rs:4:44: 4:53}`
error: aborting due to 3 previous errors
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6252.rs b/src/tools/clippy/tests/ui/crashes/ice-6252.rs
index 0ccf0aae9..67fbb0ff6 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6252.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-6252.rs
@@ -1,5 +1,6 @@
// originally from glacier fixed/77919.rs
// encountered errors resolving bounds after type-checking
+//@no-rustfix
trait TypeVal<T> {
const VAL: T;
}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6252.stderr b/src/tools/clippy/tests/ui/crashes/ice-6252.stderr
index 4787282f5..cb65360d1 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6252.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-6252.stderr
@@ -1,5 +1,5 @@
error[E0412]: cannot find type `PhantomData` in this scope
- --> $DIR/ice-6252.rs:8:9
+ --> $DIR/ice-6252.rs:9:9
|
LL | _n: PhantomData,
| ^^^^^^^^^^^ not found in this scope
@@ -14,7 +14,7 @@ LL + use std::marker::PhantomData;
|
error[E0412]: cannot find type `VAL` in this scope
- --> $DIR/ice-6252.rs:10:63
+ --> $DIR/ice-6252.rs:11:63
|
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| ^^^ not found in this scope
@@ -25,7 +25,7 @@ LL | impl<N, M, VAL> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| +++++
error[E0046]: not all trait items implemented, missing: `VAL`
- --> $DIR/ice-6252.rs:10:1
+ --> $DIR/ice-6252.rs:11:1
|
LL | const VAL: T;
| ------------ `VAL` from trait
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6254.rs b/src/tools/clippy/tests/ui/crashes/ice-6254.rs
index 8af608903..2ae426cf7 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6254.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-6254.rs
@@ -11,6 +11,8 @@ fn main() {
// This used to cause an ICE (https://github.com/rust-lang/rust/issues/78071)
match FOO_REF_REF {
FOO_REF_REF => {},
+ //~^ ERROR: to use a constant of type `Foo` in a pattern, `Foo` must be annotated
+ //~| NOTE: for more information, see issue #62411 <https://github.com/rust-lang/ru
Foo(_) => {},
}
}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6254.stderr b/src/tools/clippy/tests/ui/crashes/ice-6254.stderr
index 263c27d3d..6ace7dae8 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6254.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-6254.stderr
@@ -9,6 +9,7 @@ LL | FOO_REF_REF => {},
= note: the traits must be derived, manual `impl`s are not sufficient
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
= note: `-D indirect-structural-match` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(indirect_structural_match)]`
error: aborting due to previous error
diff --git a/src/tools/clippy/tests/ui/crashes/ice-7169.fixed b/src/tools/clippy/tests/ui/crashes/ice-7169.fixed
new file mode 100644
index 000000000..cf4077e4d
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/ice-7169.fixed
@@ -0,0 +1,13 @@
+#![allow(clippy::needless_if)]
+
+#[derive(Default)]
+struct A<T> {
+ a: Vec<A<T>>,
+ b: T,
+}
+
+fn main() {
+ if Ok::<_, ()>(A::<String>::default()).is_ok() {}
+ //~^ ERROR: redundant pattern matching, consider using `is_ok()`
+ //~| NOTE: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
+}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-7169.rs b/src/tools/clippy/tests/ui/crashes/ice-7169.rs
index b203252f0..b09e6f384 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-7169.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-7169.rs
@@ -8,4 +8,6 @@ struct A<T> {
fn main() {
if let Ok(_) = Ok::<_, ()>(A::<String>::default()) {}
+ //~^ ERROR: redundant pattern matching, consider using `is_ok()`
+ //~| NOTE: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-7169.stderr b/src/tools/clippy/tests/ui/crashes/ice-7169.stderr
index 0cd028516..47947f89b 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-7169.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-7169.stderr
@@ -5,6 +5,7 @@ LL | if let Ok(_) = Ok::<_, ()>(A::<String>::default()) {}
| -------^^^^^-------------------------------------- help: try: `if Ok::<_, ()>(A::<String>::default()).is_ok()`
|
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]`
error: aborting due to previous error
diff --git a/src/tools/clippy/tests/ui/crashes/ice-7868.stderr b/src/tools/clippy/tests/ui/crashes/ice-7868.stderr
index 1d8314e88..e5f14f221 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-7868.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-7868.stderr
@@ -6,6 +6,7 @@ LL | unsafe { 0 };
|
= help: consider adding a safety comment on the preceding line
= note: `-D clippy::undocumented-unsafe-blocks` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::undocumented_unsafe_blocks)]`
error: aborting due to previous error
diff --git a/src/tools/clippy/tests/ui/crashes/ice-7869.rs b/src/tools/clippy/tests/ui/crashes/ice-7869.rs
index 8f97a063a..774e22f6b 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-7869.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-7869.rs
@@ -1,4 +1,5 @@
enum Tila {
+ //~^ ERROR: all variants have the same prefix: `Työ`
TyöAlkoi,
TyöKeskeytyi,
TyöValmis,
diff --git a/src/tools/clippy/tests/ui/crashes/ice-7869.stderr b/src/tools/clippy/tests/ui/crashes/ice-7869.stderr
index 35d1e8fd2..7acace78a 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-7869.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-7869.stderr
@@ -2,6 +2,7 @@ error: all variants have the same prefix: `Työ`
--> $DIR/ice-7869.rs:1:1
|
LL | / enum Tila {
+LL | |
LL | | TyöAlkoi,
LL | | TyöKeskeytyi,
LL | | TyöValmis,
@@ -10,6 +11,7 @@ LL | | }
|
= help: remove the prefixes and use full paths to the variants instead of glob imports
= note: `-D clippy::enum-variant-names` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::enum_variant_names)]`
error: aborting due to previous error
diff --git a/src/tools/clippy/tests/ui/crashes/ice-8250.fixed b/src/tools/clippy/tests/ui/crashes/ice-8250.fixed
new file mode 100644
index 000000000..984b61258
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/ice-8250.fixed
@@ -0,0 +1,8 @@
+fn _f(s: &str) -> Option<()> {
+ let _ = s[1..].split('.').next()?;
+ //~^ ERROR: unnecessary use of `splitn`
+ //~| NOTE: `-D clippy::needless-splitn` implied by `-D warnings`
+ Some(())
+}
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-8250.rs b/src/tools/clippy/tests/ui/crashes/ice-8250.rs
index d9a5ee116..c1b2e48ba 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-8250.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-8250.rs
@@ -1,5 +1,7 @@
fn _f(s: &str) -> Option<()> {
let _ = s[1..].splitn(2, '.').next()?;
+ //~^ ERROR: unnecessary use of `splitn`
+ //~| NOTE: `-D clippy::needless-splitn` implied by `-D warnings`
Some(())
}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-8250.stderr b/src/tools/clippy/tests/ui/crashes/ice-8250.stderr
index e6f3644ef..9c57f3345 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-8250.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-8250.stderr
@@ -5,6 +5,7 @@ LL | let _ = s[1..].splitn(2, '.').next()?;
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `s[1..].split('.')`
|
= note: `-D clippy::needless-splitn` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::needless_splitn)]`
error: aborting due to previous error
diff --git a/src/tools/clippy/tests/ui/crashes/ice-8821.fixed b/src/tools/clippy/tests/ui/crashes/ice-8821.fixed
new file mode 100644
index 000000000..a25bb46f9
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/ice-8821.fixed
@@ -0,0 +1,10 @@
+#![warn(clippy::let_unit_value)]
+
+fn f() {}
+static FN: fn() = f;
+
+fn main() {
+ FN();
+ //~^ ERROR: this let-binding has unit value
+ //~| NOTE: `-D clippy::let-unit-value` implied by `-D warnings`
+}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-8821.rs b/src/tools/clippy/tests/ui/crashes/ice-8821.rs
index fb87b79ae..082f7c926 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-8821.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-8821.rs
@@ -5,4 +5,6 @@ static FN: fn() = f;
fn main() {
let _: () = FN();
+ //~^ ERROR: this let-binding has unit value
+ //~| NOTE: `-D clippy::let-unit-value` implied by `-D warnings`
}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-8821.stderr b/src/tools/clippy/tests/ui/crashes/ice-8821.stderr
index 486096e0a..c8bd01fb1 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-8821.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-8821.stderr
@@ -5,6 +5,7 @@ LL | let _: () = FN();
| ^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `FN();`
|
= note: `-D clippy::let-unit-value` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::let_unit_value)]`
error: aborting due to previous error
diff --git a/src/tools/clippy/tests/ui/crashes/ice-8850.fixed b/src/tools/clippy/tests/ui/crashes/ice-8850.fixed
new file mode 100644
index 000000000..4569b9e87
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/ice-8850.fixed
@@ -0,0 +1,31 @@
+fn fn_pointer_static() -> usize {
+ static FN: fn() -> usize = || 1;
+
+ FN() + 1
+ //~^ ERROR: returning the result of a `let` binding from a block
+ //~| NOTE: `-D clippy::let-and-return` implied by `-D warnings`
+}
+
+fn fn_pointer_const() -> usize {
+ const FN: fn() -> usize = || 1;
+
+ FN() + 1
+ //~^ ERROR: returning the result of a `let` binding from a block
+}
+
+fn deref_to_dyn_fn() -> usize {
+ struct Derefs;
+ impl std::ops::Deref for Derefs {
+ type Target = dyn Fn() -> usize;
+
+ fn deref(&self) -> &Self::Target {
+ &|| 2
+ }
+ }
+ static FN: Derefs = Derefs;
+
+ FN() + 1
+ //~^ ERROR: returning the result of a `let` binding from a block
+}
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-8850.rs b/src/tools/clippy/tests/ui/crashes/ice-8850.rs
index f2747ab22..499756ece 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-8850.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-8850.rs
@@ -2,12 +2,15 @@ fn fn_pointer_static() -> usize {
static FN: fn() -> usize = || 1;
let res = FN() + 1;
res
+ //~^ ERROR: returning the result of a `let` binding from a block
+ //~| NOTE: `-D clippy::let-and-return` implied by `-D warnings`
}
fn fn_pointer_const() -> usize {
const FN: fn() -> usize = || 1;
let res = FN() + 1;
res
+ //~^ ERROR: returning the result of a `let` binding from a block
}
fn deref_to_dyn_fn() -> usize {
@@ -22,6 +25,7 @@ fn deref_to_dyn_fn() -> usize {
static FN: Derefs = Derefs;
let res = FN() + 1;
res
+ //~^ ERROR: returning the result of a `let` binding from a block
}
fn main() {}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-8850.stderr b/src/tools/clippy/tests/ui/crashes/ice-8850.stderr
index 620fd1eda..aa140f305 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-8850.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-8850.stderr
@@ -7,6 +7,7 @@ LL | res
| ^^^
|
= note: `-D clippy::let-and-return` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::let_and_return)]`
help: return the expression directly
|
LL ~
@@ -14,7 +15,7 @@ LL ~ FN() + 1
|
error: returning the result of a `let` binding from a block
- --> $DIR/ice-8850.rs:10:5
+ --> $DIR/ice-8850.rs:12:5
|
LL | let res = FN() + 1;
| ------------------- unnecessary `let` binding
@@ -28,7 +29,7 @@ LL ~ FN() + 1
|
error: returning the result of a `let` binding from a block
- --> $DIR/ice-8850.rs:24:5
+ --> $DIR/ice-8850.rs:27:5
|
LL | let res = FN() + 1;
| ------------------- unnecessary `let` binding
diff --git a/src/tools/clippy/tests/ui/crashes/ice-9041.rs b/src/tools/clippy/tests/ui/crashes/ice-9041.rs
index 55cc9bc99..727d88f7f 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-9041.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-9041.rs
@@ -1,8 +1,10 @@
pub struct Thing;
-
+//@no-rustfix
pub fn has_thing(things: &[Thing]) -> bool {
let is_thing_ready = |_peer: &Thing| -> bool { todo!() };
things.iter().find(|p| is_thing_ready(p)).is_some()
+ //~^ ERROR: called `is_some()` after searching an `Iterator` with `find`
+ //~| NOTE: `-D clippy::search-is-some` implied by `-D warnings`
}
fn main() {}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-9041.stderr b/src/tools/clippy/tests/ui/crashes/ice-9041.stderr
index f5038f0a8..49c9bdc30 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-9041.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-9041.stderr
@@ -5,6 +5,7 @@ LL | things.iter().find(|p| is_thing_ready(p)).is_some()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|p| is_thing_ready(&p))`
|
= note: `-D clippy::search-is-some` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::search_is_some)]`
error: aborting due to previous error
diff --git a/src/tools/clippy/tests/ui/crashes/ice-9405.stderr b/src/tools/clippy/tests/ui/crashes/ice-9405.stderr
index 9a6e410f2..56649a2bd 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-9405.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-9405.stderr
@@ -1,7 +1,7 @@
warning: multiple lines skipped by escaped newline
--> $DIR/ice-9405.rs:6:10
|
-LL | "/
+LL | "\
| __________^
LL | |
LL | | {}",
diff --git a/src/tools/clippy/tests/ui/crashes/ice-9445.rs b/src/tools/clippy/tests/ui/crashes/ice-9445.rs
index c67b22f6f..b6afbd33c 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-9445.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-9445.rs
@@ -1,3 +1,5 @@
const UNINIT: core::mem::MaybeUninit<core::cell::Cell<&'static ()>> = core::mem::MaybeUninit::uninit();
+//~^ ERROR: a `const` item should never be interior mutable
+//~| NOTE: `-D clippy::declare-interior-mutable-const` implied by `-D warnings`
fn main() {}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-9445.stderr b/src/tools/clippy/tests/ui/crashes/ice-9445.stderr
index a59d098e5..9307409ba 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-9445.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-9445.stderr
@@ -7,6 +7,7 @@ LL | const UNINIT: core::mem::MaybeUninit<core::cell::Cell<&'static ()>> = core:
| make this a static item (maybe with lazy_static)
|
= note: `-D clippy::declare-interior-mutable-const` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::declare_interior_mutable_const)]`
error: aborting due to previous error
diff --git a/src/tools/clippy/tests/ui/crashes/ice-9463.rs b/src/tools/clippy/tests/ui/crashes/ice-9463.rs
index 9564e77c2..fa83d25b3 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-9463.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-9463.rs
@@ -1,5 +1,9 @@
#![deny(arithmetic_overflow)]
fn main() {
let _x = -1_i32 >> -1;
+ //~^ ERROR: this arithmetic operation will overflow
let _y = 1u32 >> 10000000000000u32;
+ //~^ ERROR: this arithmetic operation will overflow
+ //~| ERROR: literal out of range for `u32`
+ //~| NOTE: the literal `10000000000000u32` does not fit into the type `u32` whose rang
}
diff --git a/src/tools/clippy/tests/ui/crashes/ice-9463.stderr b/src/tools/clippy/tests/ui/crashes/ice-9463.stderr
index 2b425e85a..911795694 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-9463.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-9463.stderr
@@ -11,13 +11,13 @@ LL | #![deny(arithmetic_overflow)]
| ^^^^^^^^^^^^^^^^^^^
error: this arithmetic operation will overflow
- --> $DIR/ice-9463.rs:4:14
+ --> $DIR/ice-9463.rs:5:14
|
LL | let _y = 1u32 >> 10000000000000u32;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to shift right by `1316134912_u32`, which would overflow
error: literal out of range for `u32`
- --> $DIR/ice-9463.rs:4:22
+ --> $DIR/ice-9463.rs:5:22
|
LL | let _y = 1u32 >> 10000000000000u32;
| ^^^^^^^^^^^^^^^^^
diff --git a/src/tools/clippy/tests/ui/crashes/ice-96721.fixed b/src/tools/clippy/tests/ui/crashes/ice-96721.fixed
new file mode 100644
index 000000000..976189d0b
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/ice-96721.fixed
@@ -0,0 +1,10 @@
+macro_rules! foo {
+ () => {
+ "bar.rs"
+ };
+}
+
+#[path = "file"] //~ ERROR: malformed `path` attribute
+mod abc {}
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui/crashes/needless_lifetimes_impl_trait.fixed b/src/tools/clippy/tests/ui/crashes/needless_lifetimes_impl_trait.fixed
new file mode 100644
index 000000000..8bd9eea75
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/needless_lifetimes_impl_trait.fixed
@@ -0,0 +1,21 @@
+#![deny(clippy::needless_lifetimes)]
+#![allow(dead_code)]
+
+trait Foo {}
+
+struct Bar;
+
+struct Baz<'a> {
+ bar: &'a Bar,
+}
+
+impl<'a> Foo for Baz<'a> {}
+
+impl Bar {
+ fn baz(&self) -> impl Foo + '_ {
+ //~^ ERROR: the following explicit lifetimes could be elided: 'a
+ Baz { bar: self }
+ }
+}
+
+fn main() {}
diff --git a/src/tools/clippy/tests/ui/crashes/needless_lifetimes_impl_trait.rs b/src/tools/clippy/tests/ui/crashes/needless_lifetimes_impl_trait.rs
index 376ff97ba..06947e3a3 100644
--- a/src/tools/clippy/tests/ui/crashes/needless_lifetimes_impl_trait.rs
+++ b/src/tools/clippy/tests/ui/crashes/needless_lifetimes_impl_trait.rs
@@ -13,6 +13,7 @@ impl<'a> Foo for Baz<'a> {}
impl Bar {
fn baz<'a>(&'a self) -> impl Foo + 'a {
+ //~^ ERROR: the following explicit lifetimes could be elided: 'a
Baz { bar: self }
}
}
diff --git a/src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.fixed b/src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.fixed
new file mode 100644
index 000000000..774dea391
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/needless_pass_by_value-w-late-bound.fixed
@@ -0,0 +1,10 @@
+// https://github.com/rust-lang/rust/issues/107147
+
+#![warn(clippy::needless_pass_by_value)]
+
+struct Foo<'a>(&'a [(); 100]);
+
+fn test(x: &Foo<'_>) {}
+//~^ ERROR: this argument is passed by value, but not consumed in the function body
+
+fn main() {}
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
index dd3d8b8b6..f3d887192 100644
--- 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
@@ -5,5 +5,6 @@
struct Foo<'a>(&'a [(); 100]);
fn test(x: Foo<'_>) {}
+//~^ ERROR: this argument is passed by value, but not consumed in the function body
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
index 7a0a64897..6d4539399 100644
--- 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
@@ -10,6 +10,7 @@ help: consider marking this type as `Copy`
LL | struct Foo<'a>(&'a [(); 100]);
| ^^^^^^^^^^^^^^
= note: `-D clippy::needless-pass-by-value` implied by `-D warnings`
+ = help: to override `-D warnings` add `#[allow(clippy::needless_pass_by_value)]`
error: aborting due to previous error