Report nicer errors for HRTB NLL errors from queries
This commit is contained in:
parent
0c388b0261
commit
d563a63788
29 changed files with 473 additions and 101 deletions
|
@ -1111,7 +1111,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
/// etc) this is the root universe U0. For inference variables or
|
||||
/// placeholders, however, it will return the universe which which
|
||||
/// they are associated.
|
||||
fn universe_of_region(&self, r: ty::Region<'tcx>) -> ty::UniverseIndex {
|
||||
pub fn universe_of_region(&self, r: ty::Region<'tcx>) -> ty::UniverseIndex {
|
||||
self.inner.borrow_mut().unwrap_region_constraints().universe(r)
|
||||
}
|
||||
|
||||
|
@ -1289,6 +1289,17 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
|||
op(inner.unwrap_region_constraints().data())
|
||||
}
|
||||
|
||||
pub fn region_var_origin(&self, vid: ty::RegionVid) -> RegionVariableOrigin {
|
||||
let mut inner = self.inner.borrow_mut();
|
||||
let inner = &mut *inner;
|
||||
inner
|
||||
.region_constraint_storage
|
||||
.as_mut()
|
||||
.expect("regions already resolved")
|
||||
.with_log(&mut inner.undo_log)
|
||||
.var_origin(vid)
|
||||
}
|
||||
|
||||
/// Takes ownership of the list of variable regions. This implies
|
||||
/// that all the region constraints have already been taken, and
|
||||
/// hence that `resolve_regions_and_report_errors` can never be
|
||||
|
|
|
@ -445,6 +445,11 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
|
|||
self.var_infos[vid].universe
|
||||
}
|
||||
|
||||
/// Returns the origin for the given variable.
|
||||
pub fn var_origin(&self, vid: RegionVid) -> RegionVariableOrigin {
|
||||
self.var_infos[vid].origin
|
||||
}
|
||||
|
||||
fn add_constraint(&mut self, constraint: Constraint<'tcx>, origin: SubregionOrigin<'tcx>) {
|
||||
// cannot add constraints once regions are resolved
|
||||
debug!("RegionConstraintCollector: add_constraint({:?})", constraint);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue