Skip to content

Instantly share code, notes, and snippets.

@lawliet89
Created July 14, 2017 14:29
Show Gist options
  • Save lawliet89/7a6bfeff39918f3d32149393cf3627b0 to your computer and use it in GitHub Desktop.
Save lawliet89/7a6bfeff39918f3d32149393cf3627b0 to your computer and use it in GitHub Desktop.
Compile Error
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'r` due to conflicting requirements
--> tests/lifetimes.rs:37:1
|
37 | #[get("/string_state")]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 37:1...
--> tests/lifetimes.rs:37:1
|
37 | #[get("/string_state")]
| ^^^^^^^^^^^^^^^^^^^^^^^
note: ...so that expression is assignable (expected &rocket::Request<'_>, found &rocket::Request<'_>)
--> tests/lifetimes.rs:37:1
|
37 | #[get("/string_state")]
| ^^^^^^^^^^^^^^^^^^^^^^^
= note: but, the lifetime must be valid for the static lifetime...
note: ...so that types are compatible (expected rocket::response::Responder<'_>, found rocket::response::Responder<'static>)
--> tests/lifetimes.rs:37:1
|
37 | #[get("/string_state")]
| ^^^^^^^^^^^^^^^^^^^^^^^
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'r` due to conflicting requirements
--> tests/lifetimes.rs:39:5
|
39 | Responder::new("Testing".to_string(), state.inner())
| ^^^^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 38:1...
--> tests/lifetimes.rs:38:1
|
38 | / fn string_state(state: State<SomeState>) -> Responder<String> {
39 | | Responder::new("Testing".to_string(), state.inner())
40 | | }
| |_^
note: ...so that expression is assignable (expected Responder<'_, _>, found Responder<'_, _>)
--> tests/lifetimes.rs:39:5
|
39 | Responder::new("Testing".to_string(), state.inner())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: but, the lifetime must be valid for the static lifetime...
note: ...so that types are compatible (expected rocket::response::Responder<'_>, found rocket::response::Responder<'static>)
--> tests/lifetimes.rs:39:5
|
39 | Responder::new("Testing".to_string(), state.inner())
| ^^^^^^^^^^^^^^
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'r` due to conflicting requirements
--> tests/lifetimes.rs:52:1
|
52 | #[get("/unit_state")]
| ^^^^^^^^^^^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 52:1...
--> tests/lifetimes.rs:52:1
|
52 | #[get("/unit_state")]
| ^^^^^^^^^^^^^^^^^^^^^
note: ...so that expression is assignable (expected &rocket::Request<'_>, found &rocket::Request<'_>)
--> tests/lifetimes.rs:52:1
|
52 | #[get("/unit_state")]
| ^^^^^^^^^^^^^^^^^^^^^
= note: but, the lifetime must be valid for the static lifetime...
note: ...so that types are compatible (expected rocket::response::Responder<'_>, found rocket::response::Responder<'static>)
--> tests/lifetimes.rs:52:1
|
52 | #[get("/unit_state")]
| ^^^^^^^^^^^^^^^^^^^^^
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'r` due to conflicting requirements
--> tests/lifetimes.rs:54:5
|
54 | Responder::new((), state.inner())
| ^^^^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 53:1...
--> tests/lifetimes.rs:53:1
|
53 | / fn unit_state(state: State<SomeState>) -> Responder<()> {
54 | | Responder::new((), state.inner())
55 | | }
| |_^
note: ...so that expression is assignable (expected Responder<'_, _>, found Responder<'_, _>)
--> tests/lifetimes.rs:54:5
|
54 | Responder::new((), state.inner())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: but, the lifetime must be valid for the static lifetime...
note: ...so that types are compatible (expected rocket::response::Responder<'_>, found rocket::response::Responder<'static>)
--> tests/lifetimes.rs:54:5
|
54 | Responder::new((), state.inner())
| ^^^^^^^^^^^^^^
error: aborting due to 4 previous errors
error: Could not compile `rocket_cors`.
To learn more, run the command again with --verbose.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment