Skip to content

Subpar error message on pub (ident) fn foo #40599

Closed
@pnkfelix

Description

@pnkfelix

Someone who had code with the old pub_restricted feature is going to get pretty bad error message feedback:

#![feature(pub_restricted)]
mod a { pub (a) fn foo() -> i32 { 13 } }

fn main() {}

Here's the message you get (ever since pub(in path) was implemented, sometime after March 4th:

error: unmatched visibility `pub`
 --> pub_restricted.rs:2:9
  |
2 | mod a { pub (a) fn foo() -> i32 { 13 } }
  |         ^^^

(At the very least, it would be good if it highlighted pub (a) in its entirety, not just pub...)

Also, someone who doesn't know about pub restricted and just has a syntactic typo is also going to have problems here, since it is very confusing that the compiler seems to be saying that it doesn't know about the pub visibility, when that is one of the most fundamental visibilities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions