{"action":"created","issue":{"url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/182","repository_url":"https://api.github.com/repos/SergioBenitez/Rocket","labels_url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/182/labels{/name}","comments_url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/182/comments","events_url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/182/events","html_url":"https://github.com/SergioBenitez/Rocket/issues/182","id":206409708,"number":182,"title":"Weird codegen error with route","user":{"login":"kballard","id":714,"avatar_url":"https://avatars.githubusercontent.com/u/714?v=3","gravatar_id":"","url":"https://api.github.com/users/kballard","html_url":"https://github.com/kballard","followers_url":"https://api.github.com/users/kballard/followers","following_url":"https://api.github.com/users/kballard/following{/other_user}","gists_url":"https://api.github.com/users/kballard/gists{/gist_id}","starred_url":"https://api.github.com/users/kballard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kballard/subscriptions","organizations_url":"https://api.github.com/users/kballard/orgs","repos_url":"https://api.github.com/users/kballard/repos","events_url":"https://api.github.com/users/kballard/events{/privacy}","received_events_url":"https://api.github.com/users/kballard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-02-09T05:34:30Z","updated_at":"2017-02-09T05:43:41Z","closed_at":null,"body":"I'm getting a really weird error from one of my routes. The route itself looks like\r\n\r\n```rust\r\n#[post(\"/foo/<id>/edit\", data=\"<form>\")]\r\nfn post_edit_foo(id: i32, form: Form<FooForm>, pool: State<Pool>)\r\n        -> Result<Flash<Redirect>,Failure> {\r\n    …\r\n}\r\n```\r\n\r\nBut when I try to compile it, I get 2 identical errors that look like\r\n\r\n```\r\nerror[E0308]: mismatched types\r\n   --> src/main.rs:118:1\r\n    |\r\n118 | #[post(\"/foo/<id>/edit\", data=\"<form>\")]\r\n    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected &str, found struct `std::string::String`\r\n    |\r\n    = note: expected type `&str`\r\n               found type `std::string::String`\r\n    = help: here are some functions which might fulfill your needs:\r\n            - .as_str()\r\n            - .trim()\r\n            - .trim_left()\r\n            - .trim_right()\r\n    = note: this error originates in a macro outside of the current crate\r\n```\r\n\r\nSince the error is in the generated code, I have no idea what's actually going wrong or how to fix it. I tried writing a sample app to reproduce this without any luck.\r\n\r\nAny idea what's going wrong? Or any suggestions on how to debug this?\r\n\r\nThis is with rocket 0.2.0."},"comment":{"url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/comments/278552935","html_url":"https://github.com/SergioBenitez/Rocket/issues/182#issuecomment-278552935","issue_url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/182","id":278552935,"user":{"login":"kballard","id":714,"avatar_url":"https://avatars.githubusercontent.com/u/714?v=3","gravatar_id":"","url":"https://api.github.com/users/kballard","html_url":"https://github.com/kballard","followers_url":"https://api.github.com/users/kballard/followers","following_url":"https://api.github.com/users/kballard/following{/other_user}","gists_url":"https://api.github.com/users/kballard/gists{/gist_id}","starred_url":"https://api.github.com/users/kballard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kballard/subscriptions","organizations_url":"https://api.github.com/users/kballard/orgs","repos_url":"https://api.github.com/users/kballard/repos","events_url":"https://api.github.com/users/kballard/events{/privacy}","received_events_url":"https://api.github.com/users/kballard/received_events","type":"User","site_admin":false},"created_at":"2017-02-09T05:43:41Z","updated_at":"2017-02-09T05:43:41Z","body":"Ah hah, the error was in my code! I assumed it couldn't be, because the error specifically indicated it came from a macro. I didn't realize rocket_codegen effectively rewrites my function in a way that breaks compiler errors. Is there no way to preserve the span info so the compiler error works just fine?\r\n\r\nAlso, I've already seen plenty of errors that pointed into my handlers just fine, so I'm pretty confused as to why this particular error didn't. The root cause of the error was `Redirect::to(format!(\"/foo/{}\", id))`."}}
{"actor":{"display_login":"kballard"}}