Test fixes and rebase conflicts

This commit is contained in:
Alex Crichton 2015-02-27 15:13:35 -08:00
parent 158d99d3f1
commit bde4c1d6fb
3 changed files with 6 additions and 10 deletions

View file

@ -11,14 +11,12 @@
#![crate_name="static_methods_crate"]
#![crate_type = "lib"]
use std::int;
pub trait read {
fn readMaybe(s: String) -> Option<Self>;
}
impl read for int {
fn readMaybe(s: String) -> Option<int> {
impl read for isize {
fn readMaybe(s: String) -> Option<isize> {
s.parse().ok()
}
}

View file

@ -9,18 +9,18 @@
// except according to those terms.
use std::num::FromPrimitive;
use std::int;
use std::isize;
#[derive(PartialEq, FromPrimitive, Debug)]
enum A {
Foo = int::MAX,
Foo = isize::MAX,
Bar = 1,
Baz = 3,
Qux,
}
pub fn main() {
let x: Option<A> = FromPrimitive::from_int(int::MAX);
let x: Option<A> = FromPrimitive::from_int(isize::MAX);
assert_eq!(x, Some(A::Foo));
let x: Option<A> = FromPrimitive::from_int(1);

View file

@ -8,13 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::uint;
pub fn main() {
// sometimes we have had trouble finding
// the right type for f, as we unified
// bot and u32 here
let f = match "1234".parse::<uint>().ok() {
let f = match "1234".parse::<usize>().ok() {
None => return (),
Some(num) => num as u32
};