Avoid more platform dependent errors in UI tests.

This commit is contained in:
Sergio Benitez 2022-05-03 14:33:11 -07:00
parent 55ea5dfb35
commit 4c6c0b497c
3 changed files with 48 additions and 26 deletions

View File

@ -477,23 +477,21 @@ note: function defined here
| pub fn ext<'v>(file: &TempFile<'_>, r#type: ContentType) -> Result<'v, ()> {
| ^^^
error[E0277]: the trait bound `usize: From<&str>` is not satisfied
error[E0308]: mismatched types
--> tests/ui-fail-nightly/from_form.rs:171:23
|
171 | #[field(default = "no conversion")]
| ^^^^^^^^^^^^^^^ the trait `From<&str>` is not implemented for `usize`
171 | #[field(default = 123)]
| ^^^
| |
| expected struct `std::string::String`, found integer
| arguments to this enum variant are incorrect
|
= help: the following other types implement trait `From<T>`:
<f32 as From<i16>>
<f32 as From<i8>>
<f32 as From<u16>>
<f32 as From<u8>>
<f64 as From<f32>>
<f64 as From<i16>>
<f64 as From<i32>>
<f64 as From<i8>>
and 85 others
= note: required because of the requirements on the impl of `Into<usize>` for `&str`
help: try using a conversion method
|
171 | #[field(default = 123.to_string())]
| ++++++++++++
171 | #[field(default = 123.to_string())]
| ++++++++++++
error[E0308]: mismatched types
--> tests/ui-fail-nightly/from_form.rs:203:33
@ -509,3 +507,12 @@ help: try using a conversion method
| ++++++++++++
203 | #[field(default_with = Some("hi".to_string()))]
| ++++++++++++
error[E0277]: the trait bound `bool: From<&str>` is not satisfied
--> tests/ui-fail-nightly/from_form.rs:209:23
|
209 | #[field(default = "no conversion")]
| ^^^^^^^^^^^^^^^ the trait `From<&str>` is not implemented for `bool`
|
= help: the trait `From<subtle::Choice>` is implemented for `bool`
= note: required because of the requirements on the impl of `Into<bool>` for `&str`

View File

@ -501,19 +501,18 @@ error[E0308]: mismatched types
165 | #[field(validate = ext("hello"))]
| ^^^^^^^ expected struct `ContentType`, found `&str`
error[E0277]: the trait bound `usize: From<&str>` is not satisfied
error[E0308]: mismatched types
--> tests/ui-fail-stable/from_form.rs:171:23
|
171 | #[field(default = "no conversion")]
| ^^^^^^^^^^^^^^^ the trait `From<&str>` is not implemented for `usize`
171 | #[field(default = 123)]
| ^^^ expected struct `std::string::String`, found integer
|
= help: the following implementations were found:
<usize as From<NonZeroUsize>>
<usize as From<bool>>
<usize as From<mio::token::Token>>
<usize as From<runtime::thread_pool::idle::State>>
and 89 others
= note: required because of the requirements on the impl of `Into<usize>` for `&str`
help: try using a conversion method
|
171 | #[field(default = 123.to_string())]
| ++++++++++++
171 | #[field(default = 123.to_string())]
| ++++++++++++
error[E0308]: mismatched types
--> tests/ui-fail-stable/from_form.rs:203:33
@ -527,3 +526,13 @@ help: try using a conversion method
| ++++++++++++
203 | #[field(default_with = Some("hi".to_string()))]
| ++++++++++++
error[E0277]: the trait bound `bool: From<&str>` is not satisfied
--> tests/ui-fail-stable/from_form.rs:209:23
|
209 | #[field(default = "no conversion")]
| ^^^^^^^^^^^^^^^ the trait `From<&str>` is not implemented for `bool`
|
= help: the following implementations were found:
<bool as From<subtle::Choice>>
= note: required because of the requirements on the impl of `Into<bool>` for `&str`

View File

@ -168,8 +168,8 @@ struct Validate3 {
#[derive(FromForm)]
struct Default0 {
#[field(default = "no conversion")]
first: usize,
#[field(default = 123)]
first: String,
}
#[derive(FromForm)]
@ -204,6 +204,12 @@ struct Default5 {
no_conversion_from_with: String,
}
#[derive(FromForm)]
struct Default6 {
#[field(default = "no conversion")]
first: bool,
}
#[derive(FromForm)] // NO ERROR
struct Another<T> {
_foo: T,