auto merge of #11149 : alexcrichton/rust/remove-either, r=brson
Had to change some stuff in typeck to bootstrap (getting methods in fmt off of Either), but other than that not so painful. Closes #9157
This commit is contained in:
commit
08321f1c49
18 changed files with 114 additions and 341 deletions
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
enum Either<T, U> { Left(T), Right(U) }
|
||||
|
||||
struct X(Either<(uint,uint),extern fn()>);
|
||||
|
||||
impl X {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::either::{Either, Left, Right};
|
||||
enum Either<T, U> { Left(T), Right(U) }
|
||||
|
||||
fn f(x: &mut Either<int,f64>, y: &Either<int,f64>) -> int {
|
||||
match *y {
|
||||
|
|
|
|||
|
|
@ -8,11 +8,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
enum Either<T, U> { Left(T), Right(U) }
|
||||
struct S(Either<uint, uint>);
|
||||
|
||||
fn main() {
|
||||
match S(Left(5)) {
|
||||
Right(_) => {} //~ ERROR mismatched types: expected `S` but found `std::either::Either
|
||||
Right(_) => {} //~ ERROR mismatched types: expected `S` but found `Either
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
enum Either<T, U> { Left(T), Right(U) }
|
||||
struct S(Either<uint, uint>);
|
||||
|
||||
fn main() {
|
||||
match *S(Left(5)) {
|
||||
S(_) => {} //~ ERROR mismatched types: expected `std::either::Either<uint,uint>` but found a structure pattern
|
||||
S(_) => {} //~ ERROR mismatched types: expected `Either<uint,uint>` but found a structure pattern
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@
|
|||
|
||||
use cal = bar::c::cc;
|
||||
|
||||
use std::either::Right; //~ ERROR unused import
|
||||
|
||||
use std::util::*; // shouldn't get errors for not using
|
||||
// everything imported
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#[feature(managed_boxes)];
|
||||
|
||||
enum Either<T, U> { Left(T), Right(U) }
|
||||
|
||||
pub fn main() {
|
||||
match Left(@17) {
|
||||
Right(()) => {}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@
|
|||
|
||||
use std::mem::size_of;
|
||||
|
||||
#[deriving(Eq)]
|
||||
enum Either<T, U> { Left(T), Right(U) }
|
||||
|
||||
macro_rules! check {
|
||||
($t:ty, $sz:expr, $($e:expr, $s:expr),*) => {{
|
||||
assert_eq!(size_of::<$t>(), $sz);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue