Skip to content

Commit dc4a174

Browse files
committed
---
yaml --- r: 61433 b: refs/heads/try c: 290a2eb h: refs/heads/master i: 61431: 774808c v: v3
1 parent 7274624 commit dc4a174

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
@@ -2,7 +2,7 @@
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
5-
refs/heads/try: dbbc244f7303113ad7a0be01ffb8aa617b199c4b
5+
refs/heads/try: 290a2ebab61282d89b211192679e84d22a01fd14
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/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)