Skip to content

Commit c07fcd8

Browse files
committed
Remove additions to conservative_is_uninhabited
1 parent e7dc075 commit c07fcd8

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

src/librustc/ty/sty.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,19 +1485,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
14851485
// Uncontentious uninhabitableness check
14861486
match self.sty {
14871487
ty::TyNever => true,
1488-
// We could extend this to ADTs in which every variant is uninhabited
1489-
// (for enums, unions, etc.).
14901488
ty::TyAdt(def, _) => def.variants.is_empty(),
1491-
ty::TyTuple(tys) => tys.iter().any(|ty| ty.conservative_is_uninhabited()),
1492-
ty::TyArray(ty, len) => {
1493-
match len.val.to_raw_bits() {
1494-
// If the array is definitely non-empty, it's uninhabited if
1495-
// the type of its elements is uninhabited.
1496-
Some(n) if n != 0 => ty.conservative_is_uninhabited(),
1497-
_ => false
1498-
}
1499-
}
1500-
// `ty::TyRef` is a grey area at the moment.
15011489
_ => false
15021490
}
15031491
}

src/librustc_typeck/check/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,12 +434,14 @@ pub enum PlaceOp {
434434
/// wake). Tracked semi-automatically (through type variables marked
435435
/// as diverging), with some manual adjustments for control-flow
436436
/// primitives (approximating a CFG).
437+
///
437438
/// We know a node diverges in the following (conservative) situations:
438439
/// - A function with a parameter whose type is uninhabited necessarily diverges.
439440
/// - A match expression with no arms necessarily diverges.
440441
/// - A match expression whose arms patterns all diverge necessarily diverges.
441442
/// - A match expression whose arms all diverge necessarily diverges.
442443
/// - An expression whose type is uninhabited necessarily diverges.
444+
///
443445
/// In the above, the node will be marked as diverging `Always` or `WarnedAlways`.
444446
/// In any other situation, it will be marked as `Maybe`.
445447
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]

0 commit comments

Comments
 (0)