Skip to content

Commit b6f470a

Browse files
committed
---
yaml --- r: 60433 b: refs/heads/auto c: 290a2eb h: refs/heads/master i: 60431: 685ef65 v: v3
1 parent 7412403 commit b6f470a

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
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: dbbc244f7303113ad7a0be01ffb8aa617b199c4b
17+
refs/heads/auto: 290a2ebab61282d89b211192679e84d22a01fd14
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

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