rust-lang / rust-lang/rust

Enabling `keyword_idents` lints doesn't warn about violations in other files

Open
#132,218 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lints C-bug T-compiler
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

Consider this tiny two-file crate:

// main.rs
#![deny(keyword_idents)]

mod submod;

fn main() {}
// submod.rs
fn async() {}
fn await() {}
fn try() {}
fn dyn() {}
fn gen() {}

Building this crate should fail with several violations of the keyword_idents_2018 and keyword_idents_2024 lints. But instead, building unexpectedly succeeds!

(This particular example requires Rust 2015, but the same issue can be observed in 2018/2021 regarding the gen keyword only.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the two-file Rust crate shown in main.rs and submod.rs, using Rust 2015 and the keyword_idents lints. Start by tracing how lint checking handles declarations in the submodule, then run the crate build to verify that violations in submod.rs are reported as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.