Skip to content

Fuzzing incremental compilation against crates.io packages #33454

@nikomatsakis

Description

@nikomatsakis

To really have confidence in incremental compilation, we need to do large-scale testing. One specific way to do this is to fuzz against different versions of crates from crates.io. This corresponds to a very particular, and common, workflow:

  • cargo update to get new packages
  • cargo build to build with them

The idea here would be to write a tool which iterates over the last N published crates (that is, the last N versions that have been published to crates.io). For each version V that has been published, we would:

  • Create a fresh directory
  • Load version V-1 (that is, the previous version available on crates.io)
    • if there is no previous version, skip this crate
  • Compile version V-1 using -Z incremental=some-temporary-directory
  • Load version V in place (overwriting the old files)
  • Compile version V using -Z incremental=some-temporary-directory
  • Create another directory
  • Compile version V from scratch
  • Compare the results of the two compilations of version V:
    • they should produce the same errors/warnings
    • if successful, they should produce the same output file
      • or at least it should contain the same symbols etc
      • we'll have to work this out a bit =)

As of this writing, we're not yet at the point where incremental compilation actually works, but we are already tracking dependencies throughout the front-end; just tracking those dependencies sometimes causes ICEs, which means this tool would be of immediate use. Plus, we expect to be tracking dependencies soon.

I imagine that this tool would be written in Rust. Rather than placing it in src/test/tools, it might be better if it lived as its own crate (maybe in rust-lang?), so that it can draw on the full crates.io ecosystem for utility functions and so forth. We would eventually just run it on a regular and continous basis and open issues for any problems that we find.

Since it has relatively few prerequisites, this bug seems like a good "entry vector" for contributing to Rust. I would love to "mentor" someone to work on it.

Metadata

Metadata

Assignees

Labels

A-incr-compArea: Incremental compilationE-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions