Skip to content

Commit 1d38e4f

Browse files
committed
---
yaml --- r: 59768 b: refs/heads/snap-stage3 c: 290a2eb h: refs/heads/master v: v3
1 parent 8179590 commit 1d38e4f

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: dbbc244f7303113ad7a0be01ffb8aa617b199c4b
4+
refs/heads/snap-stage3: 290a2ebab61282d89b211192679e84d22a01fd14
55
refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libcore/util.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ pub enum Void { }
138138

139139
pub impl Void {
140140
/// A utility function for ignoring this uninhabited type
141-
fn uninhabited(&self) -> ! {
142-
match *self {
141+
fn uninhabited(self) -> ! {
142+
match self {
143143
// Nothing to match on
144144
}
145145
}
@@ -177,7 +177,8 @@ pub fn unreachable() -> ! {
177177
#[cfg(test)]
178178
mod tests {
179179
use option::{None, Some};
180-
use util::{NonCopyable, id, replace, swap};
180+
use util::{Void, NonCopyable, id, replace, swap};
181+
use either::{Either, Left, Right};
181182

182183
#[test]
183184
pub fn identity_crisis() {
@@ -202,4 +203,12 @@ mod tests {
202203
assert!(x.is_none());
203204
assert!(y.is_some());
204205
}
206+
#[test]
207+
pub fn test_uninhabited() {
208+
let could_only_be_coin : Either <Void, ()> = Right (());
209+
match could_only_be_coin {
210+
Right (coin) => coin,
211+
Left (is_void) => is_void.uninhabited ()
212+
}
213+
}
205214
}

0 commit comments

Comments
 (0)