Skip to content

Commit 9b481f8

Browse files
committed
Auto merge of #25056 - jooert:sometests, r=alexcrichton
Add several regression tests and remove some unnecessary FIXMEs.
2 parents 70db766 + e7d052e commit 9b481f8

23 files changed

+211
-41
lines changed

src/test/auxiliary/issue-19163.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![crate_type = "lib"]
12+
13+
#[macro_export]
14+
macro_rules! mywrite {
15+
($dst:expr, $($arg:tt)*) => ($dst.write_fmt(format_args!($($arg)*)))
16+
}

src/test/compile-fail/issue-12511.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
trait t1 : t2 {
12+
//~^ ERROR: unsupported cyclic reference between types/traits detected
13+
}
14+
15+
trait t2 : t1 {
16+
//~^ ERROR: unsupported cyclic reference between types/traits detected
17+
}
18+
19+
fn main() { }

src/test/compile-fail/issue-17959.rs

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
extern crate core;
12+
13+
use core::ops::Drop;
14+
15+
trait Bar {}
16+
17+
struct G<T: ?Sized> {
18+
_ptr: *const T
19+
}
20+
21+
impl<T> Drop for G<T> {
22+
//~^ ERROR: The requirement `T : core::marker::Sized` is added only by the Drop impl. [E0367]
23+
fn drop(&mut self) {
24+
if !self._ptr.is_null() {
25+
}
26+
}
27+
}
28+
29+
fn main() {
30+
let x:G<Bar>;
31+
}

src/test/compile-fail/issue-19109.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
trait Trait { }
12+
13+
fn function(t: &mut Trait) {
14+
t as *mut Trait
15+
//~^ ERROR: mismatched types:
16+
//~| expected `()`,
17+
//~| found `*mut Trait`
18+
//~| (expected (),
19+
//~| found *-ptr) [E0308]
20+
}
21+
22+
fn main() { }

src/test/compile-fail/issue-19163.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:issue-19163.rs
12+
13+
#[macro_use] extern crate issue_19163;
14+
15+
use std::io::Write;
16+
17+
fn main() {
18+
let mut v = vec![];
19+
mywrite!(&v, "Hello world");
20+
//~^ error: cannot borrow immutable borrowed content as mutable
21+
}

