Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/libcore/util.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand Down Expand Up @@ -74,6 +74,20 @@ impl Drop for NonCopyable {

pub fn NonCopyable() -> NonCopyable { NonCopyable { i: () } }


/// A type with no inhabitants
pub enum Void { }

pub impl Void {
/// A utility function for ignoring this uninhabited type
fn uninhabited(&self) -> ! {
match *self {
// Nothing to match on
}
}
}


/**
A utility function for indicating unreachable code. It will fail if
executed. This is occasionally useful to put after loops that never
Expand Down