Skip to content

Using await on an internal future makes private type trigger missing_debug_implementations lint #54239

Closed

Description

#![feature(async_await, await_macro, futures_api)]
#![deny(missing_debug_implementations)]

struct DontLookAtMe(i32);

async fn secret() -> DontLookAtMe {
    DontLookAtMe(41)
}

// Comment this function out to fix the lint...
pub async fn looking() -> i32 {
    await!(secret()).0
}

fn main() {
}

Playground: https://play.rust-lang.org/?gist=0baad2fb680123d124806d6269c15c43&version=nightly&mode=debug&edition=2018

The DontLookAtMe struct isn't public, so it normally shouldn't trigger the missing_debug_implementations lint. But once await! is used on a future that happens to be holding the field somewhere inside, it trips the lint:

error: type does not implement `fmt::Debug`; consider adding #[derive(Debug)] or a manual implementation
 --> src/main.rs:4:1
  |
4 | struct DontLookAtMe(i32);
  | ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: lint level defined here
 --> src/main.rs:2:9
  |
2 | #![deny(missing_debug_implementations)]
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitA-coroutinesArea: CoroutinesA-lintArea: Lints (warnings about flaws in source code) such as unused_mut.AsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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