Skip to content

Commit

Permalink
Rollup merge of rust-lang#66407 - JohnTitor:add-ice-tests, r=Centril
Browse files Browse the repository at this point in the history
Add more tests for fixed ICEs

Closes rust-lang#36122 (fixed in 1.20.0)
Closes rust-lang#58094 (fixed in rust-lang#66054)
Also, fix mistaken test case, from rust-lang#30904 to rust-lang#30906 (cc @eddyb)

r? @Centril
  • Loading branch information
Centril authored Nov 15, 2019
2 parents 12065b1 + 614abe4 commit e2aa473
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 60 deletions.
6 changes: 6 additions & 0 deletions src/test/ui/extern/issue-36122-accessing-externed-dst.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fn main() {
extern {
static symbol: [usize]; //~ ERROR: the size for values of type
}
println!("{}", symbol[0]);
}
12 changes: 12 additions & 0 deletions src/test/ui/extern/issue-36122-accessing-externed-dst.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0277]: the size for values of type `[usize]` cannot be known at compilation time
--> $DIR/issue-36122-accessing-externed-dst.rs:3:24
|
LL | static symbol: [usize];
| ^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[usize]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Fixed in #66054.
// ignore-tidy-trailing-newlines
// error-pattern: aborting due to 2 previous errors
#[Ѕ
16 changes: 16 additions & 0 deletions src/test/ui/parser/issue-58094-missing-right-square-bracket.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error: this file contains an un-closed delimiter
--> $DIR/issue-58094-missing-right-square-bracket.rs:4:4
|
LL | #[Ѕ
| - ^
| |
| un-closed delimiter

error: expected item after attributes
--> $DIR/issue-58094-missing-right-square-bracket.rs:4:4
|
LL | #[Ѕ
| ^

error: aborting due to 2 previous errors

36 changes: 0 additions & 36 deletions src/test/ui/unboxed-closures/issue-30904.rs

This file was deleted.

24 changes: 0 additions & 24 deletions src/test/ui/unboxed-closures/issue-30904.stderr

This file was deleted.

8 changes: 8 additions & 0 deletions src/test/ui/unboxed-closures/issue-30906.nll.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: higher-ranked subtype error
--> $DIR/issue-30906.rs:15:5
|
LL | test(Compose(f, |_| {}));
| ^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

18 changes: 18 additions & 0 deletions src/test/ui/unboxed-closures/issue-30906.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#![feature(fn_traits, unboxed_closures)]

fn test<F: for<'x> FnOnce<(&'x str,)>>(_: F) {}

struct Compose<F,G>(F,G);
impl<T,F,G> FnOnce<(T,)> for Compose<F,G>
where F: FnOnce<(T,)>, G: FnOnce<(F::Output,)> {
type Output = G::Output;
extern "rust-call" fn call_once(self, (x,): (T,)) -> G::Output {
(self.1)((self.0)(x))
}
}

fn bad<T>(f: fn(&'static str) -> T) {
test(Compose(f, |_| {})); //~ ERROR: mismatched types
}

fn main() {}
12 changes: 12 additions & 0 deletions src/test/ui/unboxed-closures/issue-30906.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0308]: mismatched types
--> $DIR/issue-30906.rs:15:5
|
LL | test(Compose(f, |_| {}));
| ^^^^ one type is more general than the other
|
= note: expected type `std::ops::FnOnce<(&'x str,)>`
found type `std::ops::FnOnce<(&str,)>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.

0 comments on commit e2aa473

Please sign in to comment.