From b875c53d2c23329a6148d9d6bb90522abd11df7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Wed, 18 Mar 2020 03:27:05 +0100 Subject: [PATCH] rustup https://github.com/rust-lang/rust/pull/69189 rustups https://github.com/rust-lang/rust/pull/69189 which is part of https://github.com/rust-lang/rust/pull/70085 (at least I think this is the only pr that changes clippy test stdout) --- tests/ui/inefficient_to_string.stderr | 8 ++++---- tests/ui/transmute.stderr | 2 +- tests/ui/transmute_ptr_to_ptr.stderr | 28 ++++++++++++++++++++++++++- tests/ui/transmute_ptr_to_ref.stderr | 4 ++-- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/tests/ui/inefficient_to_string.stderr b/tests/ui/inefficient_to_string.stderr index 1c0490ffa44..4be46161e8b 100644 --- a/tests/ui/inefficient_to_string.stderr +++ b/tests/ui/inefficient_to_string.stderr @@ -35,21 +35,21 @@ LL | let _: String = rrrstring.to_string(); | = help: `&&std::string::String` implements `ToString` through a slower blanket impl, but `std::string::String` has a fast specialization of `ToString` -error: calling `to_string` on `&&std::borrow::Cow<'_, str>` +error: calling `to_string` on `&&std::borrow::Cow` --> $DIR/inefficient_to_string.rs:29:21 | LL | let _: String = rrcow.to_string(); | ^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(*rrcow).to_string()` | - = help: `&std::borrow::Cow<'_, str>` implements `ToString` through a slower blanket impl, but `std::borrow::Cow<'_, str>` has a fast specialization of `ToString` + = help: `&std::borrow::Cow` implements `ToString` through a slower blanket impl, but `std::borrow::Cow` has a fast specialization of `ToString` -error: calling `to_string` on `&&&std::borrow::Cow<'_, str>` +error: calling `to_string` on `&&&std::borrow::Cow` --> $DIR/inefficient_to_string.rs:30:21 | LL | let _: String = rrrcow.to_string(); | ^^^^^^^^^^^^^^^^^^ help: try dereferencing the receiver: `(**rrrcow).to_string()` | - = help: `&&std::borrow::Cow<'_, str>` implements `ToString` through a slower blanket impl, but `std::borrow::Cow<'_, str>` has a fast specialization of `ToString` + = help: `&&std::borrow::Cow` implements `ToString` through a slower blanket impl, but `std::borrow::Cow` has a fast specialization of `ToString` error: aborting due to 6 previous errors diff --git a/tests/ui/transmute.stderr b/tests/ui/transmute.stderr index 37162ecf475..8582080498f 100644 --- a/tests/ui/transmute.stderr +++ b/tests/ui/transmute.stderr @@ -1,4 +1,4 @@ -error: transmute from a type (`&'a T`) to itself +error: transmute from a type (`&T`) to itself --> $DIR/transmute.rs:19:20 | LL | let _: &'a T = core::intrinsics::transmute(t); diff --git a/tests/ui/transmute_ptr_to_ptr.stderr b/tests/ui/transmute_ptr_to_ptr.stderr index 4d1b8fcc199..61fbea1c164 100644 --- a/tests/ui/transmute_ptr_to_ptr.stderr +++ b/tests/ui/transmute_ptr_to_ptr.stderr @@ -1,3 +1,17 @@ +error: transmute from a type (`&T`) to itself + --> $DIR/transmute_ptr_to_ptr.rs:8:5 + | +LL | std::mem::transmute::<&'a T, &'static T>(t) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D clippy::useless-transmute` implied by `-D warnings` + +error: transmute from a type (`&T`) to itself + --> $DIR/transmute_ptr_to_ptr.rs:13:5 + | +LL | std::mem::transmute::<&'a T, &'b T>(t) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: transmute from a pointer to a pointer --> $DIR/transmute_ptr_to_ptr.rs:29:29 | @@ -36,5 +50,17 @@ error: transmute from a reference to a reference LL | let _: &GenericParam = std::mem::transmute(&GenericParam { t: 1u32 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(&GenericParam { t: 1u32 } as *const GenericParam as *const GenericParam)` -error: aborting due to 6 previous errors +error: transmute from a type (`&LifetimeParam`) to itself + --> $DIR/transmute_ptr_to_ptr.rs:50:47 + | +LL | let _: &LifetimeParam<'static> = unsafe { std::mem::transmute(&lp) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: transmute from a type (`&GenericParam<&LifetimeParam>`) to itself + --> $DIR/transmute_ptr_to_ptr.rs:51:62 + | +LL | let _: &GenericParam<&LifetimeParam<'static>> = unsafe { std::mem::transmute(&GenericParam { t: &lp }) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 10 previous errors diff --git a/tests/ui/transmute_ptr_to_ref.stderr b/tests/ui/transmute_ptr_to_ref.stderr index 2d52e421816..df0598a58cd 100644 --- a/tests/ui/transmute_ptr_to_ref.stderr +++ b/tests/ui/transmute_ptr_to_ref.stderr @@ -42,13 +42,13 @@ error: transmute from a pointer type (`*mut U`) to a reference type (`&T`) LL | let _: &T = std::mem::transmute(om); | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(om as *const T)` -error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, u8>`) +error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo`) --> $DIR/transmute_ptr_to_ref.rs:32:32 | LL | let _: &Foo = unsafe { std::mem::transmute::<_, &Foo<_>>(raw) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*(raw as *const Foo<_>)` -error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<'_, &u8>`) +error: transmute from a pointer type (`*const i32`) to a reference type (`&issue1231::Foo<&u8>`) --> $DIR/transmute_ptr_to_ref.rs:34:33 | LL | let _: &Foo<&u8> = unsafe { std::mem::transmute::<_, &Foo<&_>>(raw) };