Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A new warning on rust beta: unreachable pattern #2864

Open
4 tasks done
komar007 opened this issue Sep 10, 2024 · 2 comments
Open
4 tasks done

A new warning on rust beta: unreachable pattern #2864

komar007 opened this issue Sep 10, 2024 · 2 comments
Labels
triage A bug report being investigated

Comments

@komar007
Copy link

komar007 commented Sep 10, 2024

Rocket Version

0.5.1

Operating System

Ubuntu 22.04.4

Rust Toolchain Version

1.82.0-beta.3

What happened?

Just letting you know of a potential problem coming. I have a CI running my code at work on beta rust, clippy, fmt, etc and recently there's been a new warning when using rocket_ws::WebSocket. It seems it could originate somewhere in rocket's macro:

warning: unreachable pattern
 --> src/main.rs:5:9
  |
5 |     ws: rocket_ws::WebSocket,
  |         ^^^^^^^^^ matches no values because `(rocket::http::Status, Infallible)` is uninhabited
  |
  = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
  = note: `#[warn(unreachable_patterns)]` on by default

Below is a somewhat minimal reproduction code.

Test Case

use rocket::{get, response::status::NotFound};

#[get("/endpoint")]
pub async fn endpoint(
    ws: rocket_ws::WebSocket,
) -> Result<rocket_ws::Channel<'static>, NotFound<()>> {
    Ok(ws.channel(|_| Box::pin(async { Ok(()) })))
}

fn main() {}

Log Output

warning: unreachable pattern
 --> src/main.rs:5:9
  |
5 |     ws: rocket_ws::WebSocket,
  |         ^^^^^^^^^ matches no values because `(rocket::http::Status, Infallible)` is uninhabited
  |
  = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
  = note: `#[warn(unreachable_patterns)]` on by default

Additional Context

No response

System Checks

  • My bug report relates to functionality.
  • I have tested against the latest Rocket release or a recent git commit.
  • I have tested against the latest stable rustc toolchain.
  • I was unable to find this issue previously reported.
@komar007 komar007 added the triage A bug report being investigated label Sep 10, 2024
@mikemoore13
Copy link

mikemoore13 commented Sep 23, 2024

On my side this warning get fixed by updating rust
rustup update

@komar007
Copy link
Author

Indeed, no warning on 1.82.0-beta.4 anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage A bug report being investigated
Projects
None yet
Development

No branches or pull requests

2 participants