about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/ty/inhabitedness/mod.rs2
-rw-r--r--src/test/compile-fail/empty-never-array.rs3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/librustc/ty/inhabitedness/mod.rs b/src/librustc/ty/inhabitedness/mod.rs
index 8cf5b431cf1..93e4cd9adf8 100644
--- a/src/librustc/ty/inhabitedness/mod.rs
+++ b/src/librustc/ty/inhabitedness/mod.rs
@@ -263,9 +263,9 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
             },
             TyArray(ty, len) => {
                 match len.val.to_const_int().and_then(|i| i.to_u64()) {
-                    Some(n) if n != 0 => ty.uninhabited_from(visited, tcx),
                     // If the array is definitely non-empty, it's uninhabited if
                     // the type of its elements is uninhabited.
+                    Some(n) if n != 0 => ty.uninhabited_from(visited, tcx),
                     _ => DefIdForest::empty()
                 }
             }
diff --git a/src/test/compile-fail/empty-never-array.rs b/src/test/compile-fail/empty-never-array.rs
index 1dc45a1a884..53b24e17319 100644
--- a/src/test/compile-fail/empty-never-array.rs
+++ b/src/test/compile-fail/empty-never-array.rs
@@ -17,7 +17,8 @@ enum Helper<T, U> {
 }
 
 fn transmute<T, U>(t: T) -> U {
-    let Helper::U(u) = Helper::T(t, []); //~ ERROR refutable pattern in local binding: `T(_, _)` not covered
+    let Helper::U(u) = Helper::T(t, []);
+    //~^ ERROR refutable pattern in local binding: `T(_, _)` not covered
     u
 }