Remove Engine by nnethercote · Pull Request #132338 · rust-lang/rust (original) (raw)
This is a standard pattern:
MyAnalysis.into_engine(tcx, body).iterate_to_fixpoint()into_engine and iterate_to_fixpoint are always called in pairs, but
sometimes with a builder-style pass_name call between them. But a
builder-style interface is overkill here. This has been bugging me a for
a while.
This commit:
- Merges
Engine::newandEngine::iterate_to_fixpoint. This removes the need forEngineto have fields, leaving it as a trivial type that the next commit will remove. - Renames
Analysis::into_engineasAnalysis::iterate_to_fixpoint, gives it an extra argument for the optional pass name, and makes it callEngine::iterate_to_fixpointinstead ofEngine::new.
This turns the pattern from above into this:
MyAnalysis.iterate_to_fixpoint(tcx, body, None)which is shorter at every call site, and there's less plumbing required to support it.