programatik29 / axum-server

High level server designed to be used with axum framework.
MIT License
168 stars 56 forks source link

error: no rules expected the token `;` #58

Closed fejfighter closed 1 year ago

fejfighter commented 1 year ago

I seem to be having trouble incorporating the example code into a toy project I am playing with to learn a bit of rust.

Not sure what he cause is, but I'm on 1.64 on fedora if that makes much of a difference

   Compiling axum-server v0.4.2
error: no rules expected the token `;`
  --> /home/fejfighter/.cargo/registry/src/github.com-1ecc6299db9ec823/axum-server-0.4.2/src/handle.rs:94:23
   |
94 |                 biased;
   |                       ^ no rules expected this token in macro call

error: no rules expected the token `;`
   --> /home/fejfighter/.cargo/registry/src/github.com-1ecc6299db9ec823/axum-server-0.4.2/src/server.rs:175:27
    |
175 |                     biased;
    |                           ^ no rules expected this token in macro call

error: no rules expected the token `;`
   --> /home/fejfighter/.cargo/registry/src/github.com-1ecc6299db9ec823/axum-server-0.4.2/src/server.rs:204:35
    |
204 | ...                   biased;
    |                             ^ no rules expected this token in macro call

error: no rules expected the token `;`
   --> /home/fejfighter/.cargo/registry/src/github.com-1ecc6299db9ec823/axum-server-0.4.2/src/server.rs:214:19
    |
214 |             biased;
    |                   ^ no rules expected this token in macro call

error: could not compile `axum-server` due to 4 previous errors
programatik29 commented 1 year ago

Something is wrong with your tokio::select! I guess. I can't reproduce it. Can you share your Cargo.toml?

fejfighter commented 1 year ago
[package]
name = "nnrgmail"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
google-gmail1 = "4.0.1+20220228"
hyper = "0.14.20"
hyper-tls = "0.5.0"
hyper-rustls = "0.23.0"
axum-server = "~0.4"
tokio = { version = "~1.2", features = [
    "macros",
    "io-util",
    "rt",
    "rt-multi-thread",
    "fs",
] }
futures-util = "0.3.24"
tokio-rustls = "0.23.4"
rustls = "*"
rustls-pemfile = "1.0.1"
open = "1"
form_urlencoded = "1.1.0"
serde = "*"
serde_json = "*"

[dependencies.async-std]
version = "1.6"
features = ["attributes"]

Sorry, I have been AFK for the last few days, there's a heap of extra stuff there because in the interest of progress/experimentation I have hacked something together short term with hyper.

from what you have suggested I might be missing a feature flag in tokio?

programatik29 commented 1 year ago

Found the problem. It seems like tokio added biased option (which axum-server use) in version 1.4 and you are forcing to use version 1.2.

A slight oversight on my part. I should put tokio dependency to version 1.4 instead of 1.

fejfighter commented 1 year ago

Awesome, that works for me.

Not 100% sure why I had 1.2, probably from some tutorial/quick start I was looking at.

closing as this seems to fix the issue