mirror of https://github.com/rwf2/Rocket.git
Remove closure borrow in 'FromForm' derive.
The codegen for field validations previously included a closure that could potentially partially borrow a 'Copy' field of the context structure. To prevent this, 'let'-assign the field before the closure is created, and use the assignment inside of the closure.
This commit is contained in:
parent
f1f533c1e5
commit
9f65977b99
|
@ -368,7 +368,8 @@ pub fn validators<'v>(field: Field<'v>) -> Result<impl Iterator<Item = syn::Expr
|
|||
_ => Ok(()),
|
||||
};
|
||||
|
||||
__result.map_err(|__e| match #name_opt {
|
||||
let __e_name = #name_opt;
|
||||
__result.map_err(|__e| match __e_name {
|
||||
Some(__name) => __e.with_name(__name),
|
||||
None => __e
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue