Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/infer/closure/analysis.rs')
-rw-r--r--crates/hir-ty/src/infer/closure/analysis.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/hir-ty/src/infer/closure/analysis.rs b/crates/hir-ty/src/infer/closure/analysis.rs
index eb4eb8cce3..ce7931bb3c 100644
--- a/crates/hir-ty/src/infer/closure/analysis.rs
+++ b/crates/hir-ty/src/infer/closure/analysis.rs
@@ -52,7 +52,7 @@ use span::Edition;
use tracing::{debug, instrument};
use crate::{
- FnAbi,
+ FnAbi, Span,
infer::{
CaptureInfo, CaptureSourceStack, CapturedPlace, InferenceContext, UpvarCapture,
closure::analysis::expr_use_visitor::{
@@ -920,12 +920,12 @@ impl<'a, 'db> InferenceContext<'a, 'db> {
self.result.closures_data.insert(closure_def_id, closure_data);
}
- fn normalize_capture_place(&self, place: Place) -> Place {
+ fn normalize_capture_place(&self, span: Span, place: Place) -> Place {
let mut place = self.infcx().resolve_vars_if_possible(place);
// In the new solver, types in HIR `Place`s can contain unnormalized aliases,
// which can ICE later (e.g. when projecting fields for diagnostics).
- let cause = ObligationCause::misc();
+ let cause = ObligationCause::new(span);
let at = self.table.at(&cause);
match normalize::deeply_normalize_with_skipped_universes_and_ambiguous_coroutine_goals(
at,
@@ -1011,7 +1011,7 @@ impl<'a, 'db> InferenceContext<'a, 'db> {
// Normalize eagerly when inserting into `capture_information`, so all downstream
// capture analysis can assume a normalized `Place`.
- self.normalize_capture_place(place)
+ self.normalize_capture_place(var_hir_id.into(), place)
}
/// A captured place is mutable if
@@ -1215,7 +1215,7 @@ impl<'db> euv::Delegate<'db> for InferBorrowKind {
let mut dummy_capture_info =
CaptureInfo { sources: SmallVec::new(), capture_kind: dummy_capture_kind };
- let place = ctx.normalize_capture_place(place_with_id.place.clone());
+ let place = ctx.normalize_capture_place(place_with_id.span(), place_with_id.place.clone());
let place = restrict_capture_precision(place, &mut dummy_capture_info);
@@ -1231,7 +1231,7 @@ impl<'db> euv::Delegate<'db> for InferBorrowKind {
};
assert_eq!(self.closure_def_id, upvar_closure);
- let place = ctx.normalize_capture_place(place_with_id.place.clone());
+ let place = ctx.normalize_capture_place(place_with_id.span(), place_with_id.place.clone());
self.capture_information.push((
place,
@@ -1246,7 +1246,7 @@ impl<'db> euv::Delegate<'db> for InferBorrowKind {
};
assert_eq!(self.closure_def_id, upvar_closure);
- let place = ctx.normalize_capture_place(place_with_id.place.clone());
+ let place = ctx.normalize_capture_place(place_with_id.span(), place_with_id.place.clone());
self.capture_information.push((
place,
@@ -1271,7 +1271,7 @@ impl<'db> euv::Delegate<'db> for InferBorrowKind {
let mut capture_info =
CaptureInfo { sources: place_with_id.origins.iter().cloned().collect(), capture_kind };
- let place = ctx.normalize_capture_place(place_with_id.place.clone());
+ let place = ctx.normalize_capture_place(place_with_id.span(), place_with_id.place.clone());
// We only want repr packed restriction to be applied to reading references into a packed
// struct, and not when the data is being moved. Therefore we call this method here instead