Skip to content

async functions with unimplemented!() are marked as unreachable #64636

Closed
@tacomorphism

Description

@tacomorphism

can reproduce with

async fn example(){
 unimplemented!()
}

results in

warning: unreachable expression
 --> src/main.rs:1:19
  |
1 |   async fn example(){
  |  ___________________^
2 | |   unimplemented!()
3 | | }
  | |_^
  |
  = note: `#[warn(unreachable_code)]` on by default

using nightly-2019-09-18

Seems related to #61798

Activity

added
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
C-bugCategory: This is a bug.
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Sep 20, 2019
tmandry

tmandry commented on Sep 21, 2019

@tmandry
Member

This also happens with loops which return (first reported in #61798 (comment)).

Minimal example:

async fn foo() {
    loop {
        return;
    }
}
warning: unreachable expression
 --> src/lib.rs:1:16
  |
1 |   async fn foo() {
  |  ________________^
2 | |     loop {
3 | |         return;
4 | |     }
5 | | }
  | |_^
  |
  = note: `#[warn(unreachable_code)]` on by default

These might be separate issues, but they appeared around the same time so I'm going to assume they're related.

added a commit that references this issue on Sep 22, 2019

Auto merge of #64669 - estebank:unreachable, r=Centril

4ff32c0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.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

      Participants

      @jonas-schievink@tmandry@tacomorphism

      Issue actions

        async functions with `unimplemented!()` are marked as unreachable · Issue #64636 · rust-lang/rust