]> git.lizzy.rs Git - rust.git/commit
auto merge of #6348 : sstewartgallus/rust/incoming, r=brson
authorbors <bors@rust-lang.org>
Sun, 12 May 2013 23:07:40 +0000 (16:07 -0700)
committerbors <bors@rust-lang.org>
Sun, 12 May 2013 23:07:40 +0000 (16:07 -0700)
commit8d1a09c8109eec23c7e85feff26db75eca2dcfd6
tree07e9f4602db2cd76a726b6ef0a3accb5159b7077
parent830b945a9db072b68970b6f83dfafc1aaff8f837
parent72c9aab0d2802785b8a84ea9f88906b19bc7ed29
auto merge of #6348 : sstewartgallus/rust/incoming, r=brson

In this commit I added a useful utility type, named Void, that encapsulates the
doable but annoying job of creating an uninhabited type. As well, a function on
that type, named absurd, was created which is useful for ignoring the result of
matching on that type. No unit tests were created because it is not possible to
create an instance of this type to test the usage of.

This type is useful because it is like NonCopyable in that it can be used to
create a type with special characteristics without special bloat. For instance,
instead of typing pub struct PhantomType { priv contents : () } for each void
type one may want to use one can simply type pub struct PhantomType (Void);.
This type make such special cases much easier to write.
src/libcore/util.rs