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

Lines changed: 16 additions & 0 deletions
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

Lines changed: 19 additions & 0 deletions
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

Lines changed: 31 additions & 0 deletions
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

Lines changed: 22 additions & 0 deletions
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

Lines changed: 21 additions & 0 deletions
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

Lines changed: 28 additions & 0 deletions
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() { }
Lines changed: 7 additions & 0 deletions
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

Lines changed: 16 additions & 0 deletions
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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 0 additions & 2 deletions
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

0 commit comments

Comments
 (0)