-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// xfail-test | ||
fn main() { | ||
|
||
// the smallest positive values that need these types | ||
let a8: i8 = 8; | ||
let a16: i16 = 128; | ||
let a32: i32 = 32_768; | ||
let a64: i64 = 2_147_483_648; | ||
|
||
// the smallest negative values that need these types | ||
let c8: i8 = -9; | ||
let c16: i16 = -129; | ||
let c32: i32 = -32_769; | ||
let c64: i64 = -2_147_483_649; | ||
|
||
fn id_i8(n: i8) -> i8 { n } | ||
fn id_i16(n: i16) -> i16 { n } | ||
fn id_i32(n: i32) -> i32 { n } | ||
fn id_i64(n: i64) -> i64 { n } | ||
|
||
// the smallest values that need these types | ||
let b8: u8 = 16; | ||
let b16: u16 = 256; | ||
let b32: u32 = 65_536; | ||
let b64: u64 = 4_294_967_296; | ||
|
||
fn id_u8(n: u8) -> u8 { n } | ||
fn id_u16(n: u16) -> u16 { n } | ||
fn id_u32(n: u32) -> u32 { n } | ||
fn id_u64(n: u64) -> u64 { n } | ||
|
||
id_i8(a8); // ok | ||
id_i8(a16); //! ERROR mismatched types: expected `i8` but found `i16` | ||
id_i8(a32); //! ERROR mismatched types: expected `i8` but found `i32` | ||
id_i8(a64); //! ERROR mismatched types: expected `i8` but found `i64` | ||
id_i16(a8); //! ERROR mismatched types: expected `i16` but found `i8` | ||
id_i16(a16); // ok | ||
id_i16(a32); //! ERROR mismatched types: expected `i16` but found `i32` | ||
id_i16(a64); //! ERROR mismatched types: expected `i16` but found `i64` | ||
id_i32(a8); //! ERROR mismatched types: expected `i32` but found `i8` | ||
id_i32(a16); //! ERROR mismatched types: expected `i32` but found `i16` | ||
id_i32(a32); // ok | ||
id_i32(a64); //! ERROR mismatched types: expected `i32` but found `i64` | ||
id_i64(a8); //! ERROR mismatched types: expected `i64` but found `i8` | ||
id_i64(a16); //! ERROR mismatched types: expected `i64` but found `i16` | ||
id_i64(a32); //! ERROR mismatched types: expected `i64` but found `i32` | ||
id_i64(a64); // ok | ||
|
||
id_i8(c8); // ok | ||
id_i8(c16); //! ERROR mismatched types: expected `i8` but found `i16` | ||
id_i8(c32); //! ERROR mismatched types: expected `i8` but found `i32` | ||
id_i8(c64); //! ERROR mismatched types: expected `i8` but found `i64` | ||
id_i16(c8); //! ERROR mismatched types: expected `i16` but found `i8` | ||
id_i16(c16); // ok | ||
id_i16(c32); //! ERROR mismatched types: expected `i16` but found `i32` | ||
id_i16(c64); //! ERROR mismatched types: expected `i16` but found `i64` | ||
id_i32(c8); //! ERROR mismatched types: expected `i32` but found `i8` | ||
id_i32(c16); //! ERROR mismatched types: expected `i32` but found `i16` | ||
id_i32(c32); // ok | ||
id_i32(c64); //! ERROR mismatched types: expected `i32` but found `i64` | ||
id_i64(a8); //! ERROR mismatched types: expected `i64` but found `i8` | ||
id_i64(a16); //! ERROR mismatched types: expected `i64` but found `i16` | ||
id_i64(a32); //! ERROR mismatched types: expected `i64` but found `i32` | ||
id_i64(a64); // ok | ||
|
||
id_u8(b8); // ok | ||
id_u8(b16); //! ERROR mismatched types: expected `u8` but found `u16` | ||
id_u8(b32); //! ERROR mismatched types: expected `u8` but found `u32` | ||
id_u8(b64); //! ERROR mismatched types: expected `u8` but found `u64` | ||
id_u16(b8); //! ERROR mismatched types: expected `u16` but found `u8` | ||
id_u16(b16); // ok | ||
id_u16(b32); //! ERROR mismatched types: expected `u16` but found `u32` | ||
id_u16(b64); //! ERROR mismatched types: expected `u16` but found `u64` | ||
id_u32(b8); //! ERROR mismatched types: expected `u32` but found `u8` | ||
id_u32(b16); //! ERROR mismatched types: expected `u32` but found `u16` | ||
id_u32(b32); // ok | ||
id_u32(b64); //! ERROR mismatched types: expected `u32` but found `u64` | ||
id_u64(b8); //! ERROR mismatched types: expected `u64` but found `u8` | ||
id_u64(b16); //! ERROR mismatched types: expected `u64` but found `u16` | ||
id_u64(b32); //! ERROR mismatched types: expected `u64` but found `u32` | ||
id_u64(b64); // ok | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// xfail-test | ||
fn main() { | ||
|
||
// The commented-out lines are ones that fail currently. I'm | ||
// working on figuring out why (#1425). -- lkuper | ||
|
||
fn id_i8(n: i8) -> i8 { n } | ||
fn id_i16(n: i16) -> i16 { n } | ||
fn id_i32(n: i32) -> i32 { n } | ||
fn id_i64(n: i64) -> i64 { n } | ||
|
||
fn id_uint(n: uint) -> uint { n } | ||
fn id_u8(n: u8) -> u8 { n } | ||
fn id_u16(n: u16) -> u16 { n } | ||
fn id_u32(n: u32) -> u32 { n } | ||
fn id_u64(n: u64) -> u64 { n } | ||
|
||
let _i: i8 = -128; | ||
let j = -128; | ||
// id_i8(j); | ||
id_i8(-128); | ||
|
||
let _i: i16 = -32_768; | ||
let j = -32_768; | ||
// id_i16(j); | ||
id_i16(-32_768); | ||
|
||
let _i: i32 = -2_147_483_648; | ||
let j = -2_147_483_648; | ||
// id_i32(j); | ||
id_i32(-2_147_483_648); | ||
|
||
let _i: i64 = -9_223_372_036_854_775_808; | ||
let j = -9_223_372_036_854_775_808; | ||
// id_i64(j); | ||
id_i64(-9_223_372_036_854_775_808); | ||
|
||
let _i: uint = 1; | ||
let j = 1; | ||
id_uint(j); | ||
id_uint(1); | ||
|
||
let _i: u8 = 255; | ||
let j = 255; | ||
id_u8(j); | ||
id_u8(255); | ||
|
||
let _i: u16 = 65_535; | ||
let j = 65_535; | ||
id_u16(j); | ||
id_u16(65_535); | ||
|
||
let _i: u32 = 4_294_967_295; | ||
let j = 4_294_967_295; | ||
id_u32(j); | ||
id_u32(4_294_967_295); | ||
|
||
let _i: u64 = 18_446_744_073_709_551_615; | ||
let j = 18_446_744_073_709_551_615; | ||
id_u64(j); | ||
id_u64(18_446_744_073_709_551_615); | ||
} |