src/test/compile-fail/issue-19380.rs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
trait Qiz {
12+
fn qiz();
13+
}
14+
15+
struct Foo;
16+
impl Qiz for Foo {
17+
fn qiz() {}
18+
}
19+
20+
struct Bar {
21+
foos: &'static [&'static (Qiz + 'static)]
22+
}
23+
24+
const FOO : Foo = Foo;
25+
const BAR : Bar = Bar { foos: &[&FOO]};
26+
//~^ ERROR: cannot convert to a trait object because trait `Qiz` is not object-safe [E0038]
27+
28+
fn main() { }
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-include ../tools.mk
2+
3+
# Regression test for ICE #18943 when compiling as lib
4+
5+
all:
6+
$(RUSTC) foo.rs --crate-type lib
7+
$(call REMOVE_RLIBS,foo) && exit 0 || exit 1

src/test/run-make/issue-18943/foo.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
trait Foo { }
12+
13+
trait Bar { }
14+
15+
impl<'a> Foo for Bar + 'a { }
16+

src/test/run-pass/associated-types-impl-redirect.rs

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
// for `ByRef`. The right answer was to consider the result ambiguous
1515
// until more type information was available.
1616

17-
// ignore-pretty -- FIXME(#17362)
18-
1917
#![feature(lang_items, unboxed_closures)]
2018
#![no_implicit_prelude]
2119

src/test/run-pass/associated-types-where-clause-impl-ambiguity.rs

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
// for `ByRef`. The right answer was to consider the result ambiguous
1515
// until more type information was available.
1616

17-
// ignore-pretty -- FIXME(#17362) pretty prints with `<<` which lexes wrong
18-
1917
#![feature(lang_items, unboxed_closures)]
2018
#![no_implicit_prelude]
2119

src/test/run-pass/deriving-cmp-generic-struct-enum.rs

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// no-pretty-expanded FIXME #15189
12-
13-
1411
#[derive(PartialEq, Eq, PartialOrd, Ord)]
1512
enum ES<T> {
1613
ES1 { x: T },

src/test/run-pass/deriving-cmp-generic-struct.rs

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// no-pretty-expanded FIXME #15189
12-
13-
1411
#[derive(PartialEq, Eq, PartialOrd, Ord)]
1512
struct S<T> {
1613
x: T,

src/test/run-pass/deriving-cmp-generic-tuple-struct.rs

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// no-pretty-expanded FIXME #15189
12-
13-
1411
#[derive(PartialEq, Eq, PartialOrd, Ord)]
1512
struct TS<T>(T,T);
1613

src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// ignore-test FIXME #11820: & is unreliable in deriving
12-
1311
use std::cmp::Ordering::{Less,Equal,Greater};
1412

15-
#[derive(Eq,Ord)]
13+
#[derive(PartialEq, Eq, PartialOrd, Ord)]
1614
struct A<'a> {
1715
x: &'a isize
1816
}

src/test/run-pass/generic-recursive-tag.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// ignore-pretty FIXME(#14193)
12-
1311
#![allow(unknown_features)]
1412
#![feature(box_syntax)]
1513

src/test/run-pass/issue-14564.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
mod Foo { }
12+
struct Foo;
13+
impl Foo { }
14+
15+
fn main() { }

src/test/run-pass/issue-17170.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(simd)]
12+
13+
#[simd]
14+
struct T(f64, f64, f64);
15+
16+
static X: T = T(0.0, 0.0, 0.0);
17+
18+
fn main() {
19+
let _ = X;
20+
}

src/test/run-pass/issue-19081.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// ignore-pretty -- FIXME(#17362) pretty prints as `Hash<<Self as Hasher...` which fails to parse
12-
1311
pub trait Hasher {
1412
type State;
1513

src/test/run-pass/last-use-in-cap-clause.rs

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ struct A { a: Box<isize> }
2020
fn foo() -> Box<FnMut() -> isize + 'static> {
2121
let k: Box<_> = box 22;
2222
let _u = A {a: k.clone()};
23-
// FIXME(#16640) suffix in `22` suffix shouldn't be necessary
2423
let result = || 22;
2524
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
2625
Box::new(result)

src/test/run-pass/ufcs-polymorphic-paths.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ use std::default::Default;
1717
use std::iter::FromIterator;
1818
use std::ops::Add;
1919
use std::option::IntoIter as OptionIter;
20-
// FIXME the glob std::prelude::*; import of Vec is missing non-static inherent
21-
// methods.
22-
use std::vec::Vec;
2320

2421
pub struct XorShiftRng;
2522
use XorShiftRng as DummyRng;
@@ -81,11 +78,10 @@ tests! {
8178
Vec::map_in_place, fn(Vec<u8>, fn(u8) -> i8) -> Vec<i8>, (vec![b'f', b'o', b'o'], u8_as_i8);
8279
Vec::map_in_place::<i8, fn(u8) -> i8>, fn(Vec<u8>, fn(u8) -> i8) -> Vec<i8>,
8380
(vec![b'f', b'o', b'o'], u8_as_i8);
84-
// FIXME these break with "type parameter might not appear here pointing at `<u8>`.
85-
// Vec::<u8>::map_in_place: fn(Vec<u8>, fn(u8) -> i8) -> Vec<i8>
86-
// , (vec![b'f', b'o', b'o'], u8_as_i8);
87-
// Vec::<u8>::map_in_place::<i8, fn(u8) -> i8>: fn(Vec<u8>, fn(u8) -> i8) -> Vec<i8>
88-
// , (vec![b'f', b'o', b'o'], u8_as_i8);
81+
Vec::<u8>::map_in_place, fn(Vec<u8>, fn(u8) -> i8) -> Vec<i8>
82+
, (vec![b'f', b'o', b'o'], u8_as_i8);
83+
Vec::<u8>::map_in_place::<i8, fn(u8) -> i8>, fn(Vec<u8>, fn(u8) -> i8) -> Vec<i8>
84+
, (vec![b'f', b'o', b'o'], u8_as_i8);
8985

9086
// Trait static methods.
9187
bool::size, fn() -> usize, ();

src/test/run-pass/unfold-cross-crate.rs

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// no-pretty-expanded FIXME #15189
12-
13-
1411
#![feature(core)]
1512

1613
use std::iter::Unfold;

src/test/run-pass/utf8.rs

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
//
11-
// no-pretty-expanded FIXME #15189
1210

1311
pub fn main() {
1412
let yen: char = '¥'; // 0xa5

src/test/run-pass/vec-fixed-length.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,22 @@
1111

1212
use std::mem::size_of;
1313

14-
pub fn main() {
14+
#[cfg(not(target_pointer_width = "64"))]
15+
fn test_big_vec() {}
16+
17+
#[cfg(target_pointer_width = "64")]
18+
fn test_big_vec()
19+
{
20+
assert_eq!(size_of::<[u8; (1 << 32)]>(), (1 << 32));
21+
}
22+
23+
fn main() {
1524
let x: [isize; 4] = [1, 2, 3, 4];
1625
assert_eq!(x[0], 1);
1726
assert_eq!(x[1], 2);
1827
assert_eq!(x[2], 3);
1928
assert_eq!(x[3], 4);
2029

2130
assert_eq!(size_of::<[u8; 4]>(), 4);
22-
23-
// FIXME #10183
24-
// FIXME #18069
25-
//if cfg!(target_pointer_width = "64") {
26-
// assert_eq!(size_of::<[u8; (1 << 32)]>(), (1 << 32));
27-
//}
31+
test_big_vec();
2832
}

0 commit comments

Comments
 (0)