Fix compile error. #7

Closed
YinMo19 wants to merge 1 commits from YinMo19/rocket_session:master into master
YinMo19 commented 6 days ago

Fix Compile error

  • Cookie::build(self.config.cookie_name.clone(), session.to_string())
  • Cookie::build((self.config.cookie_name.clone(), session.to_string()))
  • async fn from_request(request: &'r Request<'_>) -> Outcome<Self, (Status, Self::Error), ()> {
  • async fn from_request(request: &'r Request<'_>) -> Outcome<Self, (Status, Self::Error), Status> {

Origin compile error:

    Checking rocket_session v0.3.0
error[E0053]: method `from_request` has an incompatible type for trait
   --> /Users/yinmo19/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/rocket_session-0.3.0/src/lib.rs:122:1
    |
122 | #[rocket::async_trait]
    | ^^^^^^^^^^^^^^^^^^^^^^ expected `Status`, found `()`
    |
    = note: expected signature `fn(&'r rocket::Request<'_>) -> Pin<Box<(dyn std::future::Future<Output = Outcome<Session<'r, D>, (Status, ()), Status>> + std::marker::Send + 'async_trait)>>`
               found signature `fn(&'r rocket::Request<'_>) -> Pin<Box<(dyn std::future::Future<Output = Outcome<Session<'r, D>, (Status, ()), ()>> + std::marker::Send + 'async_trait)>>`
    = note: this error originates in the attribute macro `rocket::async_trait` (in Nightly builds, run with -Z macro-backtrace for more info)
help: change the output type to match the trait
    |
122 | Pin<Box<(dyn std::future::Future<Output = Outcome<Session<'r, D>, (Status, ()), Status>> + std::marker::Send + 'async_trait)>>
    |

error[E0061]: this function takes 1 argument but 2 arguments were supplied
   --> /Users/yinmo19/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/rocket_session-0.3.0/src/lib.rs:324:17
    |
324 |                 Cookie::build(self.config.cookie_name.clone(), session.to_string())
    |                 ^^^^^^^^^^^^^                                  ------------------- unexpected argument #2 of type `std::string::String`
    |
note: associated function defined here
   --> /Users/yinmo19/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/cookie-0.18.1/src/lib.rs:327:12
    |
327 |     pub fn build<C: Into<Cookie<'c>>>(base: C) -> CookieBuilder<'c> {
    |            ^^^^^
help: remove the extra argument
    |
324 -                 Cookie::build(self.config.cookie_name.clone(), session.to_string())
324 +                 Cookie::build(self.config.cookie_name.clone())
    |

Some errors have detailed explanations: E0053, E0061.
For more information about an error, try `rustc --explain E0053`.
error: could not compile `rocket_session` (lib) due to 2 previous errors
Fix Compile error --- - Cookie::build(self.config.cookie_name.clone(), session.to_string()) + Cookie::build((self.config.cookie_name.clone(), session.to_string())) - async fn from_request(request: &'r Request<'_>) -> Outcome<Self, (Status, Self::Error), ()> { + async fn from_request(request: &'r Request<'_>) -> Outcome<Self, (Status, Self::Error), Status> { Origin compile error: --- ``` Checking rocket_session v0.3.0 error[E0053]: method `from_request` has an incompatible type for trait --> /Users/yinmo19/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/rocket_session-0.3.0/src/lib.rs:122:1 | 122 | #[rocket::async_trait] | ^^^^^^^^^^^^^^^^^^^^^^ expected `Status`, found `()` | = note: expected signature `fn(&'r rocket::Request<'_>) -> Pin<Box<(dyn std::future::Future<Output = Outcome<Session<'r, D>, (Status, ()), Status>> + std::marker::Send + 'async_trait)>>` found signature `fn(&'r rocket::Request<'_>) -> Pin<Box<(dyn std::future::Future<Output = Outcome<Session<'r, D>, (Status, ()), ()>> + std::marker::Send + 'async_trait)>>` = note: this error originates in the attribute macro `rocket::async_trait` (in Nightly builds, run with -Z macro-backtrace for more info) help: change the output type to match the trait | 122 | Pin<Box<(dyn std::future::Future<Output = Outcome<Session<'r, D>, (Status, ()), Status>> + std::marker::Send + 'async_trait)>> | error[E0061]: this function takes 1 argument but 2 arguments were supplied --> /Users/yinmo19/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/rocket_session-0.3.0/src/lib.rs:324:17 | 324 | Cookie::build(self.config.cookie_name.clone(), session.to_string()) | ^^^^^^^^^^^^^ ------------------- unexpected argument #2 of type `std::string::String` | note: associated function defined here --> /Users/yinmo19/.cargo/registry/src/mirrors.ustc.edu.cn-12df342d903acd47/cookie-0.18.1/src/lib.rs:327:12 | 327 | pub fn build<C: Into<Cookie<'c>>>(base: C) -> CookieBuilder<'c> { | ^^^^^ help: remove the extra argument | 324 - Cookie::build(self.config.cookie_name.clone(), session.to_string()) 324 + Cookie::build(self.config.cookie_name.clone()) | Some errors have detailed explanations: E0053, E0061. For more information about an error, try `rustc --explain E0053`. error: could not compile `rocket_session` (lib) due to 2 previous errors ```
YinMo19 added 1 commit 6 days ago
96ba2d5d74 Fix compile error.
Owner

Isn't this the same thing there already is a merge request for? I will try to merge that one soon

Isn't this the same thing there already is a merge request for? I will try to merge that one soon
Poster

Very Sorry, I didn't see it.

I'm using it today, and found it something wrong...

Very Sorry, I didn't see it. I'm using it today, and found it something wrong...
YinMo19 closed this pull request 5 days ago
Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: packages/rocket_session#7
Loading…
There is no content yet.