Skip to content

nom is not compatible with pub(crate) and the unreachable-pub lint #807

Closed
@marmistrz

Description

@marmistrz

Prerequisites

Here are a few things you should provide to help me understand the issue:

  • Rust version : rustc -V: rustc 1.28.0-nightly (cd494c1f0 2018-06-27)
  • nom version : 4.0.0
  • nom compilation features used: default

Test case

This is the initial code. It triggers the rustc warning about unreachable-pub items.
nom-incompat.zip

The compiler suggests to restrict its visibility, by using pub(crate). After changing the line

named!(pub par, tag!("xD"));

to

named!(pub(crate) par, tag!("xD"));

The example doesn't build anymore

error: no rules expected the token `par`
 --> src/protocol/parser.rs:3:19
  |
3 | named!(pub(crate) par, tag!("xD"));
  |                   ^^^

error: aborting due to previous error

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