Skip to content

No error for private type in public async fn #64692

Open
@CryZe

Description

@CryZe

Playground

mod foo {
    struct Bar;
    
    pub async fn bar() -> Bar {
        Bar
    }
}

This compiles just fine, despite the async fn returning a private type. There is a warning, but that's about it.

warning: private type `foo::Bar` in public interface (error E0446)
 --> src/lib.rs:4:5
  |
4 | /     pub async fn bar() -> Bar {
5 | |         Bar
6 | |     }
  | |_____^
  |
  = note: `#[warn(private_in_public)]` on by default
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>

I don't think the warning was intended for async fn. This seems like it slipped through for async fn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitA-visibilityArea: Visibility / privacyAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.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

    No branches or pull requests

    Issue actions