Skip to content

Commit

Permalink
Auto merge of #25056 - jooert:sometests, r=alexcrichton
Browse files Browse the repository at this point in the history
Add several regression tests and remove some unnecessary FIXMEs.
  • Loading branch information
bors committed May 4, 2015
2 parents 70db766 + e7d052e commit 9b481f8
Show file tree
Hide file tree
Showing 23 changed files with 211 additions and 41 deletions.
16 changes: 16 additions & 0 deletions src/test/auxiliary/issue-19163.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 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.

#![crate_type = "lib"]

#[macro_export]
macro_rules! mywrite {
($dst:expr, $($arg:tt)*) => ($dst.write_fmt(format_args!($($arg)*)))
}
19 changes: 19 additions & 0 deletions src/test/compile-fail/issue-12511.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 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.

trait t1 : t2 {
//~^ ERROR: unsupported cyclic reference between types/traits detected
}

trait t2 : t1 {
//~^ ERROR: unsupported cyclic reference between types/traits detected
}

fn main() { }
31 changes: 31 additions & 0 deletions src/test/compile-fail/issue-17959.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 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.

extern crate core;

use core::ops::Drop;

trait Bar {}

struct G<T: ?Sized> {
_ptr: *const T
}

impl<T> Drop for G<T> {
//~^ ERROR: The requirement `T : core::marker::Sized` is added only by the Drop impl. [E0367]
fn drop(&mut self) {
if !self._ptr.is_null() {
}
}
}

fn main() {
let x:G<Bar>;
}
22 changes: 22 additions & 0 deletions src/test/compile-fail/issue-19109.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 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.

trait Trait { }

fn function(t: &mut Trait) {
t as *mut Trait
//~^ ERROR: mismatched types:
//~| expected `()`,
//~| found `*mut Trait`
//~| (expected (),
//~| found *-ptr) [E0308]
}

fn main() { }
21 changes: 21 additions & 0 deletions src/test/compile-fail/issue-19163.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 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.

// aux-build:issue-19163.rs

#[macro_use] extern crate issue_19163;

use std::io::Write;

fn main() {
let mut v = vec![];
mywrite!(&v, "Hello world");
//~^ error: cannot borrow immutable borrowed content as mutable
}
28 changes: 28 additions & 0 deletions src/test/compile-fail/issue-19380.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 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.

trait Qiz {
fn qiz();
}

struct Foo;
impl Qiz for Foo {
fn qiz() {}
}

struct Bar {
foos: &'static [&'static (Qiz + 'static)]
}

const FOO : Foo = Foo;
const BAR : Bar = Bar { foos: &[&FOO]};
//~^ ERROR: cannot convert to a trait object because trait `Qiz` is not object-safe [E0038]

fn main() { }
7 changes: 7 additions & 0 deletions src/test/run-make/issue-18943/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-include ../tools.mk

# Regression test for ICE #18943 when compiling as lib

all:
$(RUSTC) foo.rs --crate-type lib
$(call REMOVE_RLIBS,foo) && exit 0 || exit 1
16 changes: 16 additions & 0 deletions src/test/run-make/issue-18943/foo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 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.

trait Foo { }

trait Bar { }

impl<'a> Foo for Bar + 'a { }

2 changes: 0 additions & 2 deletions src/test/run-pass/associated-types-impl-redirect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
// for `ByRef`. The right answer was to consider the result ambiguous
// until more type information was available.

// ignore-pretty -- FIXME(#17362)

#![feature(lang_items, unboxed_closures)]
#![no_implicit_prelude]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
// for `ByRef`. The right answer was to consider the result ambiguous
// until more type information was available.

// ignore-pretty -- FIXME(#17362) pretty prints with `<<` which lexes wrong

#![feature(lang_items, unboxed_closures)]
#![no_implicit_prelude]

Expand Down
3 changes: 0 additions & 3 deletions src/test/run-pass/deriving-cmp-generic-struct-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// no-pretty-expanded FIXME #15189


#[derive(PartialEq, Eq, PartialOrd, Ord)]
enum ES<T> {
ES1 { x: T },
Expand Down
3 changes: 0 additions & 3 deletions src/test/run-pass/deriving-cmp-generic-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// no-pretty-expanded FIXME #15189


#[derive(PartialEq, Eq, PartialOrd, Ord)]
struct S<T> {
x: T,
Expand Down
3 changes: 0 additions & 3 deletions src/test/run-pass/deriving-cmp-generic-tuple-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// no-pretty-expanded FIXME #15189


#[derive(PartialEq, Eq, PartialOrd, Ord)]
struct TS<T>(T,T);

Expand Down
4 changes: 1 addition & 3 deletions src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// ignore-test FIXME #11820: & is unreliable in deriving

use std::cmp::Ordering::{Less,Equal,Greater};

#[derive(Eq,Ord)]
#[derive(PartialEq, Eq, PartialOrd, Ord)]
struct A<'a> {
x: &'a isize
}
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/generic-recursive-tag.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.

// ignore-pretty FIXME(#14193)

#![allow(unknown_features)]
#![feature(box_syntax)]

Expand Down
15 changes: 15 additions & 0 deletions src/test/run-pass/issue-14564.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 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.

mod Foo { }
struct Foo;
impl Foo { }

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

#![feature(simd)]

#[simd]
struct T(f64, f64, f64);

static X: T = T(0.0, 0.0, 0.0);

fn main() {
let _ = X;
}
2 changes: 0 additions & 2 deletions src/test/run-pass/issue-19081.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.

// ignore-pretty -- FIXME(#17362) pretty prints as `Hash<<Self as Hasher...` which fails to parse

pub trait Hasher {
type State;

Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/last-use-in-cap-clause.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ struct A { a: Box<isize> }
fn foo() -> Box<FnMut() -> isize + 'static> {
let k: Box<_> = box 22;
let _u = A {a: k.clone()};
// FIXME(#16640) suffix in `22` suffix shouldn't be necessary
let result = || 22;
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
Box::new(result)
Expand Down
12 changes: 4 additions & 8 deletions src/test/run-pass/ufcs-polymorphic-paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ use std::default::Default;
use std::iter::FromIterator;
use std::ops::Add;
use std::option::IntoIter as OptionIter;
// FIXME the glob std::prelude::*; import of Vec is missing non-static inherent
// methods.
use std::vec::Vec;

pub struct XorShiftRng;
use XorShiftRng as DummyRng;
Expand Down Expand Up @@ -81,11 +78,10 @@ tests! {
Vec::map_in_place, fn(Vec<u8>, fn(u8) -> i8) -> Vec<i8>, (vec![b'f', b'o', b'o'], u8_as_i8);
Vec::map_in_place::<i8, fn(u8) -> i8>, fn(Vec<u8>, fn(u8) -> i8) -> Vec<i8>,
(vec![b'f', b'o', b'o'], u8_as_i8);
// FIXME these break with "type parameter might not appear here pointing at `<u8>`.
// Vec::<u8>::map_in_place: fn(Vec<u8>, fn(u8) -> i8) -> Vec<i8>
// , (vec![b'f', b'o', b'o'], u8_as_i8);
// Vec::<u8>::map_in_place::<i8, fn(u8) -> i8>: fn(Vec<u8>, fn(u8) -> i8) -> Vec<i8>
// , (vec![b'f', b'o', b'o'], u8_as_i8);
Vec::<u8>::map_in_place, fn(Vec<u8>, fn(u8) -> i8) -> Vec<i8>
, (vec![b'f', b'o', b'o'], u8_as_i8);
Vec::<u8>::map_in_place::<i8, fn(u8) -> i8>, fn(Vec<u8>, fn(u8) -> i8) -> Vec<i8>
, (vec![b'f', b'o', b'o'], u8_as_i8);

// Trait static methods.
bool::size, fn() -> usize, ();
Expand Down
3 changes: 0 additions & 3 deletions src/test/run-pass/unfold-cross-crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// no-pretty-expanded FIXME #15189


#![feature(core)]

use std::iter::Unfold;
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/utf8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// <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.
//
// no-pretty-expanded FIXME #15189

pub fn main() {
let yen: char = '¥'; // 0xa5
Expand Down
18 changes: 11 additions & 7 deletions src/test/run-pass/vec-fixed-length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,22 @@

use std::mem::size_of;

pub fn main() {
#[cfg(not(target_pointer_width = "64"))]
fn test_big_vec() {}

#[cfg(target_pointer_width = "64")]
fn test_big_vec()
{
assert_eq!(size_of::<[u8; (1 << 32)]>(), (1 << 32));
}

fn main() {
let x: [isize; 4] = [1, 2, 3, 4];
assert_eq!(x[0], 1);
assert_eq!(x[1], 2);
assert_eq!(x[2], 3);
assert_eq!(x[3], 4);

assert_eq!(size_of::<[u8; 4]>(), 4);

// FIXME #10183
// FIXME #18069
//if cfg!(target_pointer_width = "64") {
// assert_eq!(size_of::<[u8; (1 << 32)]>(), (1 << 32));
//}
test_big_vec();
}

0 comments on commit 9b481f8

Please sign in to comment.