Skip to content

Commit 8b3ce9c

Browse files
committed
always create a category, even it is just "boring"
1 parent aae177e commit 8b3ce9c

File tree

1 file changed

+5
-5
lines changed
  • src/librustc_mir/borrow_check/nll/region_infer/error_reporting

1 file changed

+5
-5
lines changed

src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
140140
&self,
141141
index: ConstraintIndex,
142142
mir: &Mir<'tcx>,
143-
) -> Option<(ConstraintCategory, Span)> {
143+
) -> (ConstraintCategory, Span) {
144144
let constraint = self.constraints[index];
145145
let span = constraint.locations.span(mir);
146-
let location = constraint.locations.from_location()?;
146+
let location = constraint.locations.from_location().unwrap_or(Location::START);
147147

148148
if !self.constraint_is_interesting(index) {
149-
return Some((ConstraintCategory::Boring, span));
149+
return (ConstraintCategory::Boring, span);
150150
}
151151

152152
let data = &mir[location.block];
@@ -178,7 +178,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
178178
}
179179
};
180180

181-
Some((category, span))
181+
(category, span)
182182
}
183183

184184
/// Report an error because the universal region `fr` was required to outlive
@@ -231,7 +231,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
231231

232232
// Classify each of the constraints along the path.
233233
let mut categorized_path: Vec<(ConstraintCategory, Span)> = path.iter()
234-
.filter_map(|&index| self.classify_constraint(index, mir))
234+
.map(|&index| self.classify_constraint(index, mir))
235235
.collect();
236236
debug!("report_error: categorized_path={:?}", categorized_path);
237237

0 commit comments

Comments
 (0)