From 55c3b8ec66b0dddc49627a426b687c450ae86da5 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Mon, 30 Oct 2017 18:19:31 +0100 Subject: [PATCH] Update compile-fail tests. --- src/test/compile-fail/E0534.rs | 4 +- .../bad-intrinsic-monomorphization.rs | 11 +++-- src/test/compile-fail/dupe-symbols-2.rs | 4 +- src/test/compile-fail/invalid-inline.rs | 6 ++- src/test/compile-fail/issue-22638.rs | 3 +- src/test/compile-fail/non-interger-atomic.rs | 41 +++++++++---------- 6 files changed, 36 insertions(+), 33 deletions(-) diff --git a/src/test/compile-fail/E0534.rs b/src/test/compile-fail/E0534.rs index 8c036e6076d..fc465b26869 100644 --- a/src/test/compile-fail/E0534.rs +++ b/src/test/compile-fail/E0534.rs @@ -11,4 +11,6 @@ #[inline()] //~ ERROR E0534 pub fn something() {} -fn main() {} +fn main() { + something(); +} diff --git a/src/test/compile-fail/bad-intrinsic-monomorphization.rs b/src/test/compile-fail/bad-intrinsic-monomorphization.rs index cfb64f80767..2fe94d43acd 100644 --- a/src/test/compile-fail/bad-intrinsic-monomorphization.rs +++ b/src/test/compile-fail/bad-intrinsic-monomorphization.rs @@ -10,6 +10,7 @@ #![feature(repr_simd, platform_intrinsics, core_intrinsics)] #![allow(warnings)] +#![crate_type = "rlib"] // Bad monomorphizations could previously cause LLVM asserts even though the // error was caught in the compiler. @@ -21,21 +22,19 @@ extern "platform-intrinsic" { use std::intrinsics; #[derive(Copy, Clone)] -struct Foo(i64); +pub struct Foo(i64); -unsafe fn test_cttz(v: Foo) -> Foo { +pub unsafe fn test_cttz(v: Foo) -> Foo { intrinsics::cttz(v) //~^ ERROR `cttz` intrinsic: expected basic integer type, found `Foo` } -unsafe fn test_fadd_fast(a: Foo, b: Foo) -> Foo { +pub unsafe fn test_fadd_fast(a: Foo, b: Foo) -> Foo { intrinsics::fadd_fast(a, b) //~^ ERROR `fadd_fast` intrinsic: expected basic float type, found `Foo` } -unsafe fn test_simd_add(a: Foo, b: Foo) -> Foo { +pub unsafe fn test_simd_add(a: Foo, b: Foo) -> Foo { simd_add(a, b) //~^ ERROR `simd_add` intrinsic: expected SIMD input type, found non-SIMD `Foo` } - -fn main() {} diff --git a/src/test/compile-fail/dupe-symbols-2.rs b/src/test/compile-fail/dupe-symbols-2.rs index 976a65589b8..1f19bd2f249 100644 --- a/src/test/compile-fail/dupe-symbols-2.rs +++ b/src/test/compile-fail/dupe-symbols-2.rs @@ -11,13 +11,13 @@ #![crate_type="rlib"] #![allow(warnings)] -mod a { +pub mod a { #[no_mangle] pub extern fn fail() { } } -mod b { +pub mod b { #[no_mangle] pub extern fn fail() { //~^ symbol `fail` is already defined diff --git a/src/test/compile-fail/invalid-inline.rs b/src/test/compile-fail/invalid-inline.rs index ad89087d660..93b985b4fb0 100644 --- a/src/test/compile-fail/invalid-inline.rs +++ b/src/test/compile-fail/invalid-inline.rs @@ -21,4 +21,8 @@ fn b() { fn c() { } -fn main() {} +fn main() { + a(); + b(); + c(); +} diff --git a/src/test/compile-fail/issue-22638.rs b/src/test/compile-fail/issue-22638.rs index 65d1d837d7d..53b0d9f4e9f 100644 --- a/src/test/compile-fail/issue-22638.rs +++ b/src/test/compile-fail/issue-22638.rs @@ -12,6 +12,7 @@ #![recursion_limit = "20"] #![type_length_limit = "20000000"] +#![crate_type = "rlib"] #[derive(Clone)] struct A (B); @@ -66,5 +67,3 @@ impl D { pub fn matches() { A(B::Variant1).matches(&(|| ())) } - -fn main() {} diff --git a/src/test/compile-fail/non-interger-atomic.rs b/src/test/compile-fail/non-interger-atomic.rs index 50240b47557..a51a9e518ce 100644 --- a/src/test/compile-fail/non-interger-atomic.rs +++ b/src/test/compile-fail/non-interger-atomic.rs @@ -10,92 +10,91 @@ #![feature(core_intrinsics)] #![allow(warnings)] +#![crate_type = "rlib"] use std::intrinsics; #[derive(Copy, Clone)] -struct Foo(i64); -type Bar = &'static Fn(); -type Quux = [u8; 100]; +pub struct Foo(i64); +pub type Bar = &'static Fn(); +pub type Quux = [u8; 100]; -unsafe fn test_bool_load(p: &mut bool, v: bool) { +pub unsafe fn test_bool_load(p: &mut bool, v: bool) { intrinsics::atomic_load(p); //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `bool` } -unsafe fn test_bool_store(p: &mut bool, v: bool) { +pub unsafe fn test_bool_store(p: &mut bool, v: bool) { intrinsics::atomic_store(p, v); //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `bool` } -unsafe fn test_bool_xchg(p: &mut bool, v: bool) { +pub unsafe fn test_bool_xchg(p: &mut bool, v: bool) { intrinsics::atomic_xchg(p, v); //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `bool` } -unsafe fn test_bool_cxchg(p: &mut bool, v: bool) { +pub unsafe fn test_bool_cxchg(p: &mut bool, v: bool) { intrinsics::atomic_cxchg(p, v, v); //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `bool` } -unsafe fn test_Foo_load(p: &mut Foo, v: Foo) { +pub unsafe fn test_Foo_load(p: &mut Foo, v: Foo) { intrinsics::atomic_load(p); //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `Foo` } -unsafe fn test_Foo_store(p: &mut Foo, v: Foo) { +pub unsafe fn test_Foo_store(p: &mut Foo, v: Foo) { intrinsics::atomic_store(p, v); //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `Foo` } -unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) { +pub unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) { intrinsics::atomic_xchg(p, v); //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `Foo` } -unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) { +pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) { intrinsics::atomic_cxchg(p, v, v); //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `Foo` } -unsafe fn test_Bar_load(p: &mut Bar, v: Bar) { +pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) { intrinsics::atomic_load(p); //~^ ERROR expected basic integer type, found `&std::ops::Fn()` } -unsafe fn test_Bar_store(p: &mut Bar, v: Bar) { +pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) { intrinsics::atomic_store(p, v); //~^ ERROR expected basic integer type, found `&std::ops::Fn()` } -unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) { +pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) { intrinsics::atomic_xchg(p, v); //~^ ERROR expected basic integer type, found `&std::ops::Fn()` } -unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) { +pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) { intrinsics::atomic_cxchg(p, v, v); //~^ ERROR expected basic integer type, found `&std::ops::Fn()` } -unsafe fn test_Quux_load(p: &mut Quux, v: Quux) { +pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) { intrinsics::atomic_load(p); //~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]` } -unsafe fn test_Quux_store(p: &mut Quux, v: Quux) { +pub unsafe fn test_Quux_store(p: &mut Quux, v: Quux) { intrinsics::atomic_store(p, v); //~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]` } -unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) { +pub unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) { intrinsics::atomic_xchg(p, v); //~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]` } -unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) { +pub unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) { intrinsics::atomic_cxchg(p, v, v); //~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]` } - -fn main() {}