ignore-test cleanup
Most of these are old, but some specific messages for specific tests: * trait-contravariant-self.rs: failed due to a soundess hole:05e3248a79
* process-detatch:15966c3c1f
says "this test is being ignored until signals are implemented" That's not happening for a long time, and when it is, we'll write tests for it. * deep-vector{,2}.rs: "too big for our poor macro infrastructure", and has been ignored over a year. * borrowck-nested-calls.rs's FIXME #6268 was closed in favor of rust-lang/rfcs#811 * issue-15167.rs works properly now * issue-9737.rs works properly now * match-var-hygiene.rs works properly now Addresses a chunk of #3965
This commit is contained in:
parent
a2f2a64763
commit
bba934f19a
src/test
compile-fail
debuginfo
gdb-pretty-struct-and-enums.rsgeneric-trait-generic-static-default-method.rsissue11600.rstrait-generic-static-default-method.rs
parse-fail
pretty
run-fail
bug-2470-bounds-check-overflow-2.rsbug-2470-bounds-check-overflow-3.rstoo-much-recursion-unwinding.rs
run-pass
auto-encode.rsborrowck-nested-calls.rsdeep-vector.rsdeep-vector2.rsderiving-encodable-decodable.rsderiving-self-lifetime.rsevec-internal.rsinfinite-loops.rsissue-2185.rsissue-2190-2.rsissue-4241.rsissue-9737.rsmatch-var-hygiene.rsno-std-xcrate.rsno-std-xcrate2.rspreempt.rsprocess-detach.rstrait-contravariant-self.rs
@ -9,11 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// macro f should not be able to inject a reference to 'n'.
|
||||
//
|
||||
// Ignored because `for` loops are not hygienic yet; they will require special
|
||||
// handling since they introduce a new pattern binding position.
|
||||
|
||||
// ignore-test
|
||||
|
||||
macro_rules! f { () => (n) }
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test
|
||||
|
||||
fn foo<'a>() -> &'a isize { //~ ERROR unconstrained region
|
||||
return &x;
|
||||
}
|
||||
static x: isize = 5;
|
||||
fn main() {}
|
@ -1,29 +0,0 @@
|
||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test
|
||||
|
||||
// error-pattern:library 'm' already added: can't specify link_args.
|
||||
|
||||
/* I think it should undefined to have multiple modules that link in the same
|
||||
library, but provide different link arguments. Unfortunately we don't track
|
||||
link_args by module -- they are just appended as discovered into the crate
|
||||
store -- but for now, it should be an error to provide link_args on a module
|
||||
that's already been included (with or without link_args). */
|
||||
|
||||
#[link_name= "m"]
|
||||
#[link_args="-foo"] // this could have been elided.
|
||||
extern {
|
||||
}
|
||||
|
||||
#[link_name= "m"]
|
||||
#[link_args="-bar"] // this is the actual error trigger.
|
||||
extern {
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
// ignore-test
|
||||
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
|
||||
struct Foo<'a> {
|
||||
x: &'a isize
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let f = Foo { x: &*(box 3) }; //~ ERROR borrowed value does not live long enough
|
||||
assert_eq!(*f.x, 3);
|
||||
}
|
@ -1,189 +0,0 @@
|
||||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test also broken on nightly linux distcheck. it's just broken!
|
||||
// ignore-windows failing on win32 bot
|
||||
// ignore-freebsd: output doesn't match
|
||||
// ignore-tidy-linelength
|
||||
// ignore-lldb
|
||||
// ignore-android: FIXME(#10381)
|
||||
// compile-flags:-g
|
||||
|
||||
// This test uses some GDB Python API features (e.g. accessing anonymous fields)
|
||||
// which are only available in newer GDB version. The following directive will
|
||||
// case the test runner to ignore this test if an older GDB version is used:
|
||||
// min-gdb-version 7.7
|
||||
|
||||
// gdb-command: run
|
||||
|
||||
// gdb-command: print regular_struct
|
||||
// gdb-check:$1 = RegularStruct = {the_first_field = 101, the_second_field = 102.5, the_third_field = false, the_fourth_field = "I'm so pretty, oh so pretty..."}
|
||||
|
||||
// gdb-command: print tuple
|
||||
// gdb-check:$2 = {true, 103, "blub"}
|
||||
|
||||
// gdb-command: print tuple_struct
|
||||
// gdb-check:$3 = TupleStruct = {-104.5, 105}
|
||||
|
||||
// gdb-command: print empty_struct
|
||||
// gdb-check:$4 = EmptyStruct
|
||||
|
||||
// gdb-command: print c_style_enum1
|
||||
// gdb-check:$5 = CStyleEnumVar1
|
||||
|
||||
// gdb-command: print c_style_enum2
|
||||
// gdb-check:$6 = CStyleEnumVar2
|
||||
|
||||
// gdb-command: print c_style_enum3
|
||||
// gdb-check:$7 = CStyleEnumVar3
|
||||
|
||||
// gdb-command: print mixed_enum_c_style_var
|
||||
// gdb-check:$8 = MixedEnumCStyleVar
|
||||
|
||||
// gdb-command: print mixed_enum_tuple_var
|
||||
// gdb-check:$9 = MixedEnumTupleVar = {106, 107, false}
|
||||
|
||||
// gdb-command: print mixed_enum_struct_var
|
||||
// gdb-check:$10 = MixedEnumStructVar = {field1 = 108.5, field2 = 109}
|
||||
|
||||
// gdb-command: print some
|
||||
// gdb-check:$11 = Some = {110}
|
||||
|
||||
// gdb-command: print none
|
||||
// gdb-check:$12 = None
|
||||
|
||||
// gdb-command: print some_fat
|
||||
// gdb-check:$13 = Some = {"abc"}
|
||||
|
||||
// gdb-command: print none_fat
|
||||
// gdb-check:$14 = None
|
||||
|
||||
// gdb-command: print nested_variant1
|
||||
// gdb-check:$15 = NestedVariant1 = {NestedStruct = {regular_struct = RegularStruct = {the_first_field = 111, the_second_field = 112.5, the_third_field = true, the_fourth_field = "NestedStructString1"}, tuple_struct = TupleStruct = {113.5, 114}, empty_struct = EmptyStruct, c_style_enum = CStyleEnumVar2, mixed_enum = MixedEnumTupleVar = {115, 116, false}}}
|
||||
|
||||
// gdb-command: print nested_variant2
|
||||
// gdb-check:$16 = NestedVariant2 = {abc = NestedStruct = {regular_struct = RegularStruct = {the_first_field = 117, the_second_field = 118.5, the_third_field = false, the_fourth_field = "NestedStructString10"}, tuple_struct = TupleStruct = {119.5, 120}, empty_struct = EmptyStruct, c_style_enum = CStyleEnumVar3, mixed_enum = MixedEnumStructVar = {field1 = 121.5, field2 = -122}}}
|
||||
|
||||
// gdb-command: print none_check1
|
||||
// gdb-check:$17 = None
|
||||
|
||||
// gdb-command: print none_check2
|
||||
// gdb-check:$18 = None
|
||||
|
||||
#![allow(dead_code, unused_variables)]
|
||||
|
||||
use self::CStyleEnum::{CStyleEnumVar1, CStyleEnumVar2, CStyleEnumVar3};
|
||||
use self::MixedEnum::{MixedEnumCStyleVar, MixedEnumTupleVar, MixedEnumStructVar};
|
||||
use self::NestedEnum::{NestedVariant1, NestedVariant2};
|
||||
|
||||
struct RegularStruct {
|
||||
the_first_field: isize,
|
||||
the_second_field: f64,
|
||||
the_third_field: bool,
|
||||
the_fourth_field: &'static str,
|
||||
}
|
||||
|
||||
struct TupleStruct(f64, i16);
|
||||
|
||||
struct EmptyStruct;
|
||||
|
||||
enum CStyleEnum {
|
||||
CStyleEnumVar1,
|
||||
CStyleEnumVar2,
|
||||
CStyleEnumVar3,
|
||||
}
|
||||
|
||||
enum MixedEnum {
|
||||
MixedEnumCStyleVar,
|
||||
MixedEnumTupleVar(u32, u16, bool),
|
||||
MixedEnumStructVar { field1: f64, field2: i32 }
|
||||
}
|
||||
|
||||
struct NestedStruct {
|
||||
regular_struct: RegularStruct,
|
||||
tuple_struct: TupleStruct,
|
||||
empty_struct: EmptyStruct,
|
||||
c_style_enum: CStyleEnum,
|
||||
mixed_enum: MixedEnum,
|
||||
}
|
||||
|
||||
enum NestedEnum {
|
||||
NestedVariant1(NestedStruct),
|
||||
NestedVariant2 { abc: NestedStruct }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
let regular_struct = RegularStruct {
|
||||
the_first_field: 101,
|
||||
the_second_field: 102.5,
|
||||
the_third_field: false,
|
||||
the_fourth_field: "I'm so pretty, oh so pretty..."
|
||||
};
|
||||
|
||||
let tuple = ( true, 103u32, "blub" );
|
||||
|
||||
let tuple_struct = TupleStruct(-104.5, 105);
|
||||
|
||||
let empty_struct = EmptyStruct;
|
||||
|
||||
let c_style_enum1 = CStyleEnumVar1;
|
||||
let c_style_enum2 = CStyleEnumVar2;
|
||||
let c_style_enum3 = CStyleEnumVar3;
|
||||
|
||||
let mixed_enum_c_style_var = MixedEnumCStyleVar;
|
||||
let mixed_enum_tuple_var = MixedEnumTupleVar(106, 107, false);
|
||||
let mixed_enum_struct_var = MixedEnumStructVar { field1: 108.5, field2: 109 };
|
||||
|
||||
let some = Some(110_usize);
|
||||
let none: Option<isize> = None;
|
||||
let some_fat = Some("abc");
|
||||
let none_fat: Option<&'static str> = None;
|
||||
|
||||
let nested_variant1 = NestedVariant1(
|
||||
NestedStruct {
|
||||
regular_struct: RegularStruct {
|
||||
the_first_field: 111,
|
||||
the_second_field: 112.5,
|
||||
the_third_field: true,
|
||||
the_fourth_field: "NestedStructString1",
|
||||
},
|
||||
tuple_struct: TupleStruct(113.5, 114),
|
||||
empty_struct: EmptyStruct,
|
||||
c_style_enum: CStyleEnumVar2,
|
||||
mixed_enum: MixedEnumTupleVar(115, 116, false)
|
||||
}
|
||||
);
|
||||
|
||||
let nested_variant2 = NestedVariant2 {
|
||||
abc: NestedStruct {
|
||||
regular_struct: RegularStruct {
|
||||
the_first_field: 117,
|
||||
the_second_field: 118.5,
|
||||
the_third_field: false,
|
||||
the_fourth_field: "NestedStructString10",
|
||||
},
|
||||
tuple_struct: TupleStruct(119.5, 120),
|
||||
empty_struct: EmptyStruct,
|
||||
c_style_enum: CStyleEnumVar3,
|
||||
mixed_enum: MixedEnumStructVar {
|
||||
field1: 121.5,
|
||||
field2: -122
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let none_check1: Option<(usize, Vec<usize>)> = None;
|
||||
let none_check2: Option<String> = None;
|
||||
|
||||
zzz(); // #break
|
||||
}
|
||||
|
||||
fn zzz() { () }
|
@ -1,52 +0,0 @@
|
||||
// ignore-test
|
||||
|
||||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags:-g
|
||||
// gdb-command:run
|
||||
|
||||
// gdb-command:print arg1
|
||||
// gdb-check:$1 = 1000
|
||||
// gdb-command:print *arg2
|
||||
// gdb-check:$2 = {1, 2.5}
|
||||
// gdb-command:continue
|
||||
|
||||
// gdb-command:print arg1
|
||||
// gdb-check:$3 = 2000
|
||||
// gdb-command:print *arg2
|
||||
// gdb-check:$4 = {3.5, {4, 5, 6}}
|
||||
// gdb-command:continue
|
||||
|
||||
#![omit_gdb_pretty_printer_section]
|
||||
|
||||
struct Struct {
|
||||
x: isize
|
||||
}
|
||||
|
||||
trait Trait<T1> {
|
||||
fn generic_static_default_method<T2>(arg1: isize, arg2: &(T1, T2)) -> isize {
|
||||
zzz(); // #break
|
||||
arg1
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Trait<T> for Struct {}
|
||||
|
||||
fn main() {
|
||||
|
||||
// Is this really how to use these?
|
||||
Trait::generic_static_default_method::<isize, Struct, float>(1000, &(1, 2.5));
|
||||
Trait::generic_static_default_method::<float, Struct, (isize, isize, isize)>(2000,
|
||||
&(3.5, (4, 5, 6)));
|
||||
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
@ -1,30 +0,0 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// This test was actually never run before because commands were only parsed up to the first
|
||||
// function definition but the test relied on the function being above the commands. Ignore for now.
|
||||
// ignore-test
|
||||
|
||||
fn main() {
|
||||
let args : Vec<String> = ::std::os::args();
|
||||
::std::io::println(args[0]);
|
||||
}
|
||||
|
||||
// ignore-lldb
|
||||
|
||||
// This test case checks whether compile unit names are set correctly, so that the correct default
|
||||
// source file can be found.
|
||||
|
||||
// compile-flags:-g
|
||||
// gdb-command:list
|
||||
// gdb-check:1[...]fn main() {
|
||||
// gdb-check:2[...]let args : Vec<String> = ::std::os::args();
|
||||
// gdb-check:3[...]::std::io::println(args[0]);
|
||||
// gdb-check:4[...]}
|
@ -1,71 +0,0 @@
|
||||
// ignore-test
|
||||
|
||||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags:-g
|
||||
|
||||
// === GDB TESTS ===================================================================================
|
||||
|
||||
// gdb-command:run
|
||||
|
||||
// gdb-command:print arg1
|
||||
// gdb-check:$1 = 1000
|
||||
// gdb-command:print arg2
|
||||
// gdb-check:$2 = 0.5
|
||||
// gdb-command:continue
|
||||
|
||||
// gdb-command:print arg1
|
||||
// gdb-check:$3 = 2000
|
||||
// gdb-command:print *arg2
|
||||
// gdb-check:$4 = {1, 2, 3}
|
||||
// gdb-command:continue
|
||||
|
||||
|
||||
// === LLDB TESTS ==================================================================================
|
||||
|
||||
// lldb-command:run
|
||||
|
||||
// lldb-command:print arg1
|
||||
// lldb-check:[...]$0 = 1000
|
||||
// lldb-command:print arg2
|
||||
// lldb-check:[...]$1 = 0.5
|
||||
// lldb-command:continue
|
||||
|
||||
// lldb-command:print arg1
|
||||
// lldb-check:[...]$2 = 2000
|
||||
// lldb-command:print *arg2
|
||||
// lldb-check:[...]$3 = (1, 2, 3)
|
||||
// lldb-command:continue
|
||||
|
||||
#![omit_gdb_pretty_printer_section]
|
||||
|
||||
struct Struct {
|
||||
x: isize
|
||||
}
|
||||
|
||||
trait Trait {
|
||||
fn generic_static_default_method<T>(arg1: isize, arg2: T) -> isize {
|
||||
zzz(); // #break
|
||||
arg1
|
||||
}
|
||||
}
|
||||
|
||||
impl Trait for Struct {}
|
||||
|
||||
fn main() {
|
||||
|
||||
// Is this really how to use these?
|
||||
Trait::generic_static_default_method::<Struct, float>(1000, 0.5);
|
||||
Trait::generic_static_default_method::<Struct, &(isize, isize, isize)>(2000, &(1, 2, 3));
|
||||
|
||||
}
|
||||
|
||||
fn zzz() {()}
|
@ -1,29 +0,0 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -Z parse-only
|
||||
|
||||
// ignore-test FIXME(japari) remove test
|
||||
|
||||
struct Foo {
|
||||
f: for <'b> |&'b isize|:
|
||||
'b -> &'b isize //~ ERROR use of undeclared lifetime name `'b`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut x: Vec< for <'a> ||
|
||||
:'a //~ ERROR use of undeclared lifetime name `'a`
|
||||
> = Vec::new();
|
||||
x.push(|| {});
|
||||
|
||||
let foo = Foo {
|
||||
f: |x| x
|
||||
};
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -Z parse-only
|
||||
|
||||
// ignore-test
|
||||
// ignored because the first error does not show up.
|
||||
|
||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -Z parse-only
|
||||
|
||||
fn of<T>() -> |T| { panic!(); }
|
||||
fn subtype<T>(x: |T|) { panic!(); }
|
||||
|
||||
fn test_fn<'x, 'y, 'z, T>(_x: &'x T, _y: &'y T, _z: &'z T) {
|
||||
// Here, x, y, and z are free. Other letters
|
||||
// are bound. Note that the arrangement
|
||||
// subtype::<T1>(of::<T2>()) will typecheck
|
||||
// iff T1 <: T2.
|
||||
|
||||
// should be the default:
|
||||
subtype::< ||:'static>(of::<||>());
|
||||
subtype::<||>(of::< ||:'static>());
|
||||
|
||||
//
|
||||
subtype::< <'x> ||>(of::<||>()); //~ ERROR mismatched types
|
||||
subtype::< <'x> ||>(of::< <'y> ||>()); //~ ERROR mismatched types
|
||||
|
||||
subtype::< <'x> ||>(of::< ||:'static>()); //~ ERROR mismatched types
|
||||
subtype::< ||:'static>(of::< <'x> ||>());
|
||||
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -1,69 +0,0 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test
|
||||
// ignored due to problems with by value self.
|
||||
|
||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -Z parse-only
|
||||
|
||||
// Here: foo is parameterized because it contains a method that
|
||||
// refers to self.
|
||||
|
||||
trait foo<'a> {
|
||||
fn self_int(self) -> &'a isize;
|
||||
|
||||
fn any_int(self) -> &isize;
|
||||
}
|
||||
|
||||
struct with_foo<'a> {
|
||||
f: @foo<'a>
|
||||
}
|
||||
|
||||
trait set_foo_foo {
|
||||
fn set_foo(&mut self, f: @foo);
|
||||
}
|
||||
|
||||
impl<'a> set_foo_foo for with_foo<'a> {
|
||||
fn set_foo(&mut self, f: @foo) {
|
||||
self.f = f; //~ ERROR mismatched types: expected `@foo/&self`, found `@foo/&`
|
||||
}
|
||||
}
|
||||
|
||||
// Bar is not region parameterized.
|
||||
|
||||
trait bar {
|
||||
fn any_int(&self) -> &isize;
|
||||
}
|
||||
|
||||
struct with_bar {
|
||||
f: bar
|
||||
}
|
||||
|
||||
trait set_foo_bar {
|
||||
fn set_foo(&mut self, f: bar);
|
||||
}
|
||||
|
||||
impl set_foo_bar for with_bar {
|
||||
fn set_foo(&mut self, f: bar) {
|
||||
self.f = f;
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -1,39 +0,0 @@
|
||||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -Z parse-only
|
||||
|
||||
// ignore-test #5723
|
||||
|
||||
// Test that you cannot escape a reference
|
||||
// into a trait.
|
||||
|
||||
struct ctxt { v: usize }
|
||||
|
||||
trait get_ctxt {
|
||||
fn get_ctxt(&self) -> &'a ctxt;
|
||||
}
|
||||
|
||||
struct has_ctxt<'a> { c: &'a ctxt }
|
||||
|
||||
impl<'a> get_ctxt for has_ctxt<'a> {
|
||||
fn get_ctxt(&self) -> &'a ctxt { self.c }
|
||||
}
|
||||
|
||||
fn make_gc() -> @get_ctxt {
|
||||
let ctxt = ctxt { v: 22 };
|
||||
let hc = has_ctxt { c: &ctxt };
|
||||
return @hc as @get_ctxt;
|
||||
//~^ ERROR source contains reference
|
||||
}
|
||||
|
||||
fn main() {
|
||||
make_gc().get_ctxt().v;
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test
|
||||
// ignore'd due to problems with by-value self.
|
||||
|
||||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -Z parse-only
|
||||
|
||||
trait get_ctxt<'a> {
|
||||
fn get_ctxt(self) -> &'a usize;
|
||||
}
|
||||
|
||||
fn make_gc1(gc: @get_ctxt<'a>) -> @get_ctxt<'b> {
|
||||
return gc; //~ ERROR mismatched types: expected `@get_ctxt/&b`, found `@get_ctxt/&a`
|
||||
}
|
||||
|
||||
struct Foo {
|
||||
r: &'a usize
|
||||
}
|
||||
|
||||
impl get_ctxt for Foo<'a> {
|
||||
fn get_ctxt(&self) -> &'a usize { self.r }
|
||||
}
|
||||
|
||||
fn make_gc2<'a,'b>(foo: Foo<'a>) -> @get_ctxt<'b> {
|
||||
return @foo as @get_ctxt; //~ ERROR cannot infer
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test
|
||||
// pp-exact
|
||||
struct Thing {
|
||||
x: isize,
|
||||
y: isize,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let sth = Thing{x: 0, y: 1,};
|
||||
let sth2 = Thing{y: 9 , ..sth};
|
||||
assert_eq!(sth.x + sth2.y, 9);
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test
|
||||
// error-pattern:index out of bounds
|
||||
|
||||
use std::usize;
|
||||
|
||||
fn main() {
|
||||
let x = vec!(1_usize,2_usize,3_usize);
|
||||
|
||||
// This should cause a bounds-check panic, but may not if we do our
|
||||
// bounds checking by comparing a scaled index value to the vector's
|
||||
// length (in bytes), because the scaling of the index will cause it to
|
||||
// wrap around to a small number.
|
||||
|
||||
let idx = usize::MAX & !(usize::MAX >> 1_usize);
|
||||
println!("ov2 idx = 0x%x", idx);
|
||||
|
||||
// This should panic.
|
||||
println!("ov2 0x%x", x[idx]);
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test
|
||||
// error-pattern:index out of bounds
|
||||
|
||||
use std::u64;
|
||||
|
||||
#[cfg(target_arch="x86")]
|
||||
fn main() {
|
||||
let x = vec!(1_usize,2_usize,3_usize);
|
||||
|
||||
// This should cause a bounds-check panic, but may not if we do our
|
||||
// bounds checking by truncating the index value to the size of the
|
||||
// machine word, losing relevant bits of the index value.
|
||||
|
||||
// This test is only meaningful on 32-bit hosts.
|
||||
|
||||
let idx = u64::MAX & !(u64::MAX >> 1_usize);
|
||||
println!("ov3 idx = 0x%8.8x%8.8x",
|
||||
(idx >> 32) as usize,
|
||||
idx as usize);
|
||||
|
||||
// This should panic.
|
||||
println!("ov3 0x%x", x[idx]);
|
||||
}
|
||||
|
||||
#[cfg(any(target_arch="x86_64", target_arch = "aarch64"))]
|
||||
fn main() {
|
||||
// This version just panics anyways, for symmetry on 64-bit hosts.
|
||||
let x = vec!(1_usize,2_usize,3_usize);
|
||||
error!("ov3 0x%x", x[200]);
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test leaks
|
||||
// error-pattern:ran out of stack
|
||||
|
||||
// Test that the thread panicks after hitting the recursion limit
|
||||
// during unwinding
|
||||
|
||||
fn recurse() {
|
||||
println!("don't optimize me out");
|
||||
recurse();
|
||||
}
|
||||
|
||||
struct r {
|
||||
recursed: *mut bool,
|
||||
}
|
||||
|
||||
impl Drop for r {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !*(self.recursed) {
|
||||
*(self.recursed) = true;
|
||||
recurse();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn r(recursed: *mut bool) -> r {
|
||||
r { recursed: recursed }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut recursed = false;
|
||||
let _r = r(&mut recursed);
|
||||
recurse();
|
||||
}
|
@ -1,171 +0,0 @@
|
||||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test FIXME(#5121)
|
||||
|
||||
extern crate rbml;
|
||||
extern crate serialize;
|
||||
extern crate time;
|
||||
|
||||
// These tests used to be separate files, but I wanted to refactor all
|
||||
// the common code.
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use rbml::reader as EBReader;
|
||||
use rbml::writer as EBWriter;
|
||||
use std::cmp::Eq;
|
||||
use std::cmp;
|
||||
use std::io;
|
||||
use serialize::{Decodable, Encodable};
|
||||
|
||||
fn test_rbml<'a, 'b, A:
|
||||
Eq +
|
||||
Encodable<EBWriter::Encoder<'a>> +
|
||||
Decodable<EBReader::Decoder<'b>>
|
||||
>(a1: &A) {
|
||||
let mut wr = Vec::new();
|
||||
let mut rbml_w = EBwriter::Encoder::new(&mut wr);
|
||||
a1.encode(&mut rbml_w);
|
||||
|
||||
let d: serialize::rbml::Doc<'a> = EBDoc::new(&wr);
|
||||
let mut decoder: EBReader::Decoder<'a> = EBreader::Decoder::new(d);
|
||||
let a2: A = Decodable::decode(&mut decoder);
|
||||
assert!(*a1 == a2);
|
||||
}
|
||||
|
||||
#[derive(Decodable, Encodable)]
|
||||
enum Expr {
|
||||
Val(usize),
|
||||
Plus(@Expr, @Expr),
|
||||
Minus(@Expr, @Expr)
|
||||
}
|
||||
|
||||
impl cmp::Eq for Expr {
|
||||
fn eq(&self, other: &Expr) -> bool {
|
||||
match *self {
|
||||
Val(e0a) => {
|
||||
match *other {
|
||||
Val(e0b) => e0a == e0b,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
Plus(e0a, e1a) => {
|
||||
match *other {
|
||||
Plus(e0b, e1b) => e0a == e0b && e1a == e1b,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
Minus(e0a, e1a) => {
|
||||
match *other {
|
||||
Minus(e0b, e1b) => e0a == e0b && e1a == e1b,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fn ne(&self, other: &Expr) -> bool { !(*self).eq(other) }
|
||||
}
|
||||
|
||||
impl cmp::Eq for Point {
|
||||
fn eq(&self, other: &Point) -> bool {
|
||||
self.x == other.x && self.y == other.y
|
||||
}
|
||||
fn ne(&self, other: &Point) -> bool { !(*self).eq(other) }
|
||||
}
|
||||
|
||||
impl<T:cmp::Eq> cmp::Eq for Quark<T> {
|
||||
fn eq(&self, other: &Quark<T>) -> bool {
|
||||
match *self {
|
||||
Top(ref q) => {
|
||||
match *other {
|
||||
Top(ref r) => q == r,
|
||||
Bottom(_) => false
|
||||
}
|
||||
},
|
||||
Bottom(ref q) => {
|
||||
match *other {
|
||||
Top(_) => false,
|
||||
Bottom(ref r) => q == r
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
fn ne(&self, other: &Quark<T>) -> bool { !(*self).eq(other) }
|
||||
}
|
||||
|
||||
impl cmp::Eq for CLike {
|
||||
fn eq(&self, other: &CLike) -> bool {
|
||||
(*self) as isize == *other as isize
|
||||
}
|
||||
fn ne(&self, other: &CLike) -> bool { !self.eq(other) }
|
||||
}
|
||||
|
||||
#[derive(Decodable, Encodable, Eq)]
|
||||
struct Spanned<T> {
|
||||
lo: usize,
|
||||
hi: usize,
|
||||
node: T,
|
||||
}
|
||||
|
||||
#[derive(Decodable, Encodable)]
|
||||
struct SomeStruct { v: Vec<usize> }
|
||||
|
||||
#[derive(Decodable, Encodable)]
|
||||
struct Point {x: usize, y: usize}
|
||||
|
||||
#[derive(Decodable, Encodable)]
|
||||
enum Quark<T> {
|
||||
Top(T),
|
||||
Bottom(T)
|
||||
}
|
||||
|
||||
#[derive(Decodable, Encodable)]
|
||||
enum CLike { A, B, C }
|
||||
|
||||
pub fn main() {
|
||||
let a = &Plus(@Minus(@Val(3), @Val(10)), @Plus(@Val(22), @Val(5)));
|
||||
test_rbml(a);
|
||||
|
||||
let a = &Spanned {lo: 0, hi: 5, node: 22};
|
||||
test_rbml(a);
|
||||
|
||||
let a = &Point {x: 3, y: 5};
|
||||
test_rbml(a);
|
||||
|
||||
let a = &Top(22);
|
||||
test_rbml(a);
|
||||
|
||||
let a = &Bottom(222);
|
||||
test_rbml(a);
|
||||
|
||||
let a = &A;
|
||||
test_rbml(a);
|
||||
|
||||
let a = &B;
|
||||
test_rbml(a);
|
||||
|
||||
let a = &time::now();
|
||||
test_rbml(a);
|
||||
|
||||
test_rbml(&1.0f32);
|
||||
test_rbml(&1.0f64);
|
||||
test_rbml(&'a');
|
||||
|
||||
let mut a = HashMap::new();
|
||||
test_rbml(&a);
|
||||
a.insert(1, 2);
|
||||
test_rbml(&a);
|
||||
|
||||
let mut a = HashSet::new();
|
||||
test_rbml(&a);
|
||||
a.insert(1);
|
||||
test_rbml(&a);
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test FIXME (#6268) nested method calls
|
||||
|
||||
// Test that (safe) nested calls with `&mut` receivers are permitted.
|
||||
|
||||
struct Foo {a: usize, b: usize}
|
||||
|
||||
impl Foo {
|
||||
pub fn inc_a(&mut self, v: usize) { self.a += v; }
|
||||
|
||||
pub fn next_b(&mut self) -> usize {
|
||||
let b = self.b;
|
||||
self.b += 1;
|
||||
b
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let mut f = Foo {a: 22, b: 23};
|
||||
f.inc_a(f.next_b());
|
||||
assert_eq!(f.a, 22+23);
|
||||
assert_eq!(f.b, 24);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,79 +0,0 @@
|
||||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// This actually tests a lot more than just encodable/decodable, but it gets the
|
||||
// job done at least
|
||||
|
||||
// ignore-test FIXME(#5121)
|
||||
|
||||
extern crate rand;
|
||||
extern crate rbml;
|
||||
extern crate serialize;
|
||||
|
||||
use rand::{random, Rand};
|
||||
use rbml;
|
||||
use rbml::Doc;
|
||||
use rbml::writer::Encoder;
|
||||
use rbml::reader::Decoder;
|
||||
use serialize::{Encodable, Decodable};
|
||||
|
||||
#[derive(Encodable, Decodable, Eq, Rand)]
|
||||
struct A;
|
||||
#[derive(Encodable, Decodable, Eq, Rand)]
|
||||
struct B(isize);
|
||||
#[derive(Encodable, Decodable, Eq, Rand)]
|
||||
struct C(isize, isize, usize);
|
||||
|
||||
#[derive(Encodable, Decodable, Eq, Rand)]
|
||||
struct D {
|
||||
a: isize,
|
||||
b: usize,
|
||||
}
|
||||
|
||||
#[derive(Encodable, Decodable, Eq, Rand)]
|
||||
enum E {
|
||||
E1,
|
||||
E2(usize),
|
||||
E3(D),
|
||||
E4{ x: usize },
|
||||
}
|
||||
|
||||
#[derive(Encodable, Decodable, Eq, Rand)]
|
||||
enum F { F1 }
|
||||
|
||||
#[derive(Encodable, Decodable, Eq, Rand)]
|
||||
struct G<T> {
|
||||
t: T
|
||||
}
|
||||
|
||||
fn roundtrip<'a, T: Rand + Eq + Encodable<Encoder<'a>> +
|
||||
Decodable<Decoder<'a>>>() {
|
||||
let obj: T = random();
|
||||
let mut w = Vec::new();
|
||||
let mut e = Encoder::new(&mut w);
|
||||
obj.encode(&mut e);
|
||||
let doc = rbml::Doc::new(&w);
|
||||
let mut dec = Decoder::new(doc);
|
||||
let obj2 = Decodable::decode(&mut dec);
|
||||
assert!(obj == obj2);
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
roundtrip::<A>();
|
||||
roundtrip::<B>();
|
||||
roundtrip::<C>();
|
||||
roundtrip::<D>();
|
||||
|
||||
for _ in 0..20 {
|
||||
roundtrip::<E>();
|
||||
roundtrip::<F>();
|
||||
roundtrip::<G<isize>>();
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test FIXME #11820: & is unreliable in deriving
|
||||
|
||||
#[derive(Eq,Ord)]
|
||||
struct A<'a> {
|
||||
x: &'a isize
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let a = A { x: &1 };
|
||||
let b = A { x: &2 };
|
||||
|
||||
assert_eq!(a, a);
|
||||
assert_eq!(b, b);
|
||||
|
||||
|
||||
assert!(a < b);
|
||||
assert!(b > a);
|
||||
|
||||
assert!(a <= b);
|
||||
assert!(a <= a);
|
||||
assert!(b <= b);
|
||||
|
||||
assert!(b >= a);
|
||||
assert!(b >= b);
|
||||
assert!(a >= a);
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test
|
||||
|
||||
// Doesn't work; needs a design decision.
|
||||
|
||||
pub fn main() {
|
||||
let x : [isize; 5] = [1,2,3,4,5];
|
||||
let _y : [isize; 5] = [1,2,3,4,5];
|
||||
let mut z = [1,2,3,4,5];
|
||||
z = x;
|
||||
assert_eq!(z[0], 1);
|
||||
assert_eq!(z[4], 5);
|
||||
|
||||
let a : [isize; 5] = [1,1,1,1,1];
|
||||
let b : [isize; 5] = [2,2,2,2,2];
|
||||
let c : [isize; 5] = [2,2,2,2,3];
|
||||
|
||||
log(debug, a);
|
||||
|
||||
assert!(a < b);
|
||||
assert!(a <= b);
|
||||
assert!(a != b);
|
||||
assert!(b >= a);
|
||||
assert!(b > a);
|
||||
|
||||
log(debug, b);
|
||||
|
||||
assert!(b < c);
|
||||
assert!(b <= c);
|
||||
assert!(b != c);
|
||||
assert!(c >= b);
|
||||
assert!(c > b);
|
||||
|
||||
assert!(a < c);
|
||||
assert!(a <= c);
|
||||
assert!(a != c);
|
||||
assert!(c >= a);
|
||||
assert!(c > a);
|
||||
|
||||
log(debug, c);
|
||||
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
/*
|
||||
A simple way to make sure threading works. This should use all the
|
||||
CPU cycles an any machines that we're likely to see for a while.
|
||||
*/
|
||||
// ignore-test
|
||||
|
||||
fn loopy(n: isize) {
|
||||
if n > 0 { spawn(move|| { loopy(n - 1) }); spawn(move|| { loopy(n - 1) }); }
|
||||
loop { }
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
// Commenting this out, as this will hang forever otherwise.
|
||||
// Even after seeing the comment above, I'm not sure what the
|
||||
// intention of this test is.
|
||||
// spawn(move|| { loopy(5) });
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test
|
||||
|
||||
// notes on this test case:
|
||||
// On Thu, Apr 18, 2013-2014 at 6:30 PM, John Clements <clements@brinckerhoff.org> wrote:
|
||||
// the "issue-2185.rs" test was ignored with a ref to #2263. Issue #2263 is now fixed,
|
||||
// so I tried it again, and after adding some &self parameters, I got this error:
|
||||
//
|
||||
// Running /usr/local/bin/rustc:
|
||||
// issue-2185.rs:24:0: 26:1 error: conflicting implementations for a trait
|
||||
// issue-2185.rs:24 impl iterable<usize> for 'static ||usize|| {
|
||||
// issue-2185.rs:25 fn iter(&self, blk: |v: usize|) { self( |i| blk(i) ) }
|
||||
// issue-2185.rs:26 }
|
||||
// issue-2185.rs:20:0: 22:1 note: note conflicting implementation here
|
||||
// issue-2185.rs:20 impl<A> iterable<A> for 'static ||A|| {
|
||||
// issue-2185.rs:21 fn iter(&self, blk: |A|) { self(blk); }
|
||||
// issue-2185.rs:22 }
|
||||
//
|
||||
// … so it looks like it's just not possible to implement both
|
||||
// the generic iterable<usize> and iterable<A> for the type iterable<usize>.
|
||||
// Is it okay if I just remove this test?
|
||||
//
|
||||
// but Niko responded:
|
||||
// think it's fine to remove this test, just because it's old and cruft and not hard to reproduce.
|
||||
// *However* it should eventually be possible to implement the same interface for the same type
|
||||
// multiple times with different type parameters, it's just that our current trait implementation
|
||||
// has accidental limitations.
|
||||
|
||||
// so I'm leaving it in.
|
||||
// actually, it looks like this is related to bug #3429. I'll rename this bug.
|
||||
|
||||
// This test had to do with an outdated version of the iterable trait.
|
||||
// However, the condition it was testing seemed complex enough to
|
||||
// warrant still having a test, so I inlined the old definitions.
|
||||
|
||||
trait iterable<A> {
|
||||
fn iter(&self, blk: |A|);
|
||||
}
|
||||
|
||||
impl<A> iterable<A> for 'static ||A|| {
|
||||
fn iter(&self, blk: |A|) { self(blk); }
|
||||
}
|
||||
|
||||
impl iterable<usize> for 'static ||usize|| {
|
||||
fn iter(&self, blk: |v: usize|) { self( |i| blk(i) ) }
|
||||
}
|
||||
|
||||
fn filter<A,IA:iterable<A>>(self: IA, prd: 'static |A| -> bool, blk: |A|) {
|
||||
self.iter(|a| {
|
||||
if prd(a) { blk(a) }
|
||||
});
|
||||
}
|
||||
|
||||
fn foldl<A,B,IA:iterable<A>>(self: IA, b0: B, blk: |B, A| -> B) -> B {
|
||||
let mut b = b0;
|
||||
self.iter(|a| {
|
||||
b = blk(b, a);
|
||||
});
|
||||
b
|
||||
}
|
||||
|
||||
fn range(lo: usize, hi: usize, it: |usize|) {
|
||||
let mut i = lo;
|
||||
while i < hi {
|
||||
it(i);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let range: 'static ||usize|| = |a| range(0, 1000, a);
|
||||
let filt: 'static ||v: usize|| = |a| filter(
|
||||
range,
|
||||
|&&n: usize| n % 3 != 0 && n % 5 != 0,
|
||||
a);
|
||||
let sum = foldl(filt, 0, |accum, &&n: usize| accum + n );
|
||||
|
||||
println!("{}", sum);
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test FIXME #2190
|
||||
|
||||
mod a {
|
||||
fn foo(f: ||) { f() }
|
||||
fn bar() {}
|
||||
pub fn main() { foo(||bar()); }
|
||||
}
|
||||
|
||||
mod b {
|
||||
fn foo(f: Option<||>) { f.map(|x|x()); }
|
||||
fn bar() {}
|
||||
pub fn main() { foo(Some(bar)); }
|
||||
}
|
||||
|
||||
mod c {
|
||||
fn foo(f: Option<||>) { f.map(|x|x()); }
|
||||
fn bar() {}
|
||||
pub fn main() { foo(Some(||bar())); }
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test needs networking
|
||||
|
||||
extern crate extra;
|
||||
|
||||
use extra::net::tcp::TcpSocketBuf;
|
||||
|
||||
use std::io;
|
||||
use std::isize;
|
||||
|
||||
use std::io::{ReaderUtil,WriterUtil};
|
||||
|
||||
enum Result {
|
||||
Nil,
|
||||
Int(isize),
|
||||
Data(Vec<u8>),
|
||||
List(Vec<Result>),
|
||||
Error(String),
|
||||
Status(String)
|
||||
}
|
||||
|
||||
fn parse_data(len: usize, io: @io::Reader) -> Result {
|
||||
let res =
|
||||
if (len > 0) {
|
||||
let bytes = io.read_bytes(len as usize);
|
||||
assert_eq!(bytes.len(), len);
|
||||
Data(bytes)
|
||||
} else {
|
||||
Data(vec![])
|
||||
};
|
||||
assert_eq!(io.read_char(), '\r');
|
||||
assert_eq!(io.read_char(), '\n');
|
||||
return res;
|
||||
}
|
||||
|
||||
fn parse_list(len: usize, io: @io::Reader) -> Result {
|
||||
let mut list: Vec<Result> = vec![];
|
||||
for _ in 0..len {
|
||||
let v = match io.read_char() {
|
||||
'$' => parse_bulk(io),
|
||||
':' => parse_int(io),
|
||||
_ => panic!()
|
||||
};
|
||||
list.push(v);
|
||||
}
|
||||
return List(list);
|
||||
}
|
||||
|
||||
fn chop(s: String) -> String {
|
||||
s.slice(0, s.len() - 1).to_string()
|
||||
}
|
||||
|
||||
fn parse_bulk(io: @io::Reader) -> Result {
|
||||
match from_str::<isize>(chop(io.read_line())) {
|
||||
None => panic!(),
|
||||
Some(-1) => Nil,
|
||||
Some(len) if len >= 0 => parse_data(len as usize, io),
|
||||
Some(_) => panic!()
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_multi(io: @io::Reader) -> Result {
|
||||
match from_str::<isize>(chop(io.read_line())) {
|
||||
None => panic!(),
|
||||
Some(-1) => Nil,
|
||||
Some(0) => List(vec![]),
|
||||
Some(len) if len >= 0 => parse_list(len as usize, io),
|
||||
Some(_) => panic!()
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_int(io: @io::Reader) -> Result {
|
||||
match from_str::<isize>(chop(io.read_line())) {
|
||||
None => panic!(),
|
||||
Some(i) => Int(i)
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_response(io: @io::Reader) -> Result {
|
||||
match io.read_char() {
|
||||
'$' => parse_bulk(io),
|
||||
'*' => parse_multi(io),
|
||||
'+' => Status(chop(io.read_line())),
|
||||
'-' => Error(chop(io.read_line())),
|
||||
':' => parse_int(io),
|
||||
_ => panic!()
|
||||
}
|
||||
}
|
||||
|
||||
fn cmd_to_string(cmd: Vec<String>) -> String {
|
||||
let mut res = "*".to_string();
|
||||
res.push_str(cmd.len().to_string());
|
||||
res.push_str("\r\n");
|
||||
for s in &cmd {
|
||||
res.push_str(["$".to_string(), s.len().to_string(), "\r\n".to_string(),
|
||||
(*s).clone(), "\r\n".to_string()].concat() );
|
||||
}
|
||||
res
|
||||
}
|
||||
|
||||
fn query(cmd: Vec<String>, sb: TcpSocketBuf) -> Result {
|
||||
let cmd = cmd_to_string(cmd);
|
||||
//println!("{}", cmd);
|
||||
sb.write_str(cmd);
|
||||
let res = parse_response(@sb as @io::Reader);
|
||||
res
|
||||
}
|
||||
|
||||
fn query2(cmd: Vec<String>) -> Result {
|
||||
let _cmd = cmd_to_string(cmd);
|
||||
io::with_str_reader("$3\r\nXXX\r\n".to_string())(|sb| {
|
||||
let res = parse_response(@sb as @io::Reader);
|
||||
println!("{}", res);
|
||||
res
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
pub fn main() {
|
||||
}
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test #9737
|
||||
|
||||
macro_rules! f {
|
||||
(v: $x:expr) => ( println!("{}", $x) )
|
||||
}
|
||||
|
@ -8,8 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test #9384
|
||||
|
||||
// shouldn't affect evaluation of $ex.
|
||||
macro_rules! bad_macro { ($ex:expr) => (
|
||||
{match 9 {_x => $ex}}
|
||||
|
@ -1,21 +0,0 @@
|
||||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test #9839
|
||||
// aux-build:no_std_crate.rs
|
||||
|
||||
// This tests that crates which link to std can also be linked to crates with
|
||||
// #[no_std] that have no lang items.
|
||||
|
||||
extern crate no_std_crate;
|
||||
|
||||
pub fn main() {
|
||||
no_std_crate::foo();
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test: this has weird linking problems on Linux, and it probably needs a
|
||||
// solution along the lines of disabling segmented stacks and/or the
|
||||
// stack checks.
|
||||
// aux-build:no_std_crate.rs
|
||||
|
||||
// This tests that libraries built with #[no_std] can be linked to crates with
|
||||
// #[no_std] and actually run.
|
||||
|
||||
#![feature(no_std)]
|
||||
#![no_std]
|
||||
|
||||
extern crate no_std_crate;
|
||||
|
||||
// This is an unfortunate thing to have to do on Linux :(
|
||||
#[cfg(target_os = "linux")]
|
||||
#[doc(hidden)]
|
||||
pub mod linkhack {
|
||||
#[link_args="-lrustrt -lrt"]
|
||||
extern {}
|
||||
}
|
||||
|
||||
#[start]
|
||||
pub fn main(_: isize, _: **u8, _: *u8) -> isize {
|
||||
no_std_crate::foo();
|
||||
0
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test
|
||||
// This checks that preemption works.
|
||||
|
||||
// note: halfway done porting to modern rust
|
||||
use std::comm;
|
||||
|
||||
fn starve_main(alive: Receiver<isize>) {
|
||||
println!("signalling main");
|
||||
alive.recv();
|
||||
println!("starving main");
|
||||
let mut i: isize = 0;
|
||||
loop { i += 1; }
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let (port, chan) = stream();
|
||||
|
||||
println!("main started");
|
||||
spawn(move|| {
|
||||
starve_main(port);
|
||||
});
|
||||
let mut i: isize = 0;
|
||||
println!("main waiting for alive signal");
|
||||
chan.send(i);
|
||||
println!("main got alive signal");
|
||||
while i < 50 { println!("main iterated"); i += 1; }
|
||||
println!("main completed");
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-test
|
||||
|
||||
// FIXME: this test is being ignored until signals are implemented
|
||||
|
||||
// This test ensures that the 'detach' field on processes does the right thing.
|
||||
// By detaching the child process, they should be put into a separate process
|
||||
// group. We test this by spawning a detached process, then killing our own
|
||||
// group with a signal.
|
||||
//
|
||||
// Note that the first thing we do is put ourselves in our own process group so
|
||||
// we don't interfere with other running tests.
|
||||
|
||||
extern crate libc;
|
||||
|
||||
use std::io::process;
|
||||
use std::io::process::Command;
|
||||
use std::io::signal::{Listener, Interrupt};
|
||||
|
||||
fn main() {
|
||||
unsafe { libc::setsid(); }
|
||||
|
||||
// we shouldn't die because of an interrupt
|
||||
let mut l = Listener::new();
|
||||
l.register(Interrupt).unwrap();
|
||||
|
||||
// spawn the child
|
||||
let mut p = Command::new("/bin/sh").arg("-c").arg("read a").detached().spawn().unwrap();
|
||||
|
||||
// send an interrupt to everyone in our process group
|
||||
unsafe { libc::funcs::posix88::signal::kill(0, libc::SIGINT); }
|
||||
|
||||
// Wait for the child process to die (terminate it's stdin and the read
|
||||
// should fail).
|
||||
drop(p.stdin.take());
|
||||
match p.wait().unwrap() {
|
||||
process::ExitStatus(..) => {}
|
||||
process::ExitSignal(..) => panic!()
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
// ignore-test
|
||||
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// This is an interesting test case. We have a trait (Bar) that is
|
||||
// implemented for a `Box<Foo>` object (note: no bounds). And then we
|
||||
// have a `Box<Foo+Send>` object. The impl for `Box<Foo>` is applicable
|
||||
// to `Box<Foo+Send>` because:
|
||||
//
|
||||
// 1. The trait Bar is contravariant w/r/t Self because `Self` appears
|
||||
// only in argument position.
|
||||
// 2. The impl provides `Bar for Box<Foo>`
|
||||
// 3. The fn `wants_bar()` requires `Bar for Box<Foo:Send>`.
|
||||
// 4. `Bar for Box<Foo> <: Bar for Box<Foo:Send>` because
|
||||
// `Box<Foo:Send> <: Box<Foo>`.
|
||||
|
||||
#![allow(unknown_features)]
|
||||
#![feature(box_syntax)]
|
||||
|
||||
trait Foo { }
|
||||
struct SFoo;
|
||||
impl Foo for SFoo { }
|
||||
|
||||
trait Bar { fn dummy(&self); }
|
||||
impl Bar for Box<Foo> { fn dummy(&self) { } }
|
||||
|
||||
fn wants_bar<B:Bar>(b: &B) { }
|
||||
|
||||
fn main() {
|
||||
let x: Box<Foo+Send> = (box SFoo);
|
||||
wants_bar(&x);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user