Skip to content

Un-xfail & add some tests. #8932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/test/compile-fail/arc-cant-nest-rw-arc-3177.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test
// error-pattern: instantiating a type parameter with an incompatible type
extern mod extra;
use extra::arc::rw_arc;
use extra::arc::RWArc;

fn main() {
let arc1 = ~rw_arc(true);
let _arc2 = ~rw_arc(arc1);
let arc1 = RWArc::new(true);
let _arc2 = RWArc::new(arc1); //~ ERROR instantiating a type parameter with an incompatible type
}
29 changes: 0 additions & 29 deletions src/test/compile-fail/bind-by-move-no-lvalues-2.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// xfail-test #3024
// 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.
Expand All @@ -20,7 +19,7 @@ impl Drop for X {
}

fn unwrap(x: X) -> ~str {
let X { x: y } = x; //~ ERROR cannot bind by-move within struct
let X { x: y } = x; //~ ERROR cannot move out of type
y
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,19 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test
// issue 7327

struct X { x: (), }
// xfail-fast #7103
extern mod extra;
use extra::arc::*;

impl Drop for X {
fn drop(&self) {
error!("destructor runs");
}
}
struct A { y: Arc<int>, x: Arc<int> }

impl Drop for A {
fn drop(&self) { println(fmt!("x=%?", self.x.get())); }
}
fn main() {
let x = Some(X { x: () });
match x {
Some(_z) => { }, //~ ERROR cannot bind by-move when matching an lvalue
None => fail!()
}
let a = A { y: Arc::new(1), x: Arc::new(2) };
let _b = A { y: Arc::new(3), ..a };
let _c = a; //~ ERROR use of moved value
}
3 changes: 1 addition & 2 deletions src/test/compile-fail/issue-2951.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test
fn foo<T, U>(x: T, y: U) {
let mut xx = x;
xx = y; // error message should mention T and U, not 'a and 'b
xx = y; //~ ERROR expected `T` but found `U`
}

fn main() {
Expand Down
5 changes: 2 additions & 3 deletions src/test/compile-fail/issue-3080.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test
struct x(());
impl x {
pub unsafe fn with() { } // This should fail
pub unsafe fn with(&self) { }
}

fn main() {
x(()).with();
x(()).with(); //~ ERROR requires unsafe function or block
}
2 changes: 2 additions & 0 deletions src/test/compile-fail/issue-3973.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
// except according to those terms.

// xfail-test
use std::io;

struct Point {
x: float,
y: float,
Expand Down
3 changes: 1 addition & 2 deletions src/test/compile-fail/issue-5062.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test
fn main() { fmt!("%?", None); } //~ ERROR can't resolve type variable
fn main() { fmt!("%?", None); } //~ ERROR unconstrained type
4 changes: 1 addition & 3 deletions src/test/compile-fail/issue-6977.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//xfail-test

// Trying to create a fixed-length vector with a negative size

fn main() {
let _x = [0,..-1];
let _x = [0,..-1]; //~ ERROR found negative integer
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/view-items-at-top.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern mod extra;
fn f() {
}

use extra::net; //~ ERROR view items must be declared at the top
use extra::net; //~ ERROR `use` and `extern mod` declarations must precede items

fn main() {
}
1 change: 0 additions & 1 deletion src/test/run-pass/autoderef-method-priority.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// xfail-test #5321
// 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.
Expand Down
14 changes: 6 additions & 8 deletions src/test/run-pass/deriving-cmp-generic-struct-enum.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// xfail-test #5530

// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
Expand All @@ -18,18 +16,18 @@ enum ES<T> {


pub fn main() {
let es11 = ES1 {x: 1}, es12 = ES1 {x: 2}, es21 = ES2 {x: 1, y: 1}, es22 = ES2 {x: 1, y: 2};
let (es11, es12, es21, es22) = (ES1 {x: 1}, ES1 {x: 2}, ES2 {x: 1, y: 1}, ES2 {x: 1, y: 2});

// in order for both Ord and TotalOrd
let ess = [es11, es12, es21, es22];

for ess.eachi |i, es1| {
for ess.eachi |j, es2| {
for (i, es1) in ess.iter().enumerate() {
for (j, es2) in ess.iter().enumerate() {
let ord = i.cmp(&j);

let eq = i == j;
let lt = i < j, le = i <= j;
let gt = i > j, ge = i >= j;
let (lt, le) = (i < j, i <= j);
let (gt, ge) = (i > j, i >= j);

// Eq
assert_eq!(*es1 == *es2, eq);
Expand All @@ -49,4 +47,4 @@ pub fn main() {
assert_eq!(es1.cmp(es2), ord);
}
}
}
}
3 changes: 1 addition & 2 deletions src/test/run-pass/estr-shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test
pub fn main() {
let x : @str = @"hello";
let _x : @str = @"hello";
}
5 changes: 3 additions & 2 deletions src/test/run-pass/extern-pass-TwoU16s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test #5744 fails on 32 bit

// Test a foreign function that accepts and returns a struct
// by value.

// xfail-test #5744

#[deriving(Eq)]
struct TwoU16s {
one: u16, two: u16
Expand All @@ -22,6 +22,7 @@ extern {
pub fn rust_dbg_extern_identity_TwoU16s(v: TwoU16s) -> TwoU16s;
}

#[fixed_stack_segment] #[inline(never)]
pub fn main() {
unsafe {
let x = TwoU16s {one: 22, two: 23};
Expand Down
5 changes: 3 additions & 2 deletions src/test/run-pass/extern-pass-TwoU8s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test #5744 fails on 32 bit

// Test a foreign function that accepts and returns a struct
// by value.

// xfail-test #5744

#[deriving(Eq)]
struct TwoU8s {
one: u8, two: u8
Expand All @@ -22,6 +22,7 @@ extern {
pub fn rust_dbg_extern_identity_TwoU8s(v: TwoU8s) -> TwoU8s;
}

#[fixed_stack_segment] #[inline(never)]
pub fn main() {
unsafe {
let x = TwoU8s {one: 22, two: 23};
Expand Down
5 changes: 3 additions & 2 deletions src/test/run-pass/issue-1516.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test
pub fn main() { let early_error: @fn(str) -> ! = {|msg| fail!() }; }
pub fn main() {
let early_error: @fn(&str) -> ! = |_msg| { fail!() };
}
1 change: 0 additions & 1 deletion src/test/run-pass/issue-3794.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test
trait T {
fn print(&self);
}
Expand Down
5 changes: 2 additions & 3 deletions src/test/run-pass/issue-3874.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test FIXME #3874
enum PureCounter { PureCounter(uint) }

fn each(self: PureCounter, blk: &fn(v: &uint)) {
let PureCounter(ref x) = self;
fn each(thing: PureCounter, blk: &fn(v: &uint)) {
let PureCounter(ref x) = thing;
blk(x);
}

Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/issue-3895.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test
pub fn main() {
enum State { BadChar, BadSyntax }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test
struct HasNested {
mut nest: ~[~[int]],
nest: ~[~[int]],
}

impl HasNested {
fn method_push_local(&self) {
fn method_push_local(&mut self) {
self.nest[0].push(0);
}
}
Expand Down
32 changes: 32 additions & 0 deletions src/test/run-pass/issue-4025.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2013 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.

/*
# if b { x } else { y } requires identical types for x and y
*/

fn print1(b: bool, s1: &str, s2: &str) {
println(if b { s1 } else { s2 });
}
fn print2<'a, 'b>(b: bool, s1: &'a str, s2: &'b str) {
println(if b { s1 } else { s2 });
}
fn print3(b: bool, s1: &str, s2: &str) {
let mut s: &str;
if b { s = s1; } else { s = s2; }
println(s);
}
fn print4<'a, 'b>(b: bool, s1: &'a str, s2: &'b str) {
let mut s: &str;
if b { s = s1; } else { s = s2; }
println(s);
}

pub fn main() {}
2 changes: 0 additions & 2 deletions src/test/run-pass/issue-5280.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test

type FontTableTag = u32;

trait FontTableTagConversions {
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/issue-5315.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-test
struct A(bool);

fn main() {
Expand Down
26 changes: 26 additions & 0 deletions src/test/run-pass/issue-5688.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2013 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.

/*
# Corrupted initialization in the static struct

...should print &[1, 2, 3] but instead prints something like
&[4492532864, 24]. It is pretty evident that the compiler messed up
with the representation of [int, ..n] and [int] somehow, or at least
failed to typecheck correctly.
*/

struct X { vec: &'static [int] }
static V: &'static [X] = &[X { vec: &[1, 2, 3] }];
fn main() {
for &v in V.iter() {
println(fmt!("%?", v.vec));
}
}
Loading