Skip to content

Recover from 'public' in 'pub' position #99653

Closed
@lopopolo

Description

@lopopolo

Given the following code:

public enum Range {
    Valid {
        begin: u32,
        len: u32,
    }
    Out,
}

public struct X(u32);

public fn foo() -> ! { loop {} }

public extern "C" fn foobar() -> i32 { 7 }

public trait Again {}

The current output is:

   Compiling playground v0.0.1 (/playground)
error: expected one of `!` or `::`, found keyword `enum`
 --> src/lib.rs:1:8
  |
1 | public enum Range {
  |        ^^^^ expected one of `!` or `::`

error: could not compile `playground` due to previous error

Ideally the output should look like:

Suggest replacing public with pub.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-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