export foo;
-import comm::*;
+use comm::*;
fn foo<T: send copy>(x: T) -> Port<T> {
let p = Port();
-import to_str::*;
-import to_str::ToStr;
+use to_str::*;
+use to_str::ToStr;
mod kitty {
-import dvec::DVec;
+use dvec::DVec;
type entry<A,B> = {key: A, value: B};
type alist<A,B> = { eq_fn: fn@(A,A) -> bool, data: DVec<entry<A,B>> };
export rust;
-import name_pool::add;
+use name_pool::add;
mod name_pool {
-import b::d;
+use b::d;
type t = uint;
use std;
-import dvec::*;
-import dvec::DVec;
-import std::map::hashmap;
+use dvec::*;
+use dvec::DVec;
+use std::map::hashmap;
type header_map = hashmap<~str, @DVec<@~str>>;
use issue2378a;
-import issue2378a::maybe;
-import issue2378a::methods;
+use issue2378a::maybe;
+use issue2378a::methods;
type two_maybes<T> = {a: maybe<T>, b: maybe<T>};
#[crate_type = "lib"];
use a;
-import a::to_strz;
+use a::to_strz;
impl int: to_strz {
fn to_strz() -> ~str { fmt!("%?", self) }
use a;
-import a::to_strz;
+use a::to_strz;
impl bool: to_strz {
fn to_strz() -> ~str { fmt!("%b", self) }
mod cloth {
-import issue_2316_a::*;
+use issue_2316_a::*;
export calico, gingham, flannel;
export fabric;
Could probably be more minimal.
*/
-import libc::size_t;
+use libc::size_t;
export port::{};
export port;
*/
use std;
-import rand;
-import std::map;
-import managed::Managed;
-import send_map::linear::*;
-import io::WriterUtil;
+use std::map;
+use managed::Managed;
+use send_map::linear::*;
+use io::WriterUtil;
struct Results {
sequential_ints: float;
use std;
-import std::time::precise_time_s;
-import std::map;
-import std::map::{map, hashmap};
+use std::time::precise_time_s;
+use std::map;
+use std::map::{map, hashmap};
-import io::{Reader, ReaderUtil};
+use io::{Reader, ReaderUtil};
fn main(argv: ~[~str]) {
#macro[
// A raw test of vector appending performance.
use std;
-import dvec::DVec;
-import io::WriterUtil;
+use dvec::DVec;
+use io::WriterUtil;
fn collect_raw(num: uint) -> ~[uint] {
let mut result = ~[];
*/
use std;
-import std::arc;
-import std::time;
-import std::map;
-import std::map::map;
-import std::map::hashmap;
-import std::deque;
-import std::deque::Deque;
-import std::par;
-import io::WriterUtil;
-import comm::*;
-import int::abs;
+use std::arc;
+use std::time;
+use std::map;
+use std::map::map;
+use std::map::hashmap;
+use std::deque;
+use std::deque::Deque;
+use std::par;
+use io::WriterUtil;
+use comm::*;
+use int::abs;
type node_id = i64;
type graph = ~[~[node_id]];
// xfail-pretty
use std;
-import io::Writer;
-import io::WriterUtil;
+use io::Writer;
+use io::WriterUtil;
-import pipes::{Port, Chan, SharedChan};
+use pipes::{Port, Chan, SharedChan};
macro_rules! move_out (
{ $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } }
// xfail-pretty
use std;
-import io::Writer;
-import io::WriterUtil;
+use io::Writer;
+use io::WriterUtil;
-import pipes::{Port, PortSet, Chan};
+use pipes::{Port, PortSet, Chan};
macro_rules! move_out (
{ $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } }
// xfail-pretty
-import future::future;
+use future::future;
use std;
-import std::time;
-import std::arc;
+use std::time;
+use std::arc;
// A poor man's pipe.
type pipe = arc::MutexARC<~[uint]>;
// xfail-pretty
-import future::future;
+use future::future;
use std;
-import std::time;
+use std::time;
-import pipes::recv;
+use pipes::recv;
proto! ring (
num:send {
// xfail-pretty
-import future::future;
+use future::future;
use std;
-import std::time;
-import std::arc;
+use std::time;
+use std::arc;
// A poor man's pipe.
type pipe = arc::RWARC<~[uint]>;
// that things will look really good once we get that lock out of the
// message path.
-import comm::*;
-import future::future;
+use comm::*;
+use future::future;
use std;
-import std::time;
+use std::time;
fn thread_ring(i: uint,
count: uint,
// I *think* it's the same, more or less.
use std;
-import io::Writer;
-import io::WriterUtil;
+use io::Writer;
+use io::WriterUtil;
enum request {
get_count,
use std;
-import pipes::{spawn_service, recv};
-import std::time::precise_time_s;
+use pipes::{spawn_service, recv};
+use std::time::precise_time_s;
proto! pingpong (
ping: send {
use std;
-import std::arena;
-import methods = std::arena::Arena;
+use std::arena;
+use methods = std::arena::Arena;
enum tree/& { nil, node(&tree, &tree, int), }
// chameneos
use std;
-import std::map;
-import std::map::hashmap;
-import std::sort;
+use std::map;
+use std::map::hashmap;
+use std::sort;
fn print_complements() {
let all = ~[Blue, Red, Yellow];
// Based on Isaac Gouy's fannkuchredux.csharp
use std;
-import int;
-import vec;
fn fannkuch(n: int) -> int {
fn perm1init(i: uint) -> int { return i as int; }
* http://shootout.alioth.debian.org/
*/
use std;
-import vec;
-import uint;
-import int;
-import str;
-import io::WriterUtil;
+use io::WriterUtil;
fn LINE_LENGTH() -> uint { return 60u; }
// multi tasking k-nucleotide
use std;
-import std::map;
-import std::map::hashmap;
-import std::sort;
-import io::ReaderUtil;
-import pipes::{stream, Port, Chan};
+use std::map;
+use std::map::hashmap;
+use std::sort;
+use io::ReaderUtil;
+use pipes::{stream, Port, Chan};
// given a map, print a sorted version of it
fn sort_and_fmt(mm: hashmap<~[u8], uint>, total: uint) -> ~str {
// multi tasking k-nucleotide
use std;
-import std::map;
-import std::map::hashmap;
-import std::sort;
-import io::ReaderUtil;
+use std::map;
+use std::map::hashmap;
+use std::sort;
+use io::ReaderUtil;
// given a map, print a sorted version of it
fn sort_and_fmt(mm: hashmap<~[u8], uint>, total: uint) -> ~str {
// writes pbm image to output path
use std;
-import io::WriterUtil;
-import std::map::hashmap;
+use io::WriterUtil;
+use std::map::hashmap;
struct cmplx {
re: f64;
use std;
-import std::{time, getopts};
-import io::WriterUtil;
-import int::range;
-import pipes::Port;
-import pipes::Chan;
-import pipes::send;
-import pipes::recv;
-
-import core::result;
-import result::{Ok, Err};
+use std::{time, getopts};
+use io::WriterUtil;
+use int::range;
+use pipes::Port;
+use pipes::Chan;
+use pipes::send;
+use pipes::recv;
+
+use core::result;
+use result::{Ok, Err};
fn fib(n: int) -> int {
fn pfib(c: Chan<int>, n: int) {
// Microbenchmark for the smallintmap library
use std;
-import std::smallintmap;
-import std::smallintmap::SmallIntMap;
-import io::WriterUtil;
+use std::smallintmap;
+use std::smallintmap::SmallIntMap;
+use io::WriterUtil;
fn append_sequential(min: uint, max: uint, map: SmallIntMap<uint>) {
for uint::range(min, max) |i| {
use std;
-import std::bitv;
-import io::{ReaderUtil, WriterUtil};
+use std::bitv;
+use io::{ReaderUtil, WriterUtil};
// Computes a single solution to a given 9x9 sudoku
//
use std;
-import std::list::{List, Cons, Nil};
-import std::time::precise_time_s;
+use std::list::{List, Cons, Nil};
+use std::time::precise_time_s;
fn main() {
let (repeat, depth) = if os::getenv(~"RUST_BENCH").is_some() {
use std;
-import option = option;
-import option::Some;
-import option::None;
-import str;
-import std::map;
-import std::map::hashmap;
-import vec;
-import io;
-import io::WriterUtil;
-
-import std::time;
-import u64;
-
-import task;
-import comm;
-import comm::Chan;
-import comm::Port;
-import comm::recv;
-import comm::send;
+use option = option;
+use option::Some;
+use option::None;
+use std::map;
+use std::map::hashmap;
+use io::WriterUtil;
+
+use std::time;
+
+use comm::Chan;
+use comm::Port;
+use comm::recv;
+use comm::send;
macro_rules! move_out (
{ $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } }
// xfail-fast aux-build
// aux-build:ambig_impl_2_lib.rs
use ambig_impl_2_lib;
-import ambig_impl_2_lib::me;
+use ambig_impl_2_lib::me;
trait me {
fn me() -> uint;
}
// xfail-test
// error-pattern: instantiating a type parameter with an incompatible type
use std;
-import std::arc::rw_arc;
+use std::arc::rw_arc;
fn main() {
let arc1 = ~rw_arc(true);
// error-pattern: reference is not valid outside of its lifetime
use std;
-import std::arc;
+use std::arc;
fn main() {
let x = ~arc::RWARC(1);
let mut y = None;
use std;
-import std::arc;
+use std::arc;
fn main() {
let x = ~arc::RWARC(1);
let mut y = None;
// error-pattern: reference is not valid outside of its lifetime
use std;
-import std::arc;
+use std::arc;
fn main() {
let x = ~arc::RWARC(1);
let mut y = None;
// error-pattern: reference is not valid outside of its lifetime
use std;
-import std::arc;
+use std::arc;
fn main() {
let x = ~arc::RWARC(1);
let mut y = None;
// error-pattern: reference is not valid outside of its lifetime
use std;
-import std::arc;
+use std::arc;
fn main() {
let x = ~arc::RWARC(1);
let mut y = None;
// error-pattern: unresolved import
-import thing;
fn main() { let foo = thing::len(~[]); }
//buggy.rs
use std;
-import std::map::hashmap;
-import std::map;
+use std::map::hashmap;
+use std::map;
fn main() {
let buggy_map :hashmap<uint, &uint> =
// error-pattern: import
-import m::unexported;
+use m::unexported;
mod m {
export exported;
// error-pattern: mismatched types
use std;
-import std::map::hashmap;
-import std::bitv;
+use std::map::hashmap;
+use std::bitv;
type fn_info = {vars: hashmap<uint, var_info>};
type var_info = {a: uint, b: uint};
// Test that we use fully-qualified type names in error messages.
-import core::task::Task;
+use core::task::Task;
fn bar(x: uint) -> Task {
return x;
// error-pattern:unresolved
// xfail-test
-import spam::{ham, eggs};
+use spam::{ham, eggs};
mod spam {
fn ham() { }
// error-pattern:expected
-import foo::{bar}::baz
\ No newline at end of file
+use foo::{bar}::baz
\ No newline at end of file
// error-pattern:expected
-import baz = foo::{bar};
+use baz = foo::{bar};
mod foo {
fn bar() {}
// error-pattern: unresolved name
-import module_of_many_things::*;
+use module_of_many_things::*;
mod module_of_many_things {
export f1;
// error-pattern:unresolved name
-import m1::*;
+use m1::*;
mod m1 {
export f1;
// error-pattern:expected
-import foo::*::bar
\ No newline at end of file
+use foo::*::bar
\ No newline at end of file
// error-pattern:expected
-import baz = foo::*;
+use baz = foo::*;
mod foo {
fn bar() {}
// error-pattern:import
-import y::x;
+use y::x;
mod y {
import x;
// xfail-test
// error-pattern: unresolved
-import zed::bar;
-import zed::baz;
+use zed::bar;
+use zed::baz;
mod zed {
fn bar() { debug!("bar"); }
}
// error-pattern: unresolved
-import baz::zed::bar;
+use baz::zed::bar;
mod baz { }
mod zed {
fn bar() { debug!("bar3"); }
// error-pattern: unresolved
-import main::bar;
+use main::bar;
fn main(args: ~[str]) { debug!("foo"); }
// xfail-test
// Testing that we don't fail abnormally after hitting the errors
-import unresolved::*; //~ ERROR unresolved modulename
+use unresolved::*; //~ ERROR unresolved modulename
//~^ ERROR unresolved does not name a module
fn main() {
// xfail-test
// error-pattern:unresolved import: m::f
-import x = m::f;
+use x = m::f;
mod m {
}
-import dvec::DVec;
+use dvec::DVec;
type parser = {
tokens: DVec<int>,
// error-pattern:failed to resolve imports
-import x = m::f;
+use x = m::f;
mod m {
}
use std;
-import option;
-import cmp::Eq;
+use cmp::Eq;
fn f<T:Eq>(&o: Option<T>) {
assert o == option::None;
use std;
-import std::map;
-import std::map::hashmap;
-import std::map::map;
+use std::map;
+use std::map::hashmap;
+use std::map::map;
// Test that trait types printed in error msgs include the type arguments.
// error-pattern:declaration of `None` shadows
-import option::*;
+use option::*;
fn main() {
let None: int = 42;
// error-pattern: copying a noncopyable value
use std;
-import std::arc;
-import comm::*;
+use std::arc;
+use comm::*;
fn main() {
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
use std;
-import std::arc;
-import comm::*;
+use std::arc;
+use comm::*;
fn main() {
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
// -*- rust -*-
use std;
-import option;
-import option::Some;
+use option::Some;
// error-pattern: mismatched types
// -*- rust -*-
use std;
-import option;
-import option::Some;
+use option::Some;
// error-pattern: mismatched types
// xfail-fast
// aux-build:cci_class_5.rs
use cci_class_5;
-import cci_class_5::kitties::*;
+use cci_class_5::kitties::*;
fn main() {
let nyan : cat = cat(52u, 99);
// xfail-fast
// aux-build:cci_class.rs
use cci_class;
-import cci_class::kitties::*;
+use cci_class::kitties::*;
fn main() {
let nyan : cat = cat(52u, 99);
use std;
use syntax;
-import io::*;
+use io::*;
-import syntax::diagnostic;
-import syntax::ast;
-import syntax::codemap;
-import syntax::parse;
-import syntax::print::*;
+use syntax::diagnostic;
+use syntax::ast;
+use syntax::codemap;
+use syntax::parse;
+use syntax::print::*;
fn new_parse_sess() -> parse::parse_sess {
fail;
use std;
use syntax;
-import std::io::*;
+use std::io::*;
-import syntax::diagnostic;
-import syntax::ast;
-import syntax::codemap;
-import syntax::parse::parser;
-import syntax::print::*;
+use syntax::diagnostic;
+use syntax::ast;
+use syntax::codemap;
+use syntax::parse::parser;
+use syntax::print::*;
fn new_parse_sess() -> parser::parse_sess {
fail;
// error-pattern: mismatched types
use std;
-import task;
fn main() { task::spawn(fn~() -> int { 10 }); }
// error-pattern: reference is not valid outside of its lifetime
use std;
-import std::sync;
+use std::sync;
fn main() {
let m = ~sync::Mutex();
// error-pattern: reference is not valid outside of its lifetime
use std;
-import std::sync;
+use std::sync;
fn main() {
let x = ~sync::RWlock();
let mut y = None;
// error-pattern: cannot infer an appropriate lifetime
use std;
-import std::sync;
+use std::sync;
fn main() {
let x = ~sync::RWlock();
let mut y = None;
// error-pattern: reference is not valid outside of its lifetime
use std;
-import std::sync;
+use std::sync;
fn main() {
let x = ~sync::RWlock();
let mut y = None;
// error-pattern: reference is not valid outside of its lifetime
use std;
-import std::sync;
+use std::sync;
fn main() {
let x = ~sync::RWlock();
let mut y = None;
// error-pattern:unused import
// compile-flags:-W unused-imports
-import cal = bar::c::cc;
+use cal = bar::c::cc;
mod foo {
type point = {x: int, y: int};
fn f() {
}
-import std::net; //~ ERROR view items must be declared at the top
+use std::net; //~ ERROR view items must be declared at the top
fn main() {
}
// error-pattern:moop
use std;
-import uint;
fn main() { fail ~"moop"; }
// error-pattern:moop
use std;
-import uint;
fn main() { for uint::range(0u, 10u) |_i| { fail ~"moop"; } }
// error-pattern:explicit failure
// Don't double free the string
use std;
-import io::Reader;
+use io::Reader;
fn main() {
do io::with_str_reader(~"") |rdr| {
// error-pattern:explicit failure
use std;
-import std::arc;
+use std::arc;
enum e<T: const send> { e(arc::ARC<T>) }
// error-pattern:1 == 2
use std;
-import task;
-import comm::Port;
-import comm::recv;
+use comm::Port;
+use comm::recv;
fn child() { assert (1 == 2); }
// error-pattern:fail
use std;
-import task;
-import comm::Chan;
-import comm::Port;
-import comm::recv;
+use comm::Chan;
+use comm::Port;
+use comm::recv;
fn child() { fail; }
// error-pattern:fail
use std;
-import task;
-import comm::Port;
-import comm::recv;
+use comm::Port;
+use comm::recv;
fn grandchild() { fail ~"grandchild dies"; }
// -*- rust -*-
// error-pattern:1 == 2
use std;
-import task;
-import comm::Chan;
-import comm::Port;
-import comm::recv;
+use comm::Chan;
+use comm::Port;
+use comm::recv;
fn child() { assert (1 == 2); }
// error-pattern:meep
use std;
-import comm::Chan;
-import comm::Port;
-import comm::send;
-import comm::recv;
+use comm::Chan;
+use comm::Port;
+use comm::send;
+use comm::recv;
fn echo<T: send>(c: Chan<T>, oc: Chan<Chan<T>>) {
// Tests that the type argument in port gets
// xfail-win32
// error-pattern:explicit
use std;
-import task;
// We don't want to see any invalid reads
fn main() {
// error-pattern:goodfail
use std;
-import task;
-import comm;
fn goodfail() {
task::yield();
// error-pattern:fail
use std;
-import std::map;
-import std::map::hashmap;
-import uint;
+use std::map;
+use std::map::hashmap;
fn main() {
let count = @mut 0u;
// the assert should fail at runtime
// error-pattern:Assertion same_length(chars, ints) failed
use std;
-import uint;
-import u8;
-import vec::{same_length, zip};
+use vec::{same_length, zip};
fn enum_chars(start: u8, end: u8) -> ~[char] {
assert start < end;
// xfail-test
// fails pretty printing for some reason
use syntax;
-import syntax::diagnostic;
-import syntax;
-import syntax::ast;
-import syntax::codemap;
-import syntax::print::pprust;
-import syntax::parse::parser;
+use syntax::diagnostic;
+use syntax::ast;
+use syntax::codemap;
+use syntax::print::pprust;
+use syntax::parse::parser;
fn new_parse_sess() -> parser::parse_sess {
let cm = codemap::new_codemap();
use std;
use syntax;
-import io::*;
+use io::*;
-import syntax::diagnostic;
-import syntax::ast;
-import syntax::codemap;
-import syntax::parse;
-import syntax::print::*;
+use syntax::diagnostic;
+use syntax::ast;
+use syntax::codemap;
+use syntax::parse;
+use syntax::print::*;
trait fake_ext_ctxt {
fn cfg() -> ast::crate_cfg;
// -*- rust -*-
use std;
-import comm;
-import task;
fn f(c: comm::_chan<int>) {
type t = {_0: int, _1: int, _2: int};
// Regression test for issue #374
use std;
-import option;
-import option::None;
+use option::None;
enum sty { ty_nil, }
use std;
-import option;
fn foo<T>(y: Option<T>) {
let mut x: int;
// -*- rust -*-
-import core::sys;
+use core::sys;
enum t { make_t(@int), clam, }
// aux-build:anon-extern-mod-cross-crate-1.rs
use anonexternmod;
-import anonexternmod::*;
+use anonexternmod::*;
fn main() {
last_os_error();
// These tests used to be separate files, but I wanted to refactor all
// the common code.
-import cmp::Eq;
-import std::ebml;
-import io::Writer;
-import std::serialization::{serialize_uint, deserialize_uint};
+use cmp::Eq;
+use std::ebml;
+use io::Writer;
+use std::serialization::{serialize_uint, deserialize_uint};
fn test_ser_and_deser<A:Eq>(a1: A,
expected: ~str,
// -*- rust -*-
use std;
-import comm::Chan;
-import comm::Port;
-import comm::send;
-import comm::recv;
-import task;
+use comm::Chan;
+use comm::Port;
+use comm::send;
+use comm::recv;
fn a(c: Chan<int>) { send(c, 10); }
// -*- rust -*-
use std;
-import comm;
-import comm::Port;
-import comm::send;
-import comm::Chan;
-import comm::recv;
-import task;
+use comm::Port;
+use comm::send;
+use comm::Chan;
+use comm::recv;
fn a(c: Chan<int>) { debug!("task a0"); debug!("task a1"); send(c, 10); }
// -*- rust -*-
use std;
-import comm;
-import comm::send;
-import comm::Chan;
-import comm::recv;
-import task;
+use comm::send;
+use comm::Chan;
+use comm::recv;
fn a(c: Chan<int>) {
if true {
// xfail-test
use std;
-import std::arc;
+use std::arc;
fn dispose(+_x: arc::ARC<bool>) unsafe { }
fn main() {
// Binop corner cases
use std;
-import unsafe::reinterpret_cast;
-import task;
-import comm;
+use unsafe::reinterpret_cast;
fn test_nil() {
assert (() == ());
use std;
-import std::bitv::*;
+use std::bitv::*;
fn bitv_test() -> bool {
let v1 = ~Bitv(31, false);
use std;
-import vec;
fn main() {
let v =
-import ptr::to_uint;
+use ptr::to_uint;
fn borrow(x: &int, f: fn(x: &int)) {
f(x)
use std;
-import str;
#[abi = "cdecl"]
#[nolink]
// aux-build:cci_borrow_lib.rs
use cci_borrow_lib;
-import cci_borrow_lib::foo;
+use cci_borrow_lib::foo;
fn main() {
let p = @22u;
use cci_capture_clause;
-import comm::recv;
+use comm::recv;
fn main() {
cci_capture_clause::foo(()).recv()
// aux-build:cci_impl_lib.rs
use cci_impl_lib;
-import cci_impl_lib::uint_helpers;
+use cci_impl_lib::uint_helpers;
fn main() {
//let bt0 = sys::frame_address();
// aux-build:cci_nested_lib.rs
use cci_nested_lib;
-import cci_nested_lib::*;
+use cci_nested_lib::*;
fn main() {
let lst = new_int_alist();
// aux-build:cci_no_inline_lib.rs
use cci_no_inline_lib;
-import cci_no_inline_lib::iter;
+use cci_no_inline_lib::iter;
fn main() {
// Check that a cross-crate call function not marked as inline
// Issue #763
use std;
-import task;
-import comm::Chan;
-import comm::send;
-import comm;
-import comm::Port;
-import comm::recv;
+use comm::Chan;
+use comm::send;
+use comm::Port;
+use comm::recv;
enum request { quit, close(Chan<bool>), }
// Reported as issue #126, child leaks the string.
use std;
-import task;
fn child2(&&s: ~str) { }
// xfail-fast
// aux-build:cci_class_cast.rs
use cci_class_cast;
-import to_str::ToStr;
-import cci_class_cast::kitty::*;
+use to_str::ToStr;
+use cci_class_cast::kitty::*;
fn print_out<T: ToStr>(thing: T, expected: ~str) {
let actual = thing.to_str();
// xfail-test
-import to_str::*;
-import to_str::to_str;
+use to_str::*;
+use to_str::to_str;
class cat : to_str {
priv {
/* Test that exporting a class also exports its
public fields and methods */
-import kitty::*;
+use kitty::*;
mod kitty {
export cat;
// xfail-fast
use std;
-import std::map::*;
+use std::map::*;
class cat : map<int, bool> {
priv {
use std;
-import std::map::*;
+use std::map::*;
enum cat_type { tuxedo, tabby, tortoiseshell }
// xfail-fast
// aux-build:cci_class_trait.rs
use cci_class_trait;
-import cci_class_trait::animals::*;
+use cci_class_trait::animals::*;
struct cat : noisy {
priv {
// xfail-test
use std;
-import std::map::*;
-import vec::*;
-import dvec::{dvec, extensions};
+use std::map::*;
+use vec::*;
+use dvec::{dvec, extensions};
enum furniture { chair, couch, bed }
enum body_part { finger, toe, nose, ear }
// xfail-fast
// aux-build:cci_class_2.rs
use cci_class_2;
-import cci_class_2::kitties::*;
+use cci_class_2::kitties::*;
fn main() {
let nyan : cat = cat(52u, 99);
// xfail-fast
// aux-build:cci_class_3.rs
use cci_class_3;
-import cci_class_3::kitties::*;
+use cci_class_3::kitties::*;
fn main() {
let nyan : cat = cat(52u, 99);
// xfail-fast
// aux-build:cci_class_6.rs
use cci_class_6;
-import cci_class_6::kitties::*;
+use cci_class_6::kitties::*;
fn main() {
let nyan : cat<char> = cat::<char>(52u, 99, ~['p']);
// xfail-fast
-import to_str::*;
-import to_str::ToStr;
+use to_str::*;
+use to_str::ToStr;
struct cat {
priv {
// xfail-test
use std;
-import std::map::{map, hashmap, int_hash};
+use std::map::{map, hashmap, int_hash};
class keys<K: copy, V: copy, M: copy map<K,V>>
: iter::base_iter<K> {
// xfail-fast
// aux-build:cci_class_4.rs
use cci_class_4;
-import cci_class_4::kitties::*;
+use cci_class_4::kitties::*;
fn main() {
let nyan = cat(0u, 2, ~"nyan");
// xfail-fast
// aux-build:cci_class.rs
use cci_class;
-import cci_class::kitties::*;
+use cci_class::kitties::*;
fn main() {
let nyan : cat = cat(52u, 99);
//xfail-test
use std;
-import task;
fn f(x : @{a:int, b:int}) {
assert (x.a == 10);
// -*- rust -*-
use std;
-import comm;
-import comm::Chan;
-import comm::send;
-import comm::recv;
-import task;
+use comm::Chan;
+use comm::send;
+use comm::recv;
fn main() {
let p = comm::Port();
-import g = x::f;
+use g = x::f;
export g;
\ No newline at end of file
-import g = x::f;
+use g = x::f;
export g;
\ No newline at end of file
// Regression test that f64 exports things properly
-import io::println;
+use io::println;
fn main() {
// -*- rust -*-
use std;
-import comm::Port;
-import comm::Chan;
-import comm::send;
-import comm::recv;
+use comm::Port;
+use comm::Chan;
+use comm::send;
+use comm::recv;
fn main() {
let po = Port();
-import dvec::DVec;
+use dvec::DVec;
fn main() {
let d = DVec();
-import m::f;
-import m::g;
+use m::f;
+use m::g;
mod m {
export f, g;
use std;
-import float;
fn main() {
let nan = float::NaN;
use std;
-import vec;
-import str;
#[nolink]
#[abi = "cdecl"]
use std;
-import option = option;
-import option::Some;
-import option::None;
-import str;
-import vec;
-import std::map;
-import std::map::hashmap;
-import task;
-import comm::Chan;
-import comm::Port;
-import comm::send;
-import comm::recv;
-import comm;
+use option = option;
+use option::Some;
+use option::None;
+use std::map;
+use std::map::hashmap;
+use comm::Chan;
+use comm::Port;
+use comm::send;
+use comm::recv;
fn map(filename: ~str, emit: map_reduce::putter) { emit(filename, ~"1"); }
-import spam::{ham, eggs};
+use spam::{ham, eggs};
mod spam {
fn ham() { }
-import module_of_many_things::*;
-import dug::too::greedily::and::too::deep::*;
+use module_of_many_things::*;
+use dug::too::greedily::and::too::deep::*;
mod module_of_many_things {
export f1;
-import a1::b1::word_traveler;
+use a1::b1::word_traveler;
mod a1 {
//
use std;
-import vec::*;
+use vec::*;
fn main() {
let mut v = from_elem(0u, 0);
-import foo::bar::{baz, quux,};
+use foo::bar::{baz, quux,};
mod foo {
mod bar {
-import zed::bar;
+use zed::bar;
mod zed {
fn bar() { debug!("bar"); }
-import baz::zed;
-import zed::bar;
+use baz::zed;
+use zed::bar;
mod baz {
mod zed {
-import zed::bar;
+use zed::bar;
mod zed {
fn bar() { debug!("bar"); }
-import foo::bar;
+use foo::bar;
mod foo {
import zed::bar;
export bar;
-import foo::zed;
-import bar::baz;
+use foo::zed;
+use bar::baz;
mod foo {
mod zed {
fn baz() { debug!("baz"); }
-import foo::zed;
-import bar::baz;
+use foo::zed;
+use bar::baz;
mod foo {
mod zed {
fn baz() { debug!("baz"); }
-import foo::x;
-import z = foo::x;
+use foo::x;
+use z = foo::x;
mod foo {
fn x(y: int) { log(debug, y); }
// xfail-test
use std;
-import task::join;
+use task::join;
fn loop(n: int) {
let t1: task;
// aux-build:cci_intrinsic.rs
use cci_intrinsic;
-import cci_intrinsic::atomic_xchg;
+use cci_intrinsic::atomic_xchg;
fn main() {
let mut x = 1;
// Alignment of interior pointers to dynamic-size types
use std;
-import ptr::addr_of;
+use ptr::addr_of;
type x<T> = {
a: T,
use std;
-import std::map;
-import std::map::hashmap;
+use std::map;
+use std::map::hashmap;
fn main() {
let m = map::bytes_hash();
// xfail-test
use std;
-import std::arena;
-import std::arena::Arena;
+use std::arena;
+use std::arena::Arena;
enum hold { s(str) }
// aux-build:issue-2196-c.rc
use c(name = "issue2196c");
-import c::t;
+use c::t;
fn main() { }
-import libc::{c_double, c_int};
-import f64::*;
+use libc::{c_double, c_int};
+use f64::*;
fn to_c_int(v: &mut int) -> &mut c_int unsafe {
unsafe::reinterpret_cast(&v)
use b;
use c;
-import a::to_strz;
+use a::to_strz;
fn main() {
io::println((~"foo").to_strz());
// aux-build:issue_2316_b.rs
use issue_2316_b;
-import issue_2316_b::cloth;
+use issue_2316_b::cloth;
fn main() {
let _c: cloth::fabric = cloth::calico;
use std;
-import std::deque;
-import std::deque::Deque;
+use std::deque;
+use std::deque::Deque;
fn main() {
let Q = deque::create();
-import dvec::DVec;
+use dvec::DVec;
struct c1<T: copy> {
let x: T;
use issue_2472_b;
-import issue_2472_b::{S, T};
+use issue_2472_b::{S, T};
fn main() {
let s = S(());
// aux-build:issue-2526.rs
use issue_2526;
-import issue_2526::*;
+use issue_2526::*;
fn main() {}
// xfail-test
-import iter;
-import iter::base_iter;
+use iter::base_iter;
impl Q<A> for base_iter<A> {
fn flat_map_to_vec<B:copy, IB:base_iter<B>>(op: fn(B) -> IB) -> ~[B] {
use req;
use std;
-import req::*;
-import std::map::*;
-import std::map::str_hash;
-import dvec;
+use req::*;
+use std::map::*;
+use std::map::str_hash;
fn main() {
let v = ~[mut @~"hi"];
// aux-build:issue_2723_a.rs
use issue_2723_a;
-import issue_2723_a::*;
+use issue_2723_a::*;
fn main() unsafe {
f(~[2]);
// Minimized version of issue-2804.rs. Both check that callee IDs don't
// clobber the previous node ID in a macro expr
use std;
-import std::map::hashmap;
+use std::map::hashmap;
fn add_interfaces(managed_ip: ~str, device: std::map::hashmap<~str, int>) {
error!("%s, %?", managed_ip, device[~"interfaces"]);
use std;
-import io;
-import io::WriterUtil;
-import std::map::hashmap;
+use io::WriterUtil;
+use std::map::hashmap;
enum object
{
// xfail-fast
// aux-build:issue-3012-1.rs
use socketlib;
-import socketlib::socket;
+use socketlib::socket;
fn main() {
let fd: libc::c_int = 1 as libc::c_int;
// xfail-fast
-import pipes::{Select2, Selectable};
+use pipes::{Select2, Selectable};
fn main() {
let (c,p) = pipes::stream();
*/
use std;
-import task;
#[abi = "cdecl"]
extern mod rustrt {
use std;
-import task;
-import comm;
-import comm::Chan;
-import comm::send;
-import comm::Port;
-import comm::recv;
+use comm::Chan;
+use comm::send;
+use comm::Port;
+use comm::recv;
fn grandchild(c: Chan<int>) { send(c, 42); }
use std;
-import vec;
-import task;
-import comm;
-import comm::Chan;
-import comm::Port;
-import comm::recv;
-import comm::send;
+use comm::Chan;
+use comm::Port;
+use comm::recv;
+use comm::send;
enum msg { closed, received(~[u8]), }
use std;
-import comm::*;
-import task::*;
+use comm::*;
+use task::*;
fn a() {
fn doit() {
use issue2378a;
use issue2378b;
-import issue2378a::{just, methods};
-import issue2378b::{methods};
+use issue2378a::{just, methods};
+use issue2378b::{methods};
fn main() {
let x = {a: just(3), b: just(5)};
use std;
-import task;
-import comm;
-import comm::Chan;
-import comm::Port;
-import comm::send;
-import comm::recv;
+use comm::Chan;
+use comm::Port;
+use comm::send;
+use comm::recv;
fn producer(c: Chan<~[u8]>) {
send(c,
// -*- rust -*-
use std;
-import task;
-import comm::*;
+use comm::*;
fn main() {
let p = Port();
use std;
-import std::list;
+use std::list;
enum foo {
a(uint),
// xfail-win32 leaks
use std;
-import task;
-import comm;
-import uint;
fn die() {
fail;
// -*- rust -*-
use std;
-import task;
-import comm;
fn sub(parent: comm::Chan<int>, id: int) {
if id == 0 {
// This test will call __morestack with various minimum stack sizes
use std;
-import task;
fn getbig(&&i: int) {
if i != 0 {
use std;
-import uint;
fn test(x: bool, foo: ~{x: int, y: int, z: int}) -> int {
let bar = foo;
use std;
-import uint;
fn test(x: bool, foo: @{x: int, y: int, z: int}) -> int {
let bar = foo;
use std;
-import uint;
fn test(foo: ~{a: int, b: int, c: int}) -> ~{a: int, b: int, c: int} {
let foo = foo;
use std;
-import uint;
fn test(foo: @{a: int, b: int, c: int}) -> @{a: int, b: int, c: int} {
let foo = foo;
// a bug was causing this to complain about leaked memory on exit
use std;
-import option;
-import option::Some;
-import option::None;
+use option::Some;
+use option::None;
enum t { foo(int, uint), bar(int, Option<int>), }
use std;
-import std::list::*;
+use std::list::*;
pure fn pure_length_go<T: copy>(ls: @List<T>, acc: uint) -> uint {
match *ls { Nil => { acc } Cons(_, tl) => { pure_length_go(tl, acc + 1u) } }
//
// http://theincredibleholk.wordpress.com/2012/07/06/rusty-pipes/
-import pipes::try_recv;
+use pipes::try_recv;
type username = ~str;
type password = ~str;
// xfail-win32
use std;
-import std::timer::sleep;
-import std::uv;
+use std::timer::sleep;
+use std::uv;
-import pipes::{try_recv, recv};
+use pipes::{try_recv, recv};
proto! oneshot (
waiting:send {
// xfail-pretty
use std;
-import std::timer::sleep;
-import std::uv;
+use std::timer::sleep;
+use std::uv;
proto! oneshot (
waiting:send {
// xfail-pretty
-import double_buffer::client::*;
-import double_buffer::give_buffer;
+use double_buffer::client::*;
+use double_buffer::give_buffer;
macro_rules! select_if (
{
// xfail-win32
use std;
-import std::timer::sleep;
-import std::uv;
+use std::timer::sleep;
+use std::uv;
-import pipes::{recv, select};
+use pipes::{recv, select};
proto! oneshot (
waiting:send {
// xfail-pretty
use std;
-import std::timer::sleep;
-import std::uv;
-import pipes::recv;
+use std::timer::sleep;
+use std::uv;
+use pipes::recv;
proto! oneshot (
waiting:send {
use std;
-import std::arena;
+use std::arena;
fn main() {
let p = &arena::Arena();
-import intrinsic::{TyDesc, get_tydesc, visit_tydesc, TyVisitor};
-import libc::c_void;
+use intrinsic::{TyDesc, get_tydesc, visit_tydesc, TyVisitor};
+use libc::c_void;
// FIXME: this is a near-duplicate of code in core::vec.
type unboxed_vec_repr = {
// FIXME: un-xfail after snapshot
// xfail-test
-import intrinsic::{tydesc, get_tydesc, visit_tydesc, ty_visitor};
+use intrinsic::{tydesc, get_tydesc, visit_tydesc, ty_visitor};
enum my_visitor = @{ mut types: ~[str] };
impl of ty_visitor for my_visitor {
use std;
-import libc, sys, unsafe;
-import std::arena::Arena;
+use libc, sys, unsafe;
+use std::arena::Arena;
type bcx = {
fcx: &fcx
-import libc, sys, unsafe;
+use libc, sys, unsafe;
enum arena = ();
-import cmp::Eq;
+use cmp::Eq;
fn iter<T>(v: ~[T], it: fn(T) -> bool) {
let mut i = 0u, l = v.len();
// Regression tests for circular_buffer when using a unit
// that has a size that is not a power of two
use std;
-import option;
-import uint;
-import comm;
-import comm::Port;
-import comm::Chan;
-import comm::send;
-import comm::recv;
+use comm::Port;
+use comm::Chan;
+use comm::send;
+use comm::recv;
// A 12-byte unit to send over the channel
type record = {val1: u32, val2: u32, val3: u32};
// Tests of the runtime's scheduler interface
-import ptr::is_null;
+use ptr::is_null;
type sched_id = int;
type task_id = *libc::c_void;
// xfail-win32
use std;
-import task;
-import comm;
-import uint;
fn die() {
fail;
-import task::*;
-import comm::*;
+use task::*;
+use comm::*;
struct test {
let f: int;
use std;
-import comm::Chan;
-import comm::send;
-import comm::Port;
+use comm::Chan;
+use comm::send;
+use comm::Port;
// tests that ctrl's type gets inferred properly
type command<K: send, V: send> = {key: K, val: V};
use std;
-import comm::Chan;
-import comm::send;
+use comm::Chan;
+use comm::send;
fn main() { test05(); }
use std;
-import comm::Chan;
-import comm::send;
+use comm::Chan;
+use comm::send;
fn main() { test05(); }
use std;
-import comm::Chan;
-import comm::send;
+use comm::Chan;
+use comm::send;
fn main() { test05(); }
// interior record which is then itself interior to
// something else, shape calculations were off.
use std;
-import std::list;
-import std::list::list;
-import option;
+use std::list;
+use std::list::list;
enum opt_span {
#!/usr/bin/env rustx
// pp-exact
-import io::println;
+use io::println;
fn main() { io::println(~"Hello World"); }
// -*- rust -*-
use std;
-import task::yield;
-import task;
+use task::yield;
fn x(s: ~str, n: int) {
log(debug, s);
use std;
-import str;
-import comm;
-import task;
type ctx = comm::Chan<int>;
use std;
-import task;
fn main() {
task::spawn(|| child(10) );
// -*- rust -*-
use std;
-import task::spawn;
+use task::spawn;
fn main() { spawn(|| child((10, 20, 30, 40, 50, 60, 70, 80, 90)) ); }
-import a::*;
+use a::*;
trait plus {
fn plus() -> int;
// aux-build:static-methods-crate.rs
use static_methods_crate;
-import static_methods_crate::read;
-import readMaybeRenamed = static_methods_crate::readMaybe;
+use static_methods_crate::read;
+use readMaybeRenamed = static_methods_crate::readMaybe;
fn main() {
let result: int = read(~"5");
// -*- rust -*-
use std;
-import str;
fn test1() {
let mut s: ~str = ~"hello";
// -*- rust -*-
use std;
-import str;
fn main() {
let a: ~str = ~"this \
use std;
-import str;
fn main() {
// Make sure we properly handle repeated self-appends.
use std;
-import str;
fn test(actual: ~str, expected: ~str) {
log(debug, actual);
-import alder::*;
+use alder::*;
mod alder {
export burnside;
use std;
-import pipes;
-import pipes::Chan;
-import pipes::Port;
-import task;
+use pipes::Chan;
+use pipes::Port;
fn main() { test05(); }
use std;
-import task;
-import pipes;
fn start(c: pipes::Chan<pipes::Chan<~str>>) {
let (ch, p) = pipes::stream();
use std;
-import pipes;
-import task;
fn start(c: pipes::Chan<pipes::Chan<int>>) {
let (ch, p) = pipes::stream();
use std;
-import task;
fn main() { test00(); }
use std;
-import task;
-import pipes;
-import pipes::send;
+use pipes::send;
fn start(c: pipes::Chan<int>, start: int, number_of_messages: int) {
let mut i: int = 0;
-import task;
fn main() {
let po = pipes::PortSet();
// xfail-win32
use std;
-import task;
fn start(c: pipes::Chan<int>, i0: int) {
let mut i = i0;
// -*- rust -*-
use std;
-import pipes;
-import pipes::send;
-import pipes::Port;
-import pipes::recv;
-import pipes::Chan;
+use pipes::send;
+use pipes::Port;
+use pipes::recv;
+use pipes::Chan;
// Tests of ports and channels on various types
fn test_rec() {
// This test is specifically about spawning temporary closures.
use std;
-import task;
fn f() {
}
use std;
-import task;
-import pipes;
-import pipes::Chan;
-import pipes::send;
-import pipes::recv;
+use pipes::Chan;
+use pipes::send;
+use pipes::recv;
fn main() { debug!("===== WITHOUT THREADS ====="); test00(); }
use std;
-import pipes;
-import pipes::send;
+use pipes::send;
fn main() { test00(); }
use std;
-import pipes;
fn main() { test00(); }
use std;
-import pipes;
-import pipes::send;
-import pipes::chan;
-import pipes::recv;
+use pipes::send;
+use pipes::chan;
+use pipes::recv;
fn main() { test00(); }
use std;
-import task;
fn main() { test00(); }
use std;
-import task;
fn main() { test00(); }
use std;
-import comm;
fn main() {
let p = comm::Port();
use std;
-import comm;
fn main() {
let p = comm::Port();
use std;
-import comm;
fn main() {
let c = {
use std;
-import int;
-import comm;
-import task;
// We're trying to trigger a race between send and port destruction that
// results in the string not being freed
// -*- rust -*-
use std;
-import comm;
// rustboot can't transmit nils across channels because they don't have
// any size, but rustc currently can because they do have size. Whether
use std;
-import task;
-import task::task;
-import comm;
-import comm::Chan;
-import comm::Port;
-import comm::send;
-import comm::recv;
+use task::task;
+use comm::Chan;
+use comm::Port;
+use comm::send;
+use comm::recv;
fn main() {
test00();
// xfail-test
use std;
-import task;
-import task::join;
-import comm;
+use task::join;
fn child() { }
// the join.
use std;
-import task;
struct notify {
let ch: comm::Chan<bool>; let v: @mut bool;
// longer needs to be wakened when the supervised task exits.
use std;
-import task;
fn supervised() {
// Yield to make sure the supervisor joins before we fail. This is
use std;
-import task;
fn main() {
task::spawn(|| child(~"Hello") );
}
// xfail-pretty
use std;
-import option;
-import vec;
#[test]
#[ignore(cfg(ignorecfg))]
// -*- rust -*-
use std;
-import task;
fn main() {
let mut i = 10;
use core;
-import core::{str, int, vec};
+use core::{str, int, vec};
trait to_str {
fn to_str() -> ~str;
-import u_trait_mix;
impl f32: u_trait_mix::num {
pure fn add(&&other: f32) -> f32 { return self + other; }
-import pipes::{Port, Chan};
+use pipes::{Port, Chan};
/*
This is about the simplest program that can successfully send a
// xfail-test
-import sys::rustrt::size_of;
+use sys::rustrt::size_of;
use std;
fn main() {
// unified with the type *T, and so the type variable
// in that type gets resolved.
use std;
-import unsafe;
fn null<T>() -> *T unsafe { unsafe::reinterpret_cast(&0) }
use std;
-import sys::refcount;
+use sys::refcount;
fn main() unsafe {
let i = ~@1;
use std;
-import comm;
-import task;
-import uint;
fn child(c: comm::Chan<~uint>, i: uint) {
comm::send(c, ~i);
use std;
-import comm;
-import task;
fn main() {
let p = comm::Port();
// xfail-win32
use std;
-import task;
fn f() {
let a = @0;
// xfail-win32
use std;
-import task;
-import comm;
struct complainer {
let c: comm::Chan<bool>;
// xfail-win32
use std;
-import task;
-import comm;
struct complainer {
let c: @int;
// xfail-win32
use std;
-import task;
fn f() {
let a = ~0;
use bar(name = "core", vers = "0.4");
-import core::str;
-import x = zed::str;
+use core::str;
+use x = zed::str;
mod baz {
import bar::str;
import x = core::str;
use std;
-import str;
-import vec;
fn main() {
// Chars of 1, 2, 3, and 4 bytes
use std;
-import vec;
fn test_heap_to_heap() {
// a spills onto the heap
// -*- rust -*-
use std;
-import task;
-import task::*;
+use task::*;
fn main() {
let mut result = None;
// -*- rust -*-
use std;
-import task;
-import task::*;
+use task::*;
fn main() {
let mut result = None;
// In this case, the code should compile and should
// succeed at runtime
use std;
-import uint;
-import u8;
-import vec::{head, is_not_empty, last, same_length, zip};
+use vec::{head, is_not_empty, last, same_length, zip};
fn enum_chars(start: u8, end: u8) -> ~[char] {
assert start < end;