]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs
Introduce constraint category for yields.
[rust.git] / src / librustc_mir / borrow_check / nll / region_infer / error_reporting / mod.rs
index 3358e5851f939d10c7da2d079c8ee0fc92839f47..940f9d6040cf522b825df6f67e682e6d4ac96afc 100644 (file)
@@ -38,6 +38,7 @@ fn description(&self) -> &'static str {
         match self {
             ConstraintCategory::Assignment => "assignment ",
             ConstraintCategory::Return => "returning this value ",
+            ConstraintCategory::Yield => "yielding this value ",
             ConstraintCategory::UseAsConst => "using this value as a constant ",
             ConstraintCategory::UseAsStatic => "using this value as a static ",
             ConstraintCategory::Cast => "cast ",
@@ -133,11 +134,10 @@ fn best_blame_constraint(
             let constraint_sup_scc = self.constraint_sccs.scc(constraint.sup);
 
             match categorized_path[i].0 {
-                ConstraintCategory::OpaqueType
-                | ConstraintCategory::Boring
-                | ConstraintCategory::BoringNoLocation
-                | ConstraintCategory::Internal => false,
-                ConstraintCategory::TypeAnnotation | ConstraintCategory::Return => true,
+                ConstraintCategory::OpaqueType | ConstraintCategory::Boring |
+                ConstraintCategory::BoringNoLocation | ConstraintCategory::Internal => false,
+                ConstraintCategory::TypeAnnotation | ConstraintCategory::Return |
+                ConstraintCategory::Yield => true,
                 _ => constraint_sup_scc != target_scc,
             }
         });