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
But when I try to compile it, I get 2 identical errors that look like
error[E0308]: mismatched types
--> src/main.rs:118:1
|
118 | #[post("/foo/<id>/edit", data="<form>")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected &str, found struct `std::string::String`
|
= note: expected type `&str`
found type `std::string::String`
= help: here are some functions which might fulfill your needs:
- .as_str()
- .trim()
- .trim_left()
- .trim_right()
= note: this error originates in a macro outside of the current crate
Since 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.
Any idea what's going wrong? Or any suggestions on how to debug this?
This is with rocket 0.2.0.
The text was updated successfully, but these errors were encountered:
Are you sure it's not in the body of your handler? As indicated in the documentation, you can set ROCKET_CODEGEN_DEBUG=1 during compilation to see the generated code.
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?
Also, 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)).
I imagine it has something to do with the format! macro. I'd report this to Rust; it's an interesting case. Anyway, looks like the issue here is resolved. Closing it out.
I'm getting a really weird error from one of my routes. The route itself looks like
But when I try to compile it, I get 2 identical errors that look like
Since 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.
Any idea what's going wrong? Or any suggestions on how to debug this?
This is with rocket 0.2.0.
The text was updated successfully, but these errors were encountered: