-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add -Z maximal-hir-to-mir-coverage flag #105286
Add -Z maximal-hir-to-mir-coverage flag #105286
Conversation
This comment has been minimized.
This comment has been minimized.
70dc0ef
to
3bf7d88
Compare
compiler/rustc_middle/src/lint.rs
Outdated
if self.sess.opts.unstable_opts.maximal_hir_to_mir_coverage { | ||
return id; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of this function does not hint any relationship to MIR. Could you prefer using this flag in rustc_mir_build
?
There are only 2 places where it's used, with the same pattern. Refactoring them to a single maybe_create_source_scope
that checks this option may be the better option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just refactored as requested. I named the method maybe_new_source_scope
for consistency with new_source_scope
.
@@ -579,13 +580,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { | |||
); | |||
let current_root = tcx.maybe_lint_level_root_bounded(current_hir_id, self.hir_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those 2 calls should go into maybe_new_source_scope
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes I was just fixing this when you left his comment :-)
cecb35a
to
cbe2687
Compare
…source_scope` method
cbe2687
to
d595884
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bors r+
@bors r+ |
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#104898 (Put all cached values into a central struct instead of just the stable hash) - rust-lang#105004 (Fix `emit_unused_delims_expr` ICE) - rust-lang#105174 (Suggest removing struct field from destructive binding only in shorthand scenario) - rust-lang#105250 (Replace usage of `ResumeTy` in async lowering with `Context`) - rust-lang#105286 (Add -Z maximal-hir-to-mir-coverage flag) - rust-lang#105320 (rustdoc: simplify CSS selectors on top-doc and non-exhaustive toggles) - rust-lang#105349 (Point at args in associated const fn pointers) - rust-lang#105362 (Cleanup macro-expanded code in `rustc_type_ir`) - rust-lang#105370 (Remove outdated syntax from trait alias pretty printing) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
willcrichton/flowistry@5eb8f45 Net -140 lines of code! Thanks @cjgillot!!! |
This PR adds a new unstable flag
-Z maximal-hir-to-mir-coverage
that changes the behavior ofmaybe_lint_level_root_bounded
, pursuant to a discussion on Zulip. When enabled, this function will not search upwards for a lint root, but rather immediately return the provided HIR node ID. This change increases the granularity of the mapping between MIR locations and HIR nodes inside theSourceScopeLocalData
data structures. This increase in granularity is useful for rustc consumers like Flowistry that rely on getting source-mapping information about the MIR CFG that is as precise as possible.A test
maximal_mir_to_hir_coverage.rs
has been added to verify that this flag does not break anything.r? @cjgillot
cc @gavinleroy