Skip to content

A new warning on rust beta: unreachable pattern #2864

Closed as not planned
Closed as not planned
@komar007

Description

@komar007

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageA bug report being investigated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions