Merge remote-tracking branch 'brson/companion' into incoming
Conflicts: src/compiletest/compiletest.rs src/libcargo/cargo.rs src/libcore/core.rs src/librustc/rustc.rs src/librustdoc/rustdoc.rc
This commit is contained in:
commit
fc06114ddf
150 changed files with 4316 additions and 8444 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// error-pattern: expected `mod`
|
||||
// error-pattern: expected item
|
||||
|
||||
#[attr = "val"];
|
||||
#[attr = "val"] // Unterminated
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
use g = x::f;
|
||||
export g;
|
||||
|
|
@ -1 +0,0 @@
|
|||
fn f() -> ~str { ~"ralph" }
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
use g = x::f;
|
||||
export g;
|
||||
|
|
@ -1 +0,0 @@
|
|||
fn f() -> ~str { ~"nelson" }
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
// xfail-win32 don't understand what's wrong
|
||||
// Test that crates and directory modules can contain code
|
||||
#[legacy_exports];
|
||||
|
||||
#[path = "companionmod-src"]
|
||||
mod a {
|
||||
#[legacy_exports];
|
||||
mod b {
|
||||
#[legacy_exports];
|
||||
#[legacy_exports]
|
||||
mod x;
|
||||
}
|
||||
#[path = "d"]
|
||||
mod c {
|
||||
#[legacy_exports];
|
||||
#[legacy_exports]
|
||||
mod x;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
// This isn't really xfailed; it's used by the companionmod.rc test
|
||||
// xfail-test
|
||||
|
||||
#[legacy_exports];
|
||||
fn main() {
|
||||
assert a::b::g() == ~"ralph";
|
||||
assert a::c::g() == ~"nelson";
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
// These are attributes of the foo module
|
||||
#[legacy_exports];
|
||||
#[attr1 = "val"];
|
||||
#[attr2 = "val"];
|
||||
|
||||
// Attributes of the following function
|
||||
#[attr1 = "val"]
|
||||
#[attr2 = "val"]
|
||||
fn main() { }
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
#[name = "crate-attributes"];
|
||||
#[vers = "1.0"];
|
||||
|
||||
#[attr1]
|
||||
#[path = "crate-attributes-src"]
|
||||
mod m {
|
||||
#[legacy_exports];
|
||||
#[attr_inner];
|
||||
|
||||
#[attr2]
|
||||
#[legacy_exports]
|
||||
mod foo;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
type T = f32;
|
||||
|
|
@ -1 +0,0 @@
|
|||
type T = f64;
|
||||
|
|
@ -1 +0,0 @@
|
|||
type T = float;
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
fn plus(x: T, y: T) -> T {
|
||||
x + y
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
#[path = "module-polymorphism-files"]
|
||||
mod my_float {
|
||||
#[legacy_exports];
|
||||
|
||||
// The type of the float
|
||||
use inst::T;
|
||||
|
||||
// Define T as float
|
||||
#[path = "inst_float.rs"]
|
||||
#[legacy_exports]
|
||||
mod inst;
|
||||
|
||||
// Add in the implementation from a single source file
|
||||
#[path = "template.rs"]
|
||||
#[legacy_exports]
|
||||
mod template;
|
||||
|
||||
}
|
||||
|
||||
#[path = "module-polymorphism-files"]
|
||||
mod my_f64 {
|
||||
#[legacy_exports];
|
||||
|
||||
use inst::T;
|
||||
|
||||
// Define T as f64
|
||||
#[path = "inst_f64.rs"]
|
||||
#[legacy_exports]
|
||||
mod inst;
|
||||
|
||||
// Use the implementation for the same source file!
|
||||
#[path = "template.rs"]
|
||||
#[legacy_exports]
|
||||
mod template;
|
||||
|
||||
}
|
||||
|
||||
#[path = "module-polymorphism-files"]
|
||||
mod my_f32 {
|
||||
#[legacy_exports];
|
||||
use inst::T;
|
||||
|
||||
#[path = "inst_f32.rs"]
|
||||
#[legacy_exports]
|
||||
mod inst;
|
||||
|
||||
#[path = "template.rs"]
|
||||
#[legacy_exports]
|
||||
mod template;
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
// This isn't really xfailed; it's used by the
|
||||
// module-polymorphism.rc test
|
||||
// xfail-test
|
||||
|
||||
fn main() {
|
||||
// All of these functions are defined by a single module
|
||||
// source file but instantiated for different types
|
||||
assert my_float::template::plus(1.0f, 2.0f) == 3.0f;
|
||||
assert my_f64::template::plus(1.0f64, 2.0f64) == 3.0f64;
|
||||
assert my_f32::template::plus(1.0f32, 2.0f32) == 3.0f32;
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
type T = f32;
|
||||
|
|
@ -1 +0,0 @@
|
|||
type T = f64;
|
||||
|
|
@ -1 +0,0 @@
|
|||
type T = float;
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
fn plus(x: T, y: T) -> T {
|
||||
x + y
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
#[path = "module-polymorphism2-files"]
|
||||
mod mystd {
|
||||
#[legacy_exports];
|
||||
|
||||
#[path = "float-template"]
|
||||
mod float {
|
||||
#[legacy_exports];
|
||||
// The type of the float
|
||||
use inst::T;
|
||||
|
||||
// Unfortunate
|
||||
use template::*;
|
||||
export plus;
|
||||
|
||||
// Define T as float
|
||||
#[path = "inst_float.rs"]
|
||||
#[legacy_exports]
|
||||
mod inst;
|
||||
|
||||
// Add in the implementation from a single source file
|
||||
#[path = "template.rs"]
|
||||
#[legacy_exports]
|
||||
mod template;
|
||||
}
|
||||
|
||||
|
||||
#[path = "float-template"]
|
||||
mod f64 {
|
||||
#[legacy_exports];
|
||||
|
||||
use inst::T;
|
||||
|
||||
// Unfortunate
|
||||
use template::*;
|
||||
export plus;
|
||||
|
||||
// Define T as f64
|
||||
#[path = "inst_f64.rs"]
|
||||
#[legacy_exports]
|
||||
mod inst;
|
||||
|
||||
// Use the implementation for the same source file!
|
||||
#[path = "template.rs"]
|
||||
#[legacy_exports]
|
||||
mod template;
|
||||
|
||||
}
|
||||
|
||||
#[path = "float-template"]
|
||||
mod f32 {
|
||||
#[legacy_exports];
|
||||
use inst::T;
|
||||
|
||||
// Unfortunate
|
||||
use template::*;
|
||||
export plus;
|
||||
|
||||
#[path = "inst_f32.rs"]
|
||||
#[legacy_exports]
|
||||
mod inst;
|
||||
|
||||
#[path = "template.rs"]
|
||||
#[legacy_exports]
|
||||
mod template;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
// This isn't really xfailed; it's used by the
|
||||
// module-polymorphism.rc test
|
||||
// xfail-test
|
||||
|
||||
fn main() {
|
||||
// All of these functions are defined by a single module
|
||||
// source file but instantiated for different types
|
||||
assert mystd::float::plus(1.0f, 2.0f) == 3.0f;
|
||||
assert mystd::f64::plus(1.0f64, 2.0f64) == 3.0f64;
|
||||
assert mystd::f32::plus(1.0f32, 2.0f32) == 3.0f32;
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
fn plus(x: T, y: T) -> T {
|
||||
x + y
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
type T = f32;
|
||||
|
|
@ -1 +0,0 @@
|
|||
type T = f64;
|
||||
|
|
@ -1 +0,0 @@
|
|||
type T = float;
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
// Use one template module to specify in a single file the implementation
|
||||
// of functions for multiple types
|
||||
|
||||
#[path = "module-polymorphism3-files"]
|
||||
mod mystd {
|
||||
#[legacy_exports];
|
||||
|
||||
// The template is specified in float-template.rs
|
||||
#[path = "float-template"]
|
||||
mod float {
|
||||
#[legacy_exports];
|
||||
// The type of the float
|
||||
use inst::T;
|
||||
|
||||
// Define T as appropriate for platform
|
||||
#[path = "inst_float.rs"]
|
||||
mod inst;
|
||||
}
|
||||
|
||||
// Use the same template
|
||||
#[path = "float-template"]
|
||||
mod f64 {
|
||||
#[legacy_exports];
|
||||
|
||||
use inst::T;
|
||||
|
||||
// Define T as f64
|
||||
#[path = "inst_f64.rs"]
|
||||
mod inst;
|
||||
}
|
||||
|
||||
#[path = "float-template"]
|
||||
mod f32 {
|
||||
#[legacy_exports];
|
||||
use inst::T;
|
||||
|
||||
#[path = "inst_f32.rs"]
|
||||
mod inst;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
// This isn't really xfailed; it's used by the
|
||||
// module-polymorphism.rc test
|
||||
// xfail-test
|
||||
|
||||
fn main() {
|
||||
// All of these functions are defined by a single module
|
||||
// source file but instantiated for different types
|
||||
assert mystd::float::plus(1.0f, 2.0f) == 3.0f;
|
||||
assert mystd::f64::plus(1.0f64, 2.0f64) == 3.0f64;
|
||||
assert mystd::f32::plus(1.0f32, 2.0f32) == 3.0f32;
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
type T = cat;
|
||||
|
||||
enum cat {
|
||||
howlycat,
|
||||
meowlycat
|
||||
}
|
||||
|
||||
fn animal() -> ~str { ~"cat" }
|
||||
fn talk(c: cat) -> ~str {
|
||||
match c {
|
||||
howlycat => { ~"howl" }
|
||||
meowlycat => { ~"meow" }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
type T = dog;
|
||||
|
||||
enum dog {
|
||||
dog
|
||||
}
|
||||
|
||||
fn animal() -> ~str { ~"dog" }
|
||||
fn talk(_d: dog) -> ~str { ~"woof" }
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
trait says {
|
||||
fn says() -> ~str;
|
||||
}
|
||||
|
||||
impl T: says {
|
||||
|
||||
// 'animal' and 'talk' functions are implemented by the module
|
||||
// instantiating the talky trait. They are 'abstract'
|
||||
fn says() -> ~str {
|
||||
animal() + ~" says '" + talk(self) + ~"'"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
|
||||
#[path = "module-polymorphism4-files"]
|
||||
mod cat {
|
||||
#[legacy_exports];
|
||||
|
||||
use inst::*;
|
||||
|
||||
#[path = "cat.rs"]
|
||||
#[legacy_exports]
|
||||
mod inst;
|
||||
|
||||
#[path = "trait_.rs"]
|
||||
#[legacy_exports]
|
||||
mod trait_;
|
||||
|
||||
}
|
||||
|
||||
#[path = "module-polymorphism4-files"]
|
||||
mod dog {
|
||||
#[legacy_exports];
|
||||
|
||||
use inst::*;
|
||||
|
||||
#[path = "dog.rs"]
|
||||
#[legacy_exports]
|
||||
mod inst;
|
||||
|
||||
#[path = "trait_.rs"]
|
||||
#[legacy_exports]
|
||||
mod trait_;
|
||||
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
// This isn't really xfailed; it's used by the
|
||||
// module-polymorphism.rc test
|
||||
// xfail-test
|
||||
|
||||
fn main() {
|
||||
let cat1 = cat::inst::meowlycat;
|
||||
let cat2 = cat::inst::howlycat;
|
||||
let dog = dog::inst::dog;
|
||||
assert cat1.says() == ~"cat says 'meow'";
|
||||
assert cat2.says() == ~"cat says 'howl'";
|
||||
assert dog.says() == ~"dog says 'woof'";
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
|
||||
|
||||
fn other() { debug!("yes"); }
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
|
||||
|
||||
fn main() { debug!("hello, multi-file world."); bar::other(); }
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#[path = "multi-src"]
|
||||
mod multi {
|
||||
#[legacy_exports];
|
||||
// implicitly #[path = "foo.rs"]
|
||||
#[legacy_exports]
|
||||
mod foo;
|
||||
|
||||
#[path = "bar.rs"]
|
||||
#[legacy_exports]
|
||||
mod bar;
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
mod trait_mix {
|
||||
#[legacy_exports];
|
||||
#[path = "trait-mix.rs"]
|
||||
#[legacy_exports]
|
||||
mod trait_mix;
|
||||
#[legacy_exports]
|
||||
mod u_trait_mix;
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
|
||||
impl f32: u_trait_mix::num {
|
||||
pure fn add(&&other: f32) -> f32 { return self + other; }
|
||||
pure fn sub(&&other: f32) -> f32 { return self - other; }
|
||||
pure fn mul(&&other: f32) -> f32 { return self * other; }
|
||||
pure fn div(&&other: f32) -> f32 { return self / other; }
|
||||
pure fn modulo(&&other: f32) -> f32 { return self % other; }
|
||||
pure fn neg() -> f32 { return -self; }
|
||||
|
||||
pure fn to_int() -> int { return self as int; }
|
||||
static pure fn from_int(n: int) -> f32 { return n as f32; }
|
||||
}
|
||||
|
||||
/*
|
||||
It seems that this will fail if I try using it from another crate.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
// ICEs if I put this in num -- ???
|
||||
trait from_int {
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
trait num {
|
||||
// FIXME: Trait composition. (#2616)
|
||||
pure fn add(&&other: self) -> self;
|
||||
pure fn sub(&&other: self) -> self;
|
||||
pure fn mul(&&other: self) -> self;
|
||||
pure fn div(&&other: self) -> self;
|
||||
pure fn modulo(&&other: self) -> self;
|
||||
pure fn neg() -> self;
|
||||
|
||||
pure fn to_int() -> int;
|
||||
static pure fn from_int(n: int) -> self;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue