diff --git a/.github/ISSUE_TEMPLATE/library_tracking_issue.md b/.github/ISSUE_TEMPLATE/library_tracking_issue.md index cbc4465fcfe38..e879594b87a10 100644 --- a/.github/ISSUE_TEMPLATE/library_tracking_issue.md +++ b/.github/ISSUE_TEMPLATE/library_tracking_issue.md @@ -2,7 +2,7 @@ name: Library Tracking Issue about: A tracking issue for an unstable library feature. title: Tracking Issue for XXX -labels: C-tracking-issue, T-libs +labels: C-tracking-issue, T-libs-api --- $DIR/unused-borrows.rs:6:5 + | +LL | &42; + | ^^^ + | +note: the lint level is defined here + --> $DIR/unused-borrows.rs:1:9 + | +LL | #![deny(unused_must_use)] + | ^^^^^^^^^^^^^^^ + +error: unused borrow that must be used + --> $DIR/unused-borrows.rs:9:5 + | +LL | &mut foo(42); + | ^^^^^^^^^^^^ + +error: unused borrow that must be used + --> $DIR/unused-borrows.rs:12:5 + | +LL | &&42; + | ^^^^ + +error: unused borrow that must be used + --> $DIR/unused-borrows.rs:15:5 + | +LL | &&mut 42; + | ^^^^^^^^ + +error: unused borrow that must be used + --> $DIR/unused-borrows.rs:18:5 + | +LL | &mut &42; + | ^^^^^^^^ + +error: unused borrow that must be used + --> $DIR/unused-borrows.rs:23:5 + | +LL | && foo(42); + | ^^^^^^^^^^ + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/repr/issue-83505-repr-simd.rs b/src/test/ui/repr/issue-83505-repr-simd.rs new file mode 100644 index 0000000000000..280b771d01539 --- /dev/null +++ b/src/test/ui/repr/issue-83505-repr-simd.rs @@ -0,0 +1,10 @@ +// Regression test for the ICE described in #83505. + +#![crate_type="lib"] + +#[repr(simd)] +//~^ ERROR: attribute should be applied to a struct [E0517] +//~| ERROR: unsupported representation for zero-variant enum [E0084] +enum Es {} +static CLs: Es; +//~^ ERROR: free static item without body diff --git a/src/test/ui/repr/issue-83505-repr-simd.stderr b/src/test/ui/repr/issue-83505-repr-simd.stderr new file mode 100644 index 0000000000000..f1390a652016b --- /dev/null +++ b/src/test/ui/repr/issue-83505-repr-simd.stderr @@ -0,0 +1,30 @@ +error: free static item without body + --> $DIR/issue-83505-repr-simd.rs:9:1 + | +LL | static CLs: Es; + | ^^^^^^^^^^^^^^- + | | + | help: provide a definition for the static: `= ;` + +error[E0517]: attribute should be applied to a struct + --> $DIR/issue-83505-repr-simd.rs:5:8 + | +LL | #[repr(simd)] + | ^^^^ +... +LL | enum Es {} + | ---------- not a struct + +error[E0084]: unsupported representation for zero-variant enum + --> $DIR/issue-83505-repr-simd.rs:5:1 + | +LL | #[repr(simd)] + | ^^^^^^^^^^^^^ +... +LL | enum Es {} + | ---------- zero-variant enum + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0084, E0517. +For more information about an error, try `rustc --explain E0084`. diff --git a/src/tools/clippy/tests/ui/bytes_nth.fixed b/src/tools/clippy/tests/ui/bytes_nth.fixed index bf68a7bbbf1d4..46b7833f42804 100644 --- a/src/tools/clippy/tests/ui/bytes_nth.fixed +++ b/src/tools/clippy/tests/ui/bytes_nth.fixed @@ -6,6 +6,6 @@ fn main() { let s = String::from("String"); s.as_bytes().get(3); - &s.as_bytes().get(3); + let _ = &s.as_bytes().get(3); s[..].as_bytes().get(3); } diff --git a/src/tools/clippy/tests/ui/bytes_nth.rs b/src/tools/clippy/tests/ui/bytes_nth.rs index 629812cc02cb8..c5e983d4d4e00 100644 --- a/src/tools/clippy/tests/ui/bytes_nth.rs +++ b/src/tools/clippy/tests/ui/bytes_nth.rs @@ -6,6 +6,6 @@ fn main() { let s = String::from("String"); s.bytes().nth(3); - &s.bytes().nth(3); + let _ = &s.bytes().nth(3); s[..].bytes().nth(3); } diff --git a/src/tools/clippy/tests/ui/bytes_nth.stderr b/src/tools/clippy/tests/ui/bytes_nth.stderr index 9a5742928cd61..536decf5e7fc4 100644 --- a/src/tools/clippy/tests/ui/bytes_nth.stderr +++ b/src/tools/clippy/tests/ui/bytes_nth.stderr @@ -7,10 +7,10 @@ LL | s.bytes().nth(3); = note: `-D clippy::bytes-nth` implied by `-D warnings` error: called `.byte().nth()` on a `String` - --> $DIR/bytes_nth.rs:9:6 + --> $DIR/bytes_nth.rs:9:14 | -LL | &s.bytes().nth(3); - | ^^^^^^^^^^^^^^^^ help: try: `s.as_bytes().get(3)` +LL | let _ = &s.bytes().nth(3); + | ^^^^^^^^^^^^^^^^ help: try: `s.as_bytes().get(3)` error: called `.byte().nth()` on a `str` --> $DIR/bytes_nth.rs:10:5 diff --git a/src/tools/clippy/tests/ui/iter_count.fixed b/src/tools/clippy/tests/ui/iter_count.fixed index b11dadda6c24e..97c5929783d88 100644 --- a/src/tools/clippy/tests/ui/iter_count.fixed +++ b/src/tools/clippy/tests/ui/iter_count.fixed @@ -50,7 +50,7 @@ fn main() { linked_list.push_back(1); binary_heap.push(1); - &vec[..].len(); + let _ = &vec[..].len(); vec.len(); boxed_slice.len(); vec_deque.len(); @@ -62,13 +62,13 @@ fn main() { binary_heap.len(); vec.len(); - &vec[..].len(); + let _ = &vec[..].len(); vec_deque.len(); hash_map.len(); b_tree_map.len(); linked_list.len(); - &vec[..].len(); + let _ = &vec[..].len(); vec.len(); vec_deque.len(); hash_set.len(); diff --git a/src/tools/clippy/tests/ui/iter_count.rs b/src/tools/clippy/tests/ui/iter_count.rs index 7d49c6a3dbbb9..70bb734763f09 100644 --- a/src/tools/clippy/tests/ui/iter_count.rs +++ b/src/tools/clippy/tests/ui/iter_count.rs @@ -50,7 +50,7 @@ fn main() { linked_list.push_back(1); binary_heap.push(1); - &vec[..].iter().count(); + let _ = &vec[..].iter().count(); vec.iter().count(); boxed_slice.iter().count(); vec_deque.iter().count(); @@ -62,13 +62,13 @@ fn main() { binary_heap.iter().count(); vec.iter_mut().count(); - &vec[..].iter_mut().count(); + let _ = &vec[..].iter_mut().count(); vec_deque.iter_mut().count(); hash_map.iter_mut().count(); b_tree_map.iter_mut().count(); linked_list.iter_mut().count(); - &vec[..].into_iter().count(); + let _ = &vec[..].into_iter().count(); vec.into_iter().count(); vec_deque.into_iter().count(); hash_set.into_iter().count(); diff --git a/src/tools/clippy/tests/ui/iter_count.stderr b/src/tools/clippy/tests/ui/iter_count.stderr index f3fb98e65b990..1d2c22f9dfad5 100644 --- a/src/tools/clippy/tests/ui/iter_count.stderr +++ b/src/tools/clippy/tests/ui/iter_count.stderr @@ -1,8 +1,8 @@ error: called `.iter().count()` on a `slice` - --> $DIR/iter_count.rs:53:6 + --> $DIR/iter_count.rs:53:14 | -LL | &vec[..].iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec[..].len()` +LL | let _ = &vec[..].iter().count(); + | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec[..].len()` | = note: `-D clippy::iter-count` implied by `-D warnings` @@ -67,10 +67,10 @@ LL | vec.iter_mut().count(); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.len()` error: called `.iter_mut().count()` on a `slice` - --> $DIR/iter_count.rs:65:6 + --> $DIR/iter_count.rs:65:14 | -LL | &vec[..].iter_mut().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec[..].len()` +LL | let _ = &vec[..].iter_mut().count(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec[..].len()` error: called `.iter_mut().count()` on a `VecDeque` --> $DIR/iter_count.rs:66:5 @@ -97,10 +97,10 @@ LL | linked_list.iter_mut().count(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `linked_list.len()` error: called `.into_iter().count()` on a `slice` - --> $DIR/iter_count.rs:71:6 + --> $DIR/iter_count.rs:71:14 | -LL | &vec[..].into_iter().count(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec[..].len()` +LL | let _ = &vec[..].into_iter().count(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec[..].len()` error: called `.into_iter().count()` on a `Vec` --> $DIR/iter_count.rs:72:5