Skip to content

Strange unreachable warning in Future #60394

Closed
@sbwtw

Description

@sbwtw

Code:

use futures::future;
use futures::Future;

fn f() -> impl Future<Item = (), Error = ()> {
    future::ok(unimplemented!())
}

fn main() {
    let s = f();

    tokio::run(s);
}

And when build with cargo build, It will says the future::ok(unimplemented!()) is unreachable expression.
but when cargo run, I got a panic: thread 'main' panicked at 'not yet implemented', src\main.rs:5:16. the unimplemented!() macro is worked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions