Skip to content

Remove HirId from MIR #67692

Open
Open
@oli-obk

Description

The source_scopes field of mir::Body contains a lint_root HirId for figuring out the correct lint levels when reporting lints in MIR processing. Not only does this break our abstractions between HIR and MIR, this makes inlining functions from other crates super weird, because right now we just outright stop reporting any lints on the code from the other crates, no matter who wrote any kind of lint level.

We should instead figure out a system that stores all the lint level information directly in the MIR. To prevent duplication between mir bodies, we should consider some interning scheme (e.g. a query taking a DefId and returning an interned lint level information struct that may have a parent field pointing to the parent lint level datastructure).

cc @spastorino @wesleywiser @eddyb

Metadata

Assignees

Labels

A-HIRArea: The high-level intermediate representation (HIR)A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-cleanupCategory: PRs that clean code up or issues documenting cleanup.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