Skip to content

Commit 55c3b8e

Browse files
Update compile-fail tests.
1 parent 9fd4be9 commit 55c3b8e

File tree

6 files changed

+36
-33
lines changed

6 files changed

+36
-33
lines changed

src/test/compile-fail/E0534.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@
1111
#[inline()] //~ ERROR E0534
1212
pub fn something() {}
1313

14-
fn main() {}
14+
fn main() {
15+
something();
16+
}

src/test/compile-fail/bad-intrinsic-monomorphization.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#![feature(repr_simd, platform_intrinsics, core_intrinsics)]
1212
#![allow(warnings)]
13+
#![crate_type = "rlib"]
1314

1415
// Bad monomorphizations could previously cause LLVM asserts even though the
1516
// error was caught in the compiler.
@@ -21,21 +22,19 @@ extern "platform-intrinsic" {
2122
use std::intrinsics;
2223

2324
#[derive(Copy, Clone)]
24-
struct Foo(i64);
25+
pub struct Foo(i64);
2526

26-
unsafe fn test_cttz(v: Foo) -> Foo {
27+
pub unsafe fn test_cttz(v: Foo) -> Foo {
2728
intrinsics::cttz(v)
2829
//~^ ERROR `cttz` intrinsic: expected basic integer type, found `Foo`
2930
}
3031

31-
unsafe fn test_fadd_fast(a: Foo, b: Foo) -> Foo {
32+
pub unsafe fn test_fadd_fast(a: Foo, b: Foo) -> Foo {
3233
intrinsics::fadd_fast(a, b)
3334
//~^ ERROR `fadd_fast` intrinsic: expected basic float type, found `Foo`
3435
}
3536

36-
unsafe fn test_simd_add(a: Foo, b: Foo) -> Foo {
37+
pub unsafe fn test_simd_add(a: Foo, b: Foo) -> Foo {
3738
simd_add(a, b)
3839
//~^ ERROR `simd_add` intrinsic: expected SIMD input type, found non-SIMD `Foo`
3940
}
40-
41-
fn main() {}

src/test/compile-fail/dupe-symbols-2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
#![crate_type="rlib"]
1212
#![allow(warnings)]
1313

14-
mod a {
14+
pub mod a {
1515
#[no_mangle]
1616
pub extern fn fail() {
1717
}
1818
}
1919

20-
mod b {
20+
pub mod b {
2121
#[no_mangle]
2222
pub extern fn fail() {
2323
//~^ symbol `fail` is already defined

src/test/compile-fail/invalid-inline.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ fn b() {
2121
fn c() {
2222
}
2323

24-
fn main() {}
24+
fn main() {
25+
a();
26+
b();
27+
c();
28+
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#![recursion_limit = "20"]
1414
#![type_length_limit = "20000000"]
15+
#![crate_type = "rlib"]
1516

1617
#[derive(Clone)]
1718
struct A (B);
@@ -66,5 +67,3 @@ impl D {
6667
pub fn matches() {
6768
A(B::Variant1).matches(&(|| ()))
6869
}
69-
70-
fn main() {}

src/test/compile-fail/non-interger-atomic.rs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,92 +10,91 @@
1010

1111
#![feature(core_intrinsics)]
1212
#![allow(warnings)]
13+
#![crate_type = "rlib"]
1314

1415
use std::intrinsics;
1516

1617
#[derive(Copy, Clone)]
17-
struct Foo(i64);
18-
type Bar = &'static Fn();
19-
type Quux = [u8; 100];
18+
pub struct Foo(i64);
19+
pub type Bar = &'static Fn();
20+
pub type Quux = [u8; 100];
2021

21-
unsafe fn test_bool_load(p: &mut bool, v: bool) {
22+
pub unsafe fn test_bool_load(p: &mut bool, v: bool) {
2223
intrinsics::atomic_load(p);
2324
//~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `bool`
2425
}
2526

26-
unsafe fn test_bool_store(p: &mut bool, v: bool) {
27+
pub unsafe fn test_bool_store(p: &mut bool, v: bool) {
2728
intrinsics::atomic_store(p, v);
2829
//~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `bool`
2930
}
3031

31-
unsafe fn test_bool_xchg(p: &mut bool, v: bool) {
32+
pub unsafe fn test_bool_xchg(p: &mut bool, v: bool) {
3233
intrinsics::atomic_xchg(p, v);
3334
//~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `bool`
3435
}
3536

36-
unsafe fn test_bool_cxchg(p: &mut bool, v: bool) {
37+
pub unsafe fn test_bool_cxchg(p: &mut bool, v: bool) {
3738
intrinsics::atomic_cxchg(p, v, v);
3839
//~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `bool`
3940
}
4041

41-
unsafe fn test_Foo_load(p: &mut Foo, v: Foo) {
42+
pub unsafe fn test_Foo_load(p: &mut Foo, v: Foo) {
4243
intrinsics::atomic_load(p);
4344
//~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `Foo`
4445
}
4546

46-
unsafe fn test_Foo_store(p: &mut Foo, v: Foo) {
47+
pub unsafe fn test_Foo_store(p: &mut Foo, v: Foo) {
4748
intrinsics::atomic_store(p, v);
4849
//~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `Foo`
4950
}
5051

51-
unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) {
52+
pub unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) {
5253
intrinsics::atomic_xchg(p, v);
5354
//~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `Foo`
5455
}
5556

56-
unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) {
57+
pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) {
5758
intrinsics::atomic_cxchg(p, v, v);
5859
//~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `Foo`
5960
}
6061

61-
unsafe fn test_Bar_load(p: &mut Bar, v: Bar) {
62+
pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) {
6263
intrinsics::atomic_load(p);
6364
//~^ ERROR expected basic integer type, found `&std::ops::Fn()`
6465
}
6566

66-
unsafe fn test_Bar_store(p: &mut Bar, v: Bar) {
67+
pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) {
6768
intrinsics::atomic_store(p, v);
6869
//~^ ERROR expected basic integer type, found `&std::ops::Fn()`
6970
}
7071

71-
unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) {
72+
pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) {
7273
intrinsics::atomic_xchg(p, v);
7374
//~^ ERROR expected basic integer type, found `&std::ops::Fn()`
7475
}
7576

76-
unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) {
77+
pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) {
7778
intrinsics::atomic_cxchg(p, v, v);
7879
//~^ ERROR expected basic integer type, found `&std::ops::Fn()`
7980
}
8081

81-
unsafe fn test_Quux_load(p: &mut Quux, v: Quux) {
82+
pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) {
8283
intrinsics::atomic_load(p);
8384
//~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]`
8485
}
8586

86-
unsafe fn test_Quux_store(p: &mut Quux, v: Quux) {
87+
pub unsafe fn test_Quux_store(p: &mut Quux, v: Quux) {
8788
intrinsics::atomic_store(p, v);
8889
//~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]`
8990
}
9091

91-
unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) {
92+
pub unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) {
9293
intrinsics::atomic_xchg(p, v);
9394
//~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]`
9495
}
9596

96-
unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) {
97+
pub unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) {
9798
intrinsics::atomic_cxchg(p, v, v);
9899
//~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]`
99100
}
100-
101-
fn main() {}

0 commit comments

Comments
 (0)