Fix/annotate a variety of xfails
This commit is contained in:
committed by
Daniel Micay
parent
e2e39234cc
commit
adb8ac4162
@@ -1,6 +1,4 @@
|
|||||||
// xfail-test
|
// xfail-test #5321
|
||||||
// xfail'd because of a problem with by-value self.
|
|
||||||
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|||||||
@@ -1,60 +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.
|
|
||||||
|
|
||||||
// xfail-test
|
|
||||||
|
|
||||||
use to_str::*;
|
|
||||||
use to_str::to_str;
|
|
||||||
|
|
||||||
class cat : to_str {
|
|
||||||
priv {
|
|
||||||
let mut meows : uint;
|
|
||||||
fn meow() {
|
|
||||||
error!("Meow");
|
|
||||||
self.meows += 1u;
|
|
||||||
if self.meows % 5u == 0u {
|
|
||||||
self.how_hungry += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut how_hungry : int;
|
|
||||||
let name : str;
|
|
||||||
|
|
||||||
new(in_x : uint, in_y : int, in_name: str)
|
|
||||||
{ self.meows = in_x; self.how_hungry = in_y; self.name = in_name; }
|
|
||||||
|
|
||||||
fn speak() { self.meow(); }
|
|
||||||
|
|
||||||
fn eat() -> bool {
|
|
||||||
if self.how_hungry > 0 {
|
|
||||||
error!("OM NOM NOM");
|
|
||||||
self.how_hungry -= 2;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
error!("Not hungry!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn to_str() -> str { self.name }
|
|
||||||
}
|
|
||||||
|
|
||||||
fn print_out<T:to_str>(thing: T, expected: str) {
|
|
||||||
let actual = thing.to_str();
|
|
||||||
debug!("%s", actual);
|
|
||||||
assert_eq!(actual, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn main() {
|
|
||||||
let nyan : to_str = cat(0u, 2, "nyan") as to_str;
|
|
||||||
print_out(nyan, "nyan");
|
|
||||||
}
|
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
// xfail-test FIXME #7307
|
||||||
// xfail-fast
|
// xfail-fast
|
||||||
|
|
||||||
extern mod extra;
|
extern mod extra;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
// xfail-test FIXME #7305
|
||||||
|
|
||||||
extern mod extra;
|
extern mod extra;
|
||||||
use extra::oldmap::*;
|
use extra::oldmap::*;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
// xfail-test
|
|
||||||
|
|
||||||
fn sum(x: &[int]) -> int {
|
fn sum(x: &[int]) -> int {
|
||||||
let mut sum = 0;
|
let mut sum = 0;
|
||||||
for x.each |y| { sum += *y; }
|
for x.iter().advance |y| { sum += *y; }
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,8 +12,10 @@ fn sum_imm(y: &[int]) -> int {
|
|||||||
sum(y)
|
sum(y)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME #7304
|
||||||
fn sum_const(y: &const [int]) -> int {
|
fn sum_const(y: &const [int]) -> int {
|
||||||
sum(y)
|
sum(y)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
pub fn main() {}
|
pub fn main() {}
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
// xfail-test
|
/* FIXME #7302
|
||||||
|
|
||||||
fn foo(v: &const [uint]) -> ~[uint] {
|
fn foo(v: &const [uint]) -> ~[uint] {
|
||||||
v.to_vec()
|
v.to_owned()
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
fn bar(v: &mut [uint]) -> ~[uint] {
|
fn bar(v: &mut [uint]) -> ~[uint] {
|
||||||
v.to_vec()
|
v.to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bip(v: &[uint]) -> ~[uint] {
|
fn bip(v: &[uint]) -> ~[uint] {
|
||||||
v.to_vec()
|
v.to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let mut the_vec = ~[1, 2, 3, 100];
|
let mut the_vec = ~[1u, 2, 3, 100];
|
||||||
assert_eq!(the_vec, foo(the_vec));
|
// assert_eq!(the_vec.clone(), foo(the_vec));
|
||||||
assert_eq!(the_vec, bar(the_vec));
|
assert_eq!(the_vec.clone(), bar(the_vec));
|
||||||
assert_eq!(the_vec, bip(the_vec));
|
assert_eq!(the_vec.clone(), bip(the_vec));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// xfail-test #7103 `extern mod` does not work on windows
|
// xfail-fast #7103 `extern mod` does not work on windows
|
||||||
|
|
||||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// Just a test that new-style extern mods parse
|
// Just a test that new-style extern mods parse
|
||||||
|
|
||||||
// xfail-test
|
// xfail-test FIXME #6407
|
||||||
extern mod test = "github.com/catamorphism/test-pkg";
|
extern mod test = "github.com/catamorphism/test-pkg";
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|||||||
@@ -8,12 +8,9 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
use std::sys;
|
||||||
|
|
||||||
extern mod extra;
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
// Bare functions should just be a pointer
|
// Bare functions should just be a pointer
|
||||||
assert!(sys::rustrt::size_of::<fn()>() ==
|
assert_eq!(sys::size_of::<extern "Rust" fn()>(), sys::size_of::<int>());
|
||||||
sys::rustrt::size_of::<int>());
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
// xfail-test FIXME #7308
|
||||||
// -*- rust -*-
|
// -*- rust -*-
|
||||||
|
|
||||||
native mod libc = target_libc {
|
native mod libc = target_libc {
|
||||||
|
|||||||
@@ -8,10 +8,11 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
// xfail-test FIXME #1866
|
||||||
mod a {
|
mod a {
|
||||||
pub type rust_task = uint;
|
pub type rust_task = uint;
|
||||||
pub mod rustrt {
|
pub mod rustrt {
|
||||||
|
use super::rust_task;
|
||||||
pub extern {
|
pub extern {
|
||||||
pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
|
pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
|
||||||
}
|
}
|
||||||
@@ -21,6 +22,7 @@ mod a {
|
|||||||
mod b {
|
mod b {
|
||||||
pub type rust_task = bool;
|
pub type rust_task = bool;
|
||||||
pub mod rustrt {
|
pub mod rustrt {
|
||||||
|
use super::rust_task;
|
||||||
pub extern {
|
pub extern {
|
||||||
pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
|
pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +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.
|
|
||||||
|
|
||||||
// xfail-test
|
|
||||||
extern mod extra;
|
|
||||||
use extra::arena;
|
|
||||||
use extra::arena::Arena;
|
|
||||||
|
|
||||||
enum hold { s(str) }
|
|
||||||
|
|
||||||
fn init(ar: &a.arena::Arena, str: str) -> &a.hold {
|
|
||||||
new(*ar) s(str)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn main(args: ~[str]) {
|
|
||||||
let ar = arena::Arena();
|
|
||||||
let leak = init(&ar, args[0]);
|
|
||||||
match *leak {
|
|
||||||
s(astr) {
|
|
||||||
io::println(fmt!("%?", astr));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -8,23 +8,23 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
// xfail-test FIXME #2190
|
||||||
mod a {
|
mod a {
|
||||||
fn foo(f: &fn()) { f() }
|
fn foo(f: &fn()) { f() }
|
||||||
fn bar() {}
|
fn bar() {}
|
||||||
pub fn main() { foo(||bar()); }
|
pub fn main() { foo(||bar()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
mod b {
|
mod b {
|
||||||
fn foo(f: Option<&fn()>) { f.iter(|x|x()) }
|
fn foo(f: Option<&fn()>) { f.iter(|x|x()) }
|
||||||
fn bar() {}
|
fn bar() {}
|
||||||
pub fn main() { foo(Some(bar)); }
|
pub fn main() { foo(Some(bar)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
mod c {
|
mod c {
|
||||||
fn foo(f: Option<&fn()>) { f.iter(|x|x()) }
|
fn foo(f: Option<&fn()>) { f.iter(|x|x()) }
|
||||||
fn bar() {}
|
fn bar() {}
|
||||||
pub fn main() { foo(Some(||bar())); }
|
pub fn main() { foo(Some(||bar())); }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
// xfail-test FIXME #3290
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut x = ~3;
|
let mut x = ~3;
|
||||||
x = x;
|
x = x;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
// xfail-test FIXME #3796
|
||||||
#[deny(dead_assignment)];
|
#[deny(dead_assignment)];
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut x = 1;
|
let mut x = 1;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
// xfail-test FIXME #3874
|
||||||
enum PureCounter { PureCounter(uint) }
|
enum PureCounter { PureCounter(uint) }
|
||||||
|
|
||||||
fn each(self: PureCounter, blk: &fn(v: &uint)) {
|
fn each(self: PureCounter, blk: &fn(v: &uint)) {
|
||||||
|
|||||||
@@ -9,16 +9,17 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
// xfail-test
|
||||||
|
|
||||||
trait A {
|
trait A {
|
||||||
fn a_method();
|
fn a_method(&self);
|
||||||
}
|
}
|
||||||
|
|
||||||
trait B: A {
|
trait B: A {
|
||||||
fn b_method();
|
fn b_method(&self);
|
||||||
}
|
}
|
||||||
|
|
||||||
trait C: B {
|
trait C: B {
|
||||||
fn c_method() {
|
fn c_method(&self) {
|
||||||
self.a_method();
|
self.a_method();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
// xfail-test FIXME #5946
|
||||||
trait Positioned<S> {
|
trait Positioned<S> {
|
||||||
fn SetX(&mut self, S);
|
fn SetX(&mut self, S);
|
||||||
fn X(&self) -> S;
|
fn X(&self) -> S;
|
||||||
|
|||||||
@@ -8,11 +8,13 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
|
||||||
extern mod extra;
|
extern mod extra;
|
||||||
|
|
||||||
use extra::net::tcp::TcpSocketBuf;
|
use extra::net::tcp::TcpSocketBuf;
|
||||||
|
|
||||||
|
use std::io;
|
||||||
|
use std::int;
|
||||||
|
|
||||||
use std::io::{ReaderUtil,WriterUtil};
|
use std::io::{ReaderUtil,WriterUtil};
|
||||||
|
|
||||||
enum Result {
|
enum Result {
|
||||||
@@ -97,9 +99,9 @@ priv fn cmd_to_str(cmd: ~[~str]) -> ~str {
|
|||||||
let mut res = ~"*";
|
let mut res = ~"*";
|
||||||
res.push_str(cmd.len().to_str());
|
res.push_str(cmd.len().to_str());
|
||||||
res.push_str("\r\n");
|
res.push_str("\r\n");
|
||||||
for cmd.each |s| {
|
for cmd.iter().advance |s| {
|
||||||
res.push_str([~"$", s.len().to_str(), ~"\r\n",
|
res.push_str([~"$", s.len().to_str(), ~"\r\n",
|
||||||
copy *s, ~"\r\n"].concat()));
|
copy *s, ~"\r\n"].concat() );
|
||||||
}
|
}
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
use std::io;
|
||||||
|
|
||||||
fn parse_args() -> ~str {
|
fn parse_args() -> ~str {
|
||||||
let args = std::os::args();
|
let args = std::os::args();
|
||||||
let mut n = 0;
|
let mut n = 0;
|
||||||
|
|||||||
@@ -8,9 +8,11 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
use std::os;
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
for os::args().each |arg| {
|
let x = os::args();
|
||||||
|
for x.iter().advance |arg| {
|
||||||
match arg.clone() {
|
match arg.clone() {
|
||||||
s => { }
|
s => { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// xfail-test
|
|
||||||
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
@@ -10,6 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
// xfail-test
|
||||||
// aux-build:issue_3882.rc
|
// aux-build:issue_3882.rc
|
||||||
extern mod linenoise;
|
extern mod linenoise;
|
||||||
use linenoise::issue_3882::*;
|
use linenoise::issue_3882::*;
|
||||||
|
|||||||
@@ -8,9 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-fast
|
|
||||||
// xfail-test
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
'foo: loop {
|
'foo: loop {
|
||||||
loop {
|
loop {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// xfail-test
|
// FIXME #7306
|
||||||
// xfail-fast
|
// xfail-fast
|
||||||
// -*- rust -*-
|
|
||||||
|
use std::io;
|
||||||
|
|
||||||
fn f1(ref_string: &str) {
|
fn f1(ref_string: &str) {
|
||||||
match ref_string {
|
match ref_string {
|
||||||
"a" => io::println("found a"),
|
"a" => io::println("found a"),
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
// FIXME #7303: xfail-test
|
||||||
|
|
||||||
// Protocols
|
// Protocols
|
||||||
proto! foo (
|
proto! foo (
|
||||||
|
|||||||
@@ -11,23 +11,30 @@
|
|||||||
// xfail-test
|
// xfail-test
|
||||||
// This checks that preemption works.
|
// This checks that preemption works.
|
||||||
|
|
||||||
fn starve_main(alive: chan<int>) {
|
// note: halfway done porting to modern rust
|
||||||
|
extern mod extra;
|
||||||
|
|
||||||
|
use std::comm;
|
||||||
|
use extra::comm;
|
||||||
|
|
||||||
|
fn starve_main(alive: Port<int>) {
|
||||||
debug!("signalling main");
|
debug!("signalling main");
|
||||||
alive.recv(1);
|
alive.recv();
|
||||||
debug!("starving main");
|
debug!("starving main");
|
||||||
let i: int = 0;
|
let mut i: int = 0;
|
||||||
loop { i += 1; }
|
loop { i += 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let alive: port<int> = port();
|
let (port, chan) = stream();
|
||||||
|
|
||||||
debug!("main started");
|
debug!("main started");
|
||||||
let s: task = do task::spawn {
|
do spawn {
|
||||||
starve_main(chan(alive));
|
starve_main(port);
|
||||||
};
|
};
|
||||||
let i: int;
|
let mut i: int = 0;
|
||||||
debug!("main waiting for alive signal");
|
debug!("main waiting for alive signal");
|
||||||
alive.send(i);
|
chan.send(i);
|
||||||
debug!("main got alive signal");
|
debug!("main got alive signal");
|
||||||
while i < 50 { debug!("main iterated"); i += 1; }
|
while i < 50 { debug!("main iterated"); i += 1; }
|
||||||
debug!("main completed");
|
debug!("main completed");
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
// xfail-test
|
|
||||||
// xfail'd due to segfaults with by-value self.
|
|
||||||
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
@@ -15,26 +12,24 @@ trait get {
|
|||||||
fn get(self) -> int;
|
fn get(self) -> int;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: impl on a slice
|
// FIXME #7302: Note: impl on a slice
|
||||||
impl get for &'self int {
|
impl<'self> get for &'self int {
|
||||||
fn get(self) -> int {
|
fn get(self) -> int {
|
||||||
return **self;
|
return *self;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
/*
|
|
||||||
let x = @mut 6;
|
let x = @mut 6;
|
||||||
let y = x.get();
|
let y = x.get();
|
||||||
assert_eq!(y, 6);
|
assert_eq!(y, 6);
|
||||||
*/
|
|
||||||
|
|
||||||
let x = @6;
|
let x = @6;
|
||||||
let y = x.get();
|
let y = x.get();
|
||||||
debug!("y=%d", y);
|
debug!("y=%d", y);
|
||||||
assert_eq!(y, 6);
|
assert_eq!(y, 6);
|
||||||
|
|
||||||
let mut x = ~6;
|
let x = ~6;
|
||||||
let y = x.get();
|
let y = x.get();
|
||||||
debug!("y=%d", y);
|
debug!("y=%d", y);
|
||||||
assert_eq!(y, 6);
|
assert_eq!(y, 6);
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
|
||||||
|
|
||||||
fn foo(x: &[uint]) -> uint {
|
fn foo(x: &[uint]) -> uint {
|
||||||
x[0]
|
x[0]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
|
||||||
|
|
||||||
static foo: int = 4 >> 1;
|
static foo: int = 4 >> 1;
|
||||||
enum bs { thing = foo }
|
enum bs { thing = foo }
|
||||||
pub fn main() { assert!((thing as int == foo)); }
|
pub fn main() { assert!((thing as int == foo)); }
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
use std::ptr;
|
||||||
|
|
||||||
enum a_tag<A,B> {
|
enum a_tag<A,B> {
|
||||||
varA(A),
|
varA(A),
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
use std::ptr;
|
||||||
|
|
||||||
enum a_tag {
|
enum a_tag {
|
||||||
a_tag(u64)
|
a_tag(u64)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// xfail-test
|
// xfail-test FIXME #5882
|
||||||
// Weird borrow check bug
|
// Weird borrow check bug
|
||||||
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
@@ -17,45 +17,45 @@ struct Tree(@mut TreeR);
|
|||||||
struct TreeR {
|
struct TreeR {
|
||||||
left: Option<Tree>,
|
left: Option<Tree>,
|
||||||
right: Option<Tree>,
|
right: Option<Tree>,
|
||||||
val: to_str
|
val: ~to_str
|
||||||
}
|
}
|
||||||
|
|
||||||
trait to_str {
|
trait to_str {
|
||||||
fn to_str(&self) -> ~str;
|
fn to_str_(&self) -> ~str;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:to_str> to_str for Option<T> {
|
impl<T:to_str> to_str for Option<T> {
|
||||||
fn to_str(&self) -> ~str {
|
fn to_str_(&self) -> ~str {
|
||||||
match *self {
|
match *self {
|
||||||
None => { ~"none" }
|
None => { ~"none" }
|
||||||
Some(ref t) => { ~"some(" + t.to_str() + ~")" }
|
Some(ref t) => { ~"some(" + t.to_str_() + ~")" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl to_str for int {
|
impl to_str for int {
|
||||||
fn to_str(&self) -> ~str { int::str(*self) }
|
fn to_str_(&self) -> ~str { self.to_str() }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl to_str for Tree {
|
impl to_str for Tree {
|
||||||
fn to_str(&self) -> ~str {
|
fn to_str_(&self) -> ~str {
|
||||||
let l = self.left, r = self.right;
|
let (l, r) = (self.left, self.right);
|
||||||
let val = &self.val;
|
let val = &self.val;
|
||||||
fmt!("[%s, %s, %s]", val.to_str(), l.to_str(), r.to_str())
|
fmt!("[%s, %s, %s]", val.to_str_(), l.to_str_(), r.to_str_())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn foo<T:to_str>(x: T) -> ~str { x.to_str() }
|
fn foo<T:to_str>(x: T) -> ~str { x.to_str_() }
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let t1 = Tree(@mut TreeR{left: None,
|
let t1 = Tree(@mut TreeR{left: None,
|
||||||
right: None,
|
right: None,
|
||||||
val: 1 as to_str });
|
val: ~1 as ~to_str });
|
||||||
let t2 = Tree(@mut TreeR{left: Some(t1),
|
let t2 = Tree(@mut TreeR{left: Some(t1),
|
||||||
right: Some(t1),
|
right: Some(t1),
|
||||||
val: 2 as to_str });
|
val: ~2 as ~to_str });
|
||||||
let expected = ~"[2, some([1, none, none]), some([1, none, none])]";
|
let expected = ~"[2, some([1, none, none]), some([1, none, none])]";
|
||||||
assert_eq!(t2.to_str(), expected);
|
assert!(t2.to_str_() == expected);
|
||||||
assert_eq!(foo(t2 as to_str), expected);
|
assert!(foo(t2) == expected);
|
||||||
t1.left = Some(t2); // create cycle
|
t1.left = Some(t2); // create cycle
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,55 +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.
|
|
||||||
|
|
||||||
//xfail-test
|
|
||||||
|
|
||||||
// Sketching traits.
|
|
||||||
|
|
||||||
// methods with no implementation are required; methods with an
|
|
||||||
// implementation are provided. No "req" keyword necessary.
|
|
||||||
trait Eq {
|
|
||||||
fn eq(a: self) -> bool;
|
|
||||||
|
|
||||||
fn neq(a: self) -> bool {
|
|
||||||
!self.eq(a)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The `<` is pronounced `extends`. Also under consideration is `<:`.
|
|
||||||
// Just using `:` is frowned upon, because (paraphrasing dherman) `:`
|
|
||||||
// is supposed to separate things from different universes.
|
|
||||||
trait Ord < Eq {
|
|
||||||
|
|
||||||
fn lt(a: self) -> bool;
|
|
||||||
|
|
||||||
fn lte(a: self) -> bool {
|
|
||||||
self.lt(a) || self.eq(a)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn gt(a: self) -> bool {
|
|
||||||
!self.lt(a) && !self.eq(a)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn gte(a: self) -> bool {
|
|
||||||
!self.lt(a)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// pronounced "impl of Ord for int" -- not sold on this yet
|
|
||||||
impl Ord for int {
|
|
||||||
fn lt(a: &int) -> bool {
|
|
||||||
self < (*a)
|
|
||||||
}
|
|
||||||
|
|
||||||
// is this the place to put this?
|
|
||||||
fn eq(a: &int) -> bool {
|
|
||||||
self == (*a)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,15 +8,13 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-test
|
fn foo<'a>(blk: &fn(p: &'a fn() -> &'a fn())) {
|
||||||
// See #3283
|
let mut state = 0;
|
||||||
fn foo(blk: &fn(p: &'a fn() -> &'a fn())) {
|
let statep = &mut state;
|
||||||
let mut state = 0;
|
|
||||||
let statep = &mut state;
|
|
||||||
do blk {
|
do blk {
|
||||||
|| { *statep = 1; }
|
|| { *statep = 1; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn main() {
|
fn main() {
|
||||||
do foo |p| { p()() }
|
do foo |p| { p()() }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user