use crate::check::dropck;
use crate::check::FnCtxt;
use crate::mem_categorization as mc;
-use crate::middle::region;
use crate::outlives::outlives_bounds::InferCtxtExt as _;
use rustc_data_structures::stable_set::FxHashSet;
use rustc_hir as hir;
use rustc_hir::intravisit::{self, Visitor};
use rustc_hir::PatKind;
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
-use rustc_infer::infer::{self, InferCtxt, RegionObligation, RegionckMode};
+use rustc_infer::infer::{self, InferCtxt, RegionObligation};
use rustc_middle::hir::place::{PlaceBase, PlaceWithHirId};
use rustc_middle::ty::adjustment;
use rustc_middle::ty::{self, Ty};
/// add those assumptions into the outlives-environment.
///
/// Tests: `src/test/ui/regions/regions-free-region-ordering-*.rs`
+ #[instrument(level = "debug", skip(self, infcx))]
fn add_implied_bounds<'a>(
&mut self,
infcx: &InferCtxt<'a, 'tcx>,
body_id: hir::HirId,
span: Span,
) {
- debug!("add_implied_bounds()");
-
for ty in fn_sig_tys {
let ty = infcx.resolve_vars_if_possible(ty);
- debug!("add_implied_bounds: ty = {}", ty);
let implied_bounds = infcx.implied_outlives_bounds(self.param_env, body_id, ty, span);
self.add_outlives_bounds(Some(infcx), implied_bounds)
}
rcx.visit_body(body);
rcx.visit_region_obligations(id);
}
- rcx.resolve_regions_and_report_errors(RegionckMode::for_item_body(self.tcx));
+ // Checked by NLL
+ rcx.fcx.skip_region_resolution();
}
/// Region checking during the WF phase for items. `wf_tys` are the
rcx.outlives_environment.add_implied_bounds(self, wf_tys, item_id, span);
rcx.outlives_environment.save_implied_bounds(item_id);
rcx.visit_region_obligations(item_id);
- rcx.resolve_regions_and_report_errors(RegionckMode::default());
+ rcx.resolve_regions_and_report_errors();
}
/// Region check a function body. Not invoked on closures, but
rcx.visit_fn_body(fn_id, body, self.tcx.hir().span(fn_id));
}
- rcx.resolve_regions_and_report_errors(RegionckMode::for_item_body(self.tcx));
+ // Checked by NLL
+ rcx.fcx.skip_region_resolution();
}
}
pub struct RegionCtxt<'a, 'tcx> {
pub fcx: &'a FnCtxt<'a, 'tcx>,
- pub region_scope_tree: &'tcx region::ScopeTree,
-
outlives_environment: OutlivesEnvironment<'tcx>,
// id of innermost fn body id
Subject(subject): Subject,
param_env: ty::ParamEnv<'tcx>,
) -> RegionCtxt<'a, 'tcx> {
- let region_scope_tree = fcx.tcx.region_scope_tree(subject);
let outlives_environment = OutlivesEnvironment::new(param_env);
RegionCtxt {
fcx,
- region_scope_tree,
body_id: initial_body_id,
body_owner: subject,
subject_def_id: subject,
self.select_all_obligations_or_error();
}
- fn resolve_regions_and_report_errors(&self, mode: RegionckMode) {
+ fn resolve_regions_and_report_errors(&self) {
self.infcx.process_registered_region_obligations(
self.outlives_environment.region_bound_pairs_map(),
Some(self.tcx.lifetimes.re_root_empty),
self.fcx.resolve_regions_and_report_errors(
self.subject_def_id.to_def_id(),
&self.outlives_environment,
- mode,
);
}