syntax: Add a hack to support the int-template pattern
This commit is contained in:
parent
de0268b693
commit
58e26243a7
5 changed files with 74 additions and 9 deletions
6
src/test/run-pass/mod-merge-hack-inst.rs
Normal file
6
src/test/run-pass/mod-merge-hack-inst.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// xfail-test not a test. used by mod-merge-hack.rs
|
||||
|
||||
mod inst {
|
||||
pub type T = i32;
|
||||
pub const bits: uint = 32;
|
||||
}
|
||||
6
src/test/run-pass/mod-merge-hack-template.rs
Normal file
6
src/test/run-pass/mod-merge-hack-template.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// xfail-test not a test. used by mod-merge-hack.rs
|
||||
|
||||
use T = inst::T;
|
||||
|
||||
pub const bits: uint = inst::bits;
|
||||
pub pure fn min(x: T, y: T) -> T { if x < y { x } else { y } }
|
||||
9
src/test/run-pass/mod-merge-hack.rs
Normal file
9
src/test/run-pass/mod-merge-hack.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// xfail-pretty
|
||||
#[path = "mod-merge-hack-template.rs"]
|
||||
#[merge = "mod-merge-hack-inst.rs"]
|
||||
mod myint32;
|
||||
|
||||
fn main() {
|
||||
assert myint32::bits == 32;
|
||||
assert myint32::min(10, 20) == 10;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue