Skip to content

Commit a73627e

Browse files
authored
Rollup merge of rust-lang#52558 - wesleywiser:ice_melting, r=estebank
Add tests for ICEs which no longer repro Adds tests for some ICEs which no longer repro and closes the associated issues.
2 parents 20fb948 + 3e0cb23 commit a73627e

9 files changed

+210
-0
lines changed

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

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2018 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+
#![allow(dead_code, non_upper_case_globals)]
12+
#![feature(asm)]
13+
14+
#[repr(C)]
15+
pub struct D32x4(f32,f32,f32,f32);
16+
17+
impl D32x4 {
18+
fn add(&self, vec: Self) -> Self {
19+
unsafe {
20+
let ret: Self;
21+
asm!("
22+
movaps $1, %xmm1
23+
movaps $2, %xmm2
24+
addps %xmm1, %xmm2
25+
movaps $xmm1, $0
26+
"
27+
: "=r"(ret)
28+
: "1"(self), "2"(vec)
29+
: "xmm1", "xmm2"
30+
);
31+
ret
32+
}
33+
}
34+
}
35+
36+
fn main() { }
37+

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

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2018 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+
const C: *const u8 = &0;
12+
13+
fn foo(x: *const u8) {
14+
match x {
15+
C => {}
16+
_ => {}
17+
}
18+
}
19+
20+
fn main() {}
21+

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

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2018 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+
pub trait Foo<'a> {
12+
type Bar;
13+
fn foo(&'a self) -> Self::Bar;
14+
}
15+
16+
impl<'a, 'b, T: 'a> Foo<'a> for &'b T {
17+
type Bar = &'a T;
18+
fn foo(&'a self) -> &'a T {
19+
self
20+
}
21+
}
22+
23+
pub fn uncallable<T, F>(x: T, f: F)
24+
where T: for<'a> Foo<'a>,
25+
F: for<'a> Fn(<T as Foo<'a>>::Bar)
26+
{
27+
f(x.foo());
28+
}
29+
30+
pub fn catalyst(x: &i32) {
31+
broken(x, |_| {})
32+
}
33+
34+
pub fn broken<F: Fn(&i32)>(x: &i32, f: F) {
35+
uncallable(x, |y| f(y));
36+
}
37+
38+
fn main() { }
39+

src/test/ui/issue-34784.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2018 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+
const C: *const [u8; 4] = b"abcd";
12+
13+
fn main() {
14+
match C {
15+
C => {}
16+
//~^ ERROR this expression will panic at runtime
17+
_ => {}
18+
}
19+
}
20+

src/test/ui/issue-34784.stderr

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: this expression will panic at runtime
2+
--> $DIR/issue-34784.rs:15:9
3+
|
4+
LL | C => {}
5+
| ^ "pointer arithmetic or comparison" needs an rfc before being allowed inside constants
6+
|
7+
= note: #[deny(const_err)] on by default
8+
9+
error: aborting due to previous error
10+

src/test/ui/issue-42060.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2018 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+
fn main() {
12+
let thing = ();
13+
let other: typeof(thing) = thing; //~ ERROR attempt to use a non-constant value in a constant
14+
//~^ ERROR `typeof` is a reserved keyword but unimplemented [E0516]
15+
}
16+
17+
fn f(){
18+
let q = 1;
19+
<typeof(q)>::N //~ ERROR attempt to use a non-constant value in a constant
20+
//~^ ERROR `typeof` is a reserved keyword but unimplemented [E0516]
21+
}
22+

src/test/ui/issue-42060.stderr

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
error[E0435]: attempt to use a non-constant value in a constant
2+
--> $DIR/issue-42060.rs:13:23
3+
|
4+
LL | let other: typeof(thing) = thing; //~ ERROR attempt to use a non-constant value in a constant
5+
| ^^^^^ non-constant value
6+
7+
error[E0435]: attempt to use a non-constant value in a constant
8+
--> $DIR/issue-42060.rs:19:13
9+
|
10+
LL | <typeof(q)>::N //~ ERROR attempt to use a non-constant value in a constant
11+
| ^ non-constant value
12+
13+
error[E0516]: `typeof` is a reserved keyword but unimplemented
14+
--> $DIR/issue-42060.rs:13:16
15+
|
16+
LL | let other: typeof(thing) = thing; //~ ERROR attempt to use a non-constant value in a constant
17+
| ^^^^^^^^^^^^^ reserved keyword
18+
19+
error[E0516]: `typeof` is a reserved keyword but unimplemented
20+
--> $DIR/issue-42060.rs:19:6
21+
|
22+
LL | <typeof(q)>::N //~ ERROR attempt to use a non-constant value in a constant
23+
| ^^^^^^^^^ reserved keyword
24+
25+
error: aborting due to 4 previous errors
26+
27+
Some errors occurred: E0435, E0516.
28+
For more information about an error, try `rustc --explain E0435`.

src/test/ui/issue-43196.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2018 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+
fn main() {
12+
|
13+
}
14+
//~^ ERROR expected `|`, found `}`
15+
|
16+
//~^ ERROR expected item, found `|`
17+

src/test/ui/issue-43196.stderr

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error: expected `|`, found `}`
2+
--> $DIR/issue-43196.rs:13:1
3+
|
4+
LL | |
5+
| - expected `|` here
6+
LL | }
7+
| ^ unexpected token
8+
9+
error: expected item, found `|`
10+
--> $DIR/issue-43196.rs:15:1
11+
|
12+
LL | |
13+
| ^ expected item
14+
15+
error: aborting due to 2 previous errors
16+

0 commit comments

Comments
 (0)