You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The version of Rocket you're using. Ensure it's the latest, if possible.
0.2.5
A brief description of the bug that includes:
* The nature of the bug.
* When the bug occurs.
When struct has one and only one field named v.
* What you expected vs. what actually happened.
It compiles vs error.
How you discovered the bug. Short test cases are especially useful.
Code:
#![feature(plugin, custom_derive)]#![plugin(rocket_codegen)]externcrate rocket;#[macro_use]externcrate rocket_contrib;use rocket_contrib::{JSON,Value};#[derive(FromForm)]structPerson<'r>{v:&'r str,}#[get("/file?<person>")]fnstyles_with_query(person:Person) -> String{format!("Hello {}!", person.v)}#[error(404)]fnnot_found() -> JSON<Value>{JSON(json!({"status": "error",
"reason": "Resource was not found."}))}fnmain(){
rocket::ignite().mount("/",routes![styles_with_query]).catch(errors![not_found]).launch();}
Running:
$ rustup install nightly-2017-04-16
$ rustup override set nightly-2017-04-16
$ cargo build
Compiling bug v0.1.0 (file:///C:/projects/rust/rocket-bug)
error[E0308]: match arms have incompatible types
--> src\main.rs:11:10
|
11 |#[derive(FromForm)]| ^^^^^^^^ expected &str, found enum `std::option::Option`|
= note: expected type`&str`
found type`std::option::Option<_>`
note: match arm with an incompatible type
--> src\main.rs:11:10
|
11 |#[derive(FromForm)]| ^^^^^^^^
error: aborting due to previous error
error: Could not compile `rocket-bug`.
To learn more, run the command again with --verbose.
Ideas, if any, about what Rocket is doing incorrectly.
It works if field has any other name than v.
The text was updated successfully, but these errors were encountered:
0.2.5
* The nature of the bug.
* When the bug occurs.
When struct has one and only one field named
v
.* What you expected vs. what actually happened.
It compiles vs error.
Code:
Running:
It works if field has any other name than
v
.The text was updated successfully, but these errors were encountered: