1
Fork 0

Improve warnings on incompatible options involving -Zinstrument-coverage

Adds checks for:

* `no_core` attribute
* explicitly-enabled `legacy` symbol mangling
* mir_opt_level > 1 (which enables inlining)

I removed code from the `Inline` MIR pass that forcibly disabled
inlining if `-Zinstrument-coverage` was set. The default `mir_opt_level`
does not enable inlining anyway. But if the level is explicitly set and
is greater than 1, I issue a warning.

The new warnings show up in tests, which is much better for diagnosing
potential option conflicts in these cases.
This commit is contained in:
Rich Kadel 2020-12-14 00:25:29 -08:00
parent eb963ffe45
commit 4f550f1f93
16 changed files with 103 additions and 49 deletions

View file

@ -245,7 +245,11 @@ fn compute_symbol_name(
// 2. we favor `instantiating_crate` where possible (i.e. when `Some`)
let mangling_version_crate = instantiating_crate.unwrap_or(def_id.krate);
let mangling_version = if mangling_version_crate == LOCAL_CRATE {
tcx.sess.opts.debugging_opts.symbol_mangling_version
tcx.sess
.opts
.debugging_opts
.symbol_mangling_version
.unwrap_or(SymbolManglingVersion::default())
} else {
tcx.symbol_mangling_version(mangling_version_crate)
};