rust-lang / rust-lang/rust-clippy

New lint: reproducible build hazards

Open
#15,263 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lint
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

What it does

This lint would lint against non deterministic operations in proc-macros, such as iterating over a HashMap.

Advantage
  • Helps making sure that macro output is always the same, making reproducible builds easier to achieve.
  • Deterministic output can also likely avoid non-deterministic bugs that would depend on the build, should there be an issue in the proc-macro.
Drawbacks

This lint my warn against valid uses of hashmaps in places where it does not affect the determinism of the macro output

Example

One example is the following: https://github.com/kellpossible/cargo-i18n/pull/151

Non determinism can be removed by replacing HashMap and HashSet with BTreeMaps and BTreeSets, or by using a Vec

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

Start by reading the proposed behavior and the cargo-i18n pull request example linked in the issue. Determine which nondeterministic proc-macro operations should be diagnosed and how valid HashMap or HashSet uses can avoid warnings. Done means the lint reliably identifies relevant iteration while accounting for the stated false-positive concern.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.