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

Type alias used in async fn return type is wrongly reported unused #59085

Globidev opened this Issue Mar 11, 2019 · 1 comment


None yet
3 participants
Copy link

Globidev commented Mar 11, 2019

With rustc 1.35.0-nightly (26b4cb484 2019-03-09)
The following code

type Bar = ();
async fn foo() -> Bar { }

produces the following warning

warning: type alias is never used: `Bar`                                  
 --> src/
3 | type Bar = ();
  | ^^^^^^^^^^^^^^
  = note: #[warn(dead_code)] on by default

When Bar is clearly used here.
This seem to only trigger if the alias is used in the return type position


This comment has been minimized.

Copy link

sanxiyn commented Mar 11, 2019

This is unrelated to async fn as one can reproduce with just impl Trait:

trait Trait {
    type Type;

impl Trait for () {
    type Type = ();

type Bar = ();
fn foo() -> impl Trait<Type = Bar> {}

fn main() {

@sanxiyn sanxiyn added A-impl-trait and removed A-async-await labels Mar 11, 2019

Centril added a commit to Centril/rust that referenced this issue Mar 13, 2019

@bors bors closed this in #59129 Mar 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.