Auto merge of #132843 - RalfJung:mono-time-checks, r=lcnr
move all mono-time checks into their own folder, and their own query The mono item collector currently also drives two mono-time checks: the lint for "large moves", and the check whether function calls are done with all the required target features. Instead of doing this "inside" the collector, this PR refactors things so that we have a new `rustc_monomorphize::mono_checks` module providing a per-instance query that does these checks. We already have a per-instance query for the ABI checks, so this should be "free" for incremental builds. Non-incremental builds might do a bit more work now since we now have two separate MIR visits (in the collector and the mono-time checks) -- but one of them is cached in case the MIR doesn't change, which is nice. This slightly changes behavior of the large-move check since the "move_size_spans" deduplication logic now only works per-instance, not globally across the entire collector. Cc `@saethlin` since you're also doing some work related to queries and caching and monomorphization, though I don't know if there's any interaction here.
This commit is contained in:
commit
583b25d8d1
6 changed files with 135 additions and 106 deletions
|
@ -2326,13 +2326,19 @@ rustc_queries! {
|
|||
separate_provide_extern
|
||||
}
|
||||
|
||||
/// Check the signature of this function as well as all the call expressions inside of it
|
||||
/// to ensure that any target features required by the ABI are enabled.
|
||||
/// Should be called on a fully monomorphized instance.
|
||||
query check_feature_dependent_abi(key: ty::Instance<'tcx>) {
|
||||
desc { "check for feature-dependent ABI" }
|
||||
/// Perform monomorphization-time checking on this item.
|
||||
/// This is used for lints/errors that can only be checked once the instance is fully
|
||||
/// monomorphized.
|
||||
query check_mono_item(key: ty::Instance<'tcx>) {
|
||||
desc { "monomorphization-time checking" }
|
||||
cache_on_disk_if { true }
|
||||
}
|
||||
|
||||
/// Builds the set of functions that should be skipped for the move-size check.
|
||||
query skip_move_check_fns(_: ()) -> &'tcx FxIndexSet<DefId> {
|
||||
arena_cache
|
||||
desc { "functions to skip for move-size check" }
|
||||
}
|
||||
}
|
||||
|
||||
rustc_query_append! { define_callbacks! }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue