diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-01-03 23:40:49 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-01-04 00:46:33 +0000 |
| commit | 698dfc322fd42fa4dff71474aba7cdf691a459a6 (patch) | |
| tree | 14d608a069d1f5eed3ddce414d0bde968afab3d7 /tests | |
| parent | 78ef94618b037e18d01644638eaf41ecfa5def04 (diff) | |
| download | rust-698dfc322fd42fa4dff71474aba7cdf691a459a6.tar.gz rust-698dfc322fd42fa4dff71474aba7cdf691a459a6.zip | |
Silence redundant warning when E0038 will be emitted
Diffstat (limited to 'tests')
6 files changed, 19 insertions, 25 deletions
diff --git a/tests/rustdoc-ui/issues/issue-105742.stderr b/tests/rustdoc-ui/issues/issue-105742.stderr index ad1020a1f08..d5a9031075f 100644 --- a/tests/rustdoc-ui/issues/issue-105742.stderr +++ b/tests/rustdoc-ui/issues/issue-105742.stderr @@ -323,6 +323,10 @@ LL | || Output = <Self as SVec>::Item> as SVec>::Item, LL | | LL | | > { | |__^ ...because it uses `Self` as a type parameter +help: consider using an opaque type instead + | +LL | pub fn next<'a, T>(s: &'a mut impl SVec<Item = T, Output = T>) { + | ~~~~ error[E0107]: missing generics for associated type `SVec::Item` --> $DIR/issue-105742.rs:15:21 diff --git a/tests/ui/object-safety/bare-trait-dont-suggest-dyn.fixed b/tests/ui/object-safety/bare-trait-dont-suggest-dyn.fixed index 9720a781eb8..e95b982966d 100644 --- a/tests/ui/object-safety/bare-trait-dont-suggest-dyn.fixed +++ b/tests/ui/object-safety/bare-trait-dont-suggest-dyn.fixed @@ -1,9 +1,7 @@ // run-rustfix #![deny(bare_trait_objects)] fn ord_prefer_dot(s: String) -> impl Ord { - //~^ ERROR trait objects without an explicit `dyn` are deprecated - //~| ERROR the trait `Ord` cannot be made into an object - //~| WARNING this is accepted in the current edition (Rust 2015) + //~^ ERROR the trait `Ord` cannot be made into an object (s.starts_with("."), s) } fn main() { diff --git a/tests/ui/object-safety/bare-trait-dont-suggest-dyn.rs b/tests/ui/object-safety/bare-trait-dont-suggest-dyn.rs index 31d6e336ccf..fdf7e0a77aa 100644 --- a/tests/ui/object-safety/bare-trait-dont-suggest-dyn.rs +++ b/tests/ui/object-safety/bare-trait-dont-suggest-dyn.rs @@ -1,9 +1,7 @@ // run-rustfix #![deny(bare_trait_objects)] fn ord_prefer_dot(s: String) -> Ord { - //~^ ERROR trait objects without an explicit `dyn` are deprecated - //~| ERROR the trait `Ord` cannot be made into an object - //~| WARNING this is accepted in the current edition (Rust 2015) + //~^ ERROR the trait `Ord` cannot be made into an object (s.starts_with("."), s) } fn main() { diff --git a/tests/ui/object-safety/bare-trait-dont-suggest-dyn.stderr b/tests/ui/object-safety/bare-trait-dont-suggest-dyn.stderr index 468a570a0f9..2c499d240ab 100644 --- a/tests/ui/object-safety/bare-trait-dont-suggest-dyn.stderr +++ b/tests/ui/object-safety/bare-trait-dont-suggest-dyn.stderr @@ -1,21 +1,3 @@ -error: trait objects without an explicit `dyn` are deprecated - --> $DIR/bare-trait-dont-suggest-dyn.rs:3:33 - | -LL | fn ord_prefer_dot(s: String) -> Ord { - | ^^^ - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> -note: the lint level is defined here - --> $DIR/bare-trait-dont-suggest-dyn.rs:2:9 - | -LL | #![deny(bare_trait_objects)] - | ^^^^^^^^^^^^^^^^^^ -help: `Ord` is not object safe, use `impl Ord` to return an opaque type, as long as you return a single underlying type - | -LL | fn ord_prefer_dot(s: String) -> impl Ord { - | ++++ - error[E0038]: the trait `Ord` cannot be made into an object --> $DIR/bare-trait-dont-suggest-dyn.rs:3:33 | @@ -29,7 +11,11 @@ note: for a trait to be "object safe" it needs to allow building a vtable to all ::: $SRC_DIR/core/src/cmp.rs:LL:COL | = note: the trait cannot be made into an object because it uses `Self` as a type parameter +help: consider using an opaque type instead + | +LL | fn ord_prefer_dot(s: String) -> impl Ord { + | ++++ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/object-safety/object-safety-supertrait-mentions-Self.stderr b/tests/ui/object-safety/object-safety-supertrait-mentions-Self.stderr index 08df069275a..fc476691d01 100644 --- a/tests/ui/object-safety/object-safety-supertrait-mentions-Self.stderr +++ b/tests/ui/object-safety/object-safety-supertrait-mentions-Self.stderr @@ -11,6 +11,10 @@ LL | trait Baz : Bar<Self> { | --- ^^^^^^^^^ ...because it uses `Self` as a type parameter | | | this trait cannot be made into an object... +help: consider using an opaque type instead + | +LL | fn make_baz<T:Baz>(t: &T) -> &impl Baz { + | ~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/traits/issue-28576.stderr b/tests/ui/traits/issue-28576.stderr index 9fe50864642..3b45a510341 100644 --- a/tests/ui/traits/issue-28576.stderr +++ b/tests/ui/traits/issue-28576.stderr @@ -14,6 +14,10 @@ LL | pub trait Bar: Foo<Assoc=()> { | | | ...because it uses `Self` as a type parameter | | ...because it uses `Self` as a type parameter | this trait cannot be made into an object... +help: consider using an opaque type instead + | +LL | impl Bar + | ~~~~ error: aborting due to 1 previous error |
