mirror of https://github.com/rwf2/Rocket.git
Update UI tests for nightly.
This commit is contained in:
parent
7e913eb8ac
commit
162fafa0f1
|
@ -341,11 +341,6 @@ pub fn validators<'v>(field: Field<'v>) -> Result<impl Iterator<Item = syn::Expr
|
|||
.chain(FieldAttr::from_attrs(FieldAttr::NAME, field.parent.attrs())?)
|
||||
.filter_map(|a| a.validate)
|
||||
.map(move |mut expr| {
|
||||
// TODO:
|
||||
// * We need a hashset of the member accesses.
|
||||
// * And we need to know if they're bound by value or reference.
|
||||
// - if value, use `Some(#member) = #member`
|
||||
// - if ref, use `Some(#member) = &#member`
|
||||
let mut record = RecordMemberAccesses::default();
|
||||
record.accesses.insert((field.context_ident(), true));
|
||||
record.visit_expr(&expr);
|
||||
|
@ -381,18 +376,6 @@ pub fn validators<'v>(field: Field<'v>) -> Result<impl Iterator<Item = syn::Expr
|
|||
|
||||
expr
|
||||
}))
|
||||
// .map(move |(mut expr, local)| {
|
||||
// let ty_span = field.ty.span();
|
||||
// let mut v = ValidationMutator { field, local, visited: false };
|
||||
// v.visit_expr_mut(&mut expr);
|
||||
//
|
||||
// let span = expr.key_span.unwrap_or(ty_span);
|
||||
// define_spanned_export!(span => _form);
|
||||
// syn::parse2(quote_spanned!(span => {
|
||||
// let __result: #_form::Result<'_, ()> = #expr;
|
||||
// __result
|
||||
// })).unwrap()
|
||||
// }))
|
||||
}
|
||||
|
||||
/// Take an $expr in `default = $expr` and turn it into a `Some($expr.into())`.
|
||||
|
|
|
@ -428,12 +428,6 @@ note: error occurred while deriving `FromForm`
|
|||
| ^^^^^^^^
|
||||
= note: this error originates in the derive macro `FromForm` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0425]: cannot find function `unknown` in this scope
|
||||
--> tests/ui-fail-nightly/from_form.rs:153:24
|
||||
|
|
||||
153 | #[field(validate = unknown())]
|
||||
| ^^^^^^^ not found in this scope
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> tests/ui-fail-nightly/from_form.rs:147:24
|
||||
|
|
||||
|
@ -443,6 +437,12 @@ error[E0308]: mismatched types
|
|||
= note: expected enum `Result<(), Errors<'_>>`
|
||||
found type `{integer}`
|
||||
|
||||
error[E0425]: cannot find function `unknown` in this scope
|
||||
--> tests/ui-fail-nightly/from_form.rs:153:24
|
||||
|
|
||||
153 | #[field(validate = unknown())]
|
||||
| ^^^^^^^ not found in this scope
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> tests/ui-fail-nightly/from_form.rs:160:12
|
||||
|
|
||||
|
@ -479,7 +479,7 @@ error[E0308]: mismatched types
|
|||
--> tests/ui-fail-nightly/from_form.rs:171:23
|
||||
|
|
||||
171 | #[field(default = 123)]
|
||||
| ^^^
|
||||
| ^^^- help: try using a conversion method: `.to_string()`
|
||||
| |
|
||||
| expected struct `std::string::String`, found integer
|
||||
| arguments to this enum variant are incorrect
|
||||
|
@ -489,19 +489,14 @@ note: tuple variant defined here
|
|||
|
|
||||
| Some(#[stable(feature = "rust1", since = "1.0.0")] T),
|
||||
| ^^^^
|
||||
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
|
||||
|
|
||||
203 | #[field(default_with = Some("hi"))]
|
||||
| ---- ^^^^ expected struct `std::string::String`, found `&str`
|
||||
| |
|
||||
| ---- ^^^^- help: try using a conversion method: `.to_string()`
|
||||
| | |
|
||||
| | expected struct `std::string::String`, found `&str`
|
||||
| arguments to this enum variant are incorrect
|
||||
|
|
||||
note: tuple variant defined here
|
||||
|
@ -509,12 +504,6 @@ note: tuple variant defined here
|
|||
|
|
||||
| Some(#[stable(feature = "rust1", since = "1.0.0")] T),
|
||||
| ^^^^
|
||||
help: try using a conversion method
|
||||
|
|
||||
203 | #[field(default_with = Some("hi".to_string()))]
|
||||
| ++++++++++++
|
||||
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
|
||||
|
|
|
@ -109,7 +109,7 @@ fn test_form_validation_context() {
|
|||
assert_eq!(fuzzy(&c, "cats[0].nick", None), 1);
|
||||
assert_eq!(exact(&c, "cats[0].name", None), 1);
|
||||
|
||||
let c = dbg!(errors::<Person>("kitty.name=Michael"));
|
||||
let c = errors::<Person>("kitty.name=Michael");
|
||||
assert_eq!(exact(&c, "kitty.nick", Missing), 1);
|
||||
assert_eq!(exact(&c, "dog", Missing), 1);
|
||||
assert_eq!(exact(&c, "cats[0].name", None), 0);
|
||||
|
|
Loading…
Reference in New Issue