]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/borrow_check/nll/type_check/mod.rs
Check for uninhabitedness instead of never
[rust.git] / src / librustc_mir / borrow_check / nll / type_check / mod.rs
index 6f4d8c2bef934a45e659fd7d4e639513a21fa082..39019b35beb184517e8bacddcfa6990746587853 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 //! This pass type-checks the MIR to ensure it is not broken.
+
 #![allow(unreachable_code)]
 
 use borrow_check::borrow_set::BorrowSet;
@@ -1314,7 +1315,6 @@ fn check_stmt(&mut self, mir: &Mir<'tcx>, stmt: &Statement<'tcx>, location: Loca
             | StatementKind::StorageLive(..)
             | StatementKind::StorageDead(..)
             | StatementKind::InlineAsm { .. }
-            | StatementKind::EndRegion(_)
             | StatementKind::Retag { .. }
             | StatementKind::EscapeToRaw { .. }
             | StatementKind::Nop => {}
@@ -1468,7 +1468,7 @@ fn check_terminator(
                             value_ty,
                             ty,
                             term_location.to_locations(),
-                            ConstraintCategory::Return,
+                            ConstraintCategory::Yield,
                         ) {
                             span_mirbug!(
                                 self,
@@ -1546,8 +1546,7 @@ fn check_call_dest(
                 }
             }
             None => {
-                // FIXME(canndrew): This is_never should probably be an is_uninhabited
-                if !sig.output().is_never() {
+                if !sig.output().conservative_is_uninhabited() {
                     span_mirbug!(self, term, "call to converging function {:?} w/o dest", sig);
                 }
             }