introduce Polonius
enum for -Zpolonius
this allows to opt into using the legacy version or the in-tree prototype
This commit is contained in:
parent
2ffeb4636b
commit
4f7a27b225
6 changed files with 54 additions and 6 deletions
|
@ -41,7 +41,8 @@ pub(crate) trait AllFactsExt {
|
|||
impl AllFactsExt for AllFacts {
|
||||
/// Return
|
||||
fn enabled(tcx: TyCtxt<'_>) -> bool {
|
||||
tcx.sess.opts.unstable_opts.nll_facts || tcx.sess.opts.unstable_opts.polonius
|
||||
tcx.sess.opts.unstable_opts.nll_facts
|
||||
|| tcx.sess.opts.unstable_opts.polonius.is_legacy_enabled()
|
||||
}
|
||||
|
||||
fn write_to_dir(
|
||||
|
|
|
@ -169,10 +169,11 @@ pub(crate) fn compute_regions<'cx, 'tcx>(
|
|||
upvars: &[Upvar<'tcx>],
|
||||
consumer_options: Option<ConsumerOptions>,
|
||||
) -> NllOutput<'tcx> {
|
||||
let is_polonius_legacy_enabled = infcx.tcx.sess.opts.unstable_opts.polonius.is_legacy_enabled();
|
||||
let polonius_input = consumer_options.map(|c| c.polonius_input()).unwrap_or_default()
|
||||
|| infcx.tcx.sess.opts.unstable_opts.polonius;
|
||||
|| is_polonius_legacy_enabled;
|
||||
let polonius_output = consumer_options.map(|c| c.polonius_output()).unwrap_or_default()
|
||||
|| infcx.tcx.sess.opts.unstable_opts.polonius;
|
||||
|| is_polonius_legacy_enabled;
|
||||
let mut all_facts =
|
||||
(polonius_input || AllFacts::enabled(infcx.tcx)).then_some(AllFacts::default());
|
||||
|
||||
|
|
|
@ -683,7 +683,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||
// In Polonius mode, the errors about missing universal region relations are in the output
|
||||
// and need to be emitted or propagated. Otherwise, we need to check whether the
|
||||
// constraints were too strong, and if so, emit or propagate those errors.
|
||||
if infcx.tcx.sess.opts.unstable_opts.polonius {
|
||||
if infcx.tcx.sess.opts.unstable_opts.polonius.is_legacy_enabled() {
|
||||
self.check_polonius_subset_errors(
|
||||
outlives_requirements.as_mut(),
|
||||
&mut errors_buffer,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue