Skip to content

OR_PATTERNS_BACK_COMPAT lint ignores crate boundaries #86567

Closed
@digama0

Description

@digama0

Code in main crate:

#![warn(or_patterns_back_compat)]
#[macro_use] extern crate bar;
fn main() { foo!(_|); }

Crate bar:

#[macro_export] macro_rules! foo { ($x:pat|) => {} }

Result:

$ cargo check
    Checking bar v0.1.0 (/bar)
    Checking test v0.1.0 (/test)
warning: the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
 --> /bar/src/lib.rs:1:37
  |
1 | #[macro_export] macro_rules! foo { ($x:pat|) => {} }
  |                                     ^^^^^^ help: use pat_param to preserve semantics: `$x:pat_param`
  |
note: the lint level is defined here
 --> src/main.rs:1:9
  |
1 | #![warn(or_patterns_back_compat)]
  |         ^^^^^^^^^^^^^^^^^^^^^^^
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition!
  = note: for more information, see issue #84869 <https://github.com/rust-lang/rust/issues/84869>

warning: 1 warning emitted

    Finished dev [unoptimized + debuginfo] target(s) in 0.19s

This lint should be suppressed, because it originates in another crate.

  • rustc --version: rustc 1.55.0-nightly (6a758ea7e 2021-06-22)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)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