From 8b3ce9ca68a0e44caf2d46ba4025ba3c696849b4 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 3 Jul 2018 11:37:37 -0400 Subject: [PATCH] always create a category, even it is just "boring" --- .../nll/region_infer/error_reporting/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs index 85df5ec9429..5a86f2432d8 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs @@ -140,13 +140,13 @@ impl<'tcx> RegionInferenceContext<'tcx> { &self, index: ConstraintIndex, mir: &Mir<'tcx>, - ) -> Option<(ConstraintCategory, Span)> { + ) -> (ConstraintCategory, Span) { let constraint = self.constraints[index]; let span = constraint.locations.span(mir); - let location = constraint.locations.from_location()?; + let location = constraint.locations.from_location().unwrap_or(Location::START); if !self.constraint_is_interesting(index) { - return Some((ConstraintCategory::Boring, span)); + return (ConstraintCategory::Boring, span); } let data = &mir[location.block]; @@ -178,7 +178,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { } }; - Some((category, span)) + (category, span) } /// Report an error because the universal region `fr` was required to outlive @@ -231,7 +231,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { // Classify each of the constraints along the path. let mut categorized_path: Vec<(ConstraintCategory, Span)> = path.iter() - .filter_map(|&index| self.classify_constraint(index, mir)) + .map(|&index| self.classify_constraint(index, mir)) .collect(); debug!("report_error: categorized_path={:?}", categorized_path);