Skip to content
Myr

Add ui test of unimplemented trait required by dependency

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent 3e1cf11 · Browse files · 2 files+119 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+119 added−0 removed

  • tests:+119 added−0 removed

2 files+119 added−0 removed

added:test_suite/tests/ui/unimplemented/required_by_dependency.rs+6 added
1struct MyStruct;23fn main() {4 serde_test::assert_ser_tokens(&MyStruct, &[]);5 serde_test::assert_de_tokens(&MyStruct, &[]);6}
added:test_suite/tests/ui/unimplemented/required_by_dependency.stderr+113 added
1error[E0277]: the trait bound `MyStruct: serde_core::ser::Serialize` is not satisfied2 --> tests/ui/unimplemented/required_by_dependency.rs:4:353 |44 | serde_test::assert_ser_tokens(&MyStruct, &[]);5 | ----------------------------- ^^^^^^^^^ unsatisfied trait bound6 | |7 | required by a bound introduced by this call8 |9help: the trait `serde_core::ser::Serialize` is not implemented for `MyStruct`10 --> tests/ui/unimplemented/required_by_dependency.rs:1:111 |121 | struct MyStruct;13 | ^^^^^^^^^^^^^^^14 = note: for local types consider adding `#[derive(serde::Serialize)]` to your `MyStruct` type15 = note: for types from other crates check whether the crate offers a `serde` feature flag16 = help: the following other types implement trait `serde_core::ser::Serialize`:17 &'a T18 &'a mut T19 ()20 (T,)21 (T0, T1)22 (T0, T1, T2)23 (T0, T1, T2, T3)24 (T0, T1, T2, T3, T4)25 and $N others26note: required by a bound in `assert_ser_tokens`27 --> $CARGO/serde_test-$VERSION/src/assert.rs28 |29 | pub fn assert_ser_tokens<T>(value: &T, tokens: &[Token])30 | ----------------- required by a bound in this function31 | where32 | T: ?Sized + Serialize,33 | ^^^^^^^^^ required by this bound in `assert_ser_tokens`3435error[E0277]: the trait bound `MyStruct: serde_core::de::Deserialize<'_>` is not satisfied36 --> tests/ui/unimplemented/required_by_dependency.rs:5:3437 |385 | serde_test::assert_de_tokens(&MyStruct, &[]);39 | ---------------------------- ^^^^^^^^^ unsatisfied trait bound40 | |41 | required by a bound introduced by this call42 |43help: the trait `serde_core::de::Deserialize<'_>` is not implemented for `MyStruct`44 --> tests/ui/unimplemented/required_by_dependency.rs:1:145 |461 | struct MyStruct;47 | ^^^^^^^^^^^^^^^48 = note: for local types consider adding `#[derive(serde::Deserialize)]` to your `MyStruct` type49 = note: for types from other crates check whether the crate offers a `serde` feature flag50 = help: the following other types implement trait `serde_core::de::Deserialize<'de>`:51 &'a Path52 &'a [u8]53 &'a str54 ()55 (T,)56 (T0, T1)57 (T0, T1, T2)58 (T0, T1, T2, T3)59 and $N others60note: required by a bound in `assert_de_tokens`61 --> $CARGO/serde_test-$VERSION/src/assert.rs62 |63 | pub fn assert_de_tokens<'de, T>(value: &T, tokens: &'de [Token])64 | ---------------- required by a bound in this function65 | where66 | T: Deserialize<'de> + PartialEq + Debug,67 | ^^^^^^^^^^^^^^^^ required by this bound in `assert_de_tokens`6869error[E0277]: can't compare `MyStruct` with `MyStruct`70 --> tests/ui/unimplemented/required_by_dependency.rs:5:3471 |725 | serde_test::assert_de_tokens(&MyStruct, &[]);73 | ---------------------------- ^^^^^^^^^ no implementation for `MyStruct == MyStruct`74 | |75 | required by a bound introduced by this call76 |77 = help: the trait `PartialEq` is not implemented for `MyStruct`78note: required by a bound in `assert_de_tokens`79 --> $CARGO/serde_test-$VERSION/src/assert.rs80 |81 | pub fn assert_de_tokens<'de, T>(value: &T, tokens: &'de [Token])82 | ---------------- required by a bound in this function83 | where84 | T: Deserialize<'de> + PartialEq + Debug,85 | ^^^^^^^^^ required by this bound in `assert_de_tokens`86help: consider annotating `MyStruct` with `#[derive(PartialEq)]`87 |88 1 + #[derive(PartialEq)]89 2 | struct MyStruct;90 |9192error[E0277]: `MyStruct` doesn't implement `Debug`93 --> tests/ui/unimplemented/required_by_dependency.rs:5:3494 |955 | serde_test::assert_de_tokens(&MyStruct, &[]);96 | ---------------------------- ^^^^^^^^^ the trait `Debug` is not implemented for `MyStruct`97 | |98 | required by a bound introduced by this call99 |100 = note: add `#[derive(Debug)]` to `MyStruct` or manually `impl Debug for MyStruct`101note: required by a bound in `assert_de_tokens`102 --> $CARGO/serde_test-$VERSION/src/assert.rs103 |104 | pub fn assert_de_tokens<'de, T>(value: &T, tokens: &'de [Token])105 | ---------------- required by a bound in this function106 | where107 | T: Deserialize<'de> + PartialEq + Debug,108 | ^^^^^ required by this bound in `assert_de_tokens`109help: consider annotating `MyStruct` with `#[derive(Debug)]`110 |111 1 + #[derive(Debug)]112 2 | struct MyStruct;113 |