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
Rustc reports an internal compiler error: unexpected panic by compiling a Rocket program.
I guess the problem is a logically wrong function call by calling two "#get" functions which are close to being similar which should report an error.
This is the code of failure:
#[get("/")]
fn lipmato(_user: UserId, ctrl: State<SafeController>, flash: Option<FlashMessage>) -> Template {
let tmpl = &mut TemplateLipmato::from_controller(
&ctrl,
);
if flash.is_some() {
tmpl.error_occured(flash.unwrap().msg().to_string());
}
Template::render(
"lipmato",
tmpl)
}
// this function below should probably report an error. If I do not call this function, rustc works well. Otherwise it crashes.
#[get("/"), rank = 2]
fn lipmato(_user: UserId, ctrl: State<SafeController>) -> Redirect {
if let Some(user) = ctrl.lock().unwrap().get_user_by_id(_user.0) {
if !user.allow_lipmato {
Redirect::to("/login")
}
}
}
(note: it doesn't have anything to do with the names of the functions (although I imagine that probably is a problem; I don't know, I don't use Rocket).
Anyways, the ICE is happening due to the invalid syntax in the second #[get] attribute. Unfortunately the compiler dies before telling you what the error is, but that will be fixed. To fix your code, the rank = 2 should be moved into the parentheses of get())
Rustc reports an
internal compiler error: unexpected panic
by compiling a Rocket program.I guess the problem is a logically wrong function call by calling two "#get" functions which are close to being similar which should report an error.
This is the code of failure:
Meta
The text was updated successfully, but these errors were encountered: