diff options
| author | jumbatm <jumbatm@gmail.com> | 2020-04-06 20:00:42 +1000 |
|---|---|---|
| committer | jumbatm <30644300+jumbatm@users.noreply.github.com> | 2020-06-20 16:54:32 +1000 |
| commit | 556b7baca2cd45a78b1a9a762b4bf66b69747e53 (patch) | |
| tree | a34552260014b7852bf1ab1ccd399c2f1e37a2a8 | |
| parent | 8f079522e43d4e09eee9c72fd06668323ff7cc58 (diff) | |
| download | rust-556b7baca2cd45a78b1a9a762b4bf66b69747e53.tar.gz rust-556b7baca2cd45a78b1a9a762b4bf66b69747e53.zip | |
Update existing test cases.
- Allow ClashingExternDecl for lint-dead-code-3 - Update test case for #5791 - Update test case for #1866 - Update extern-abi-from-macro test case
| -rw-r--r-- | src/test/ui/issues/issue-1866.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-1866.stderr | 19 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-5791.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-5791.stderr | 21 | ||||
| -rw-r--r-- | src/test/ui/lint/clashing-extern-fn.stderr | 36 | ||||
| -rw-r--r-- | src/test/ui/lint/dead-code/lint-dead-code-3.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/lint/dead-code/lint-dead-code-3.stderr | 12 | ||||
| -rw-r--r-- | src/test/ui/parser/extern-abi-from-mac-literal-frag.rs | 1 |
8 files changed, 70 insertions, 24 deletions
diff --git a/src/test/ui/issues/issue-1866.rs b/src/test/ui/issues/issue-1866.rs index e4fe26800ef..668baefa5e4 100644 --- a/src/test/ui/issues/issue-1866.rs +++ b/src/test/ui/issues/issue-1866.rs @@ -1,6 +1,7 @@ // build-pass #![allow(dead_code)] #![allow(non_camel_case_types)] +#![warn(clashing_extern_decl)] // pretty-expanded FIXME #23616 @@ -20,6 +21,7 @@ mod b { use super::rust_task; extern { pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool; + //~^ WARN `rust_task_is_unwinding` redeclared with a different signature } } } diff --git a/src/test/ui/issues/issue-1866.stderr b/src/test/ui/issues/issue-1866.stderr new file mode 100644 index 00000000000..13c08ebd373 --- /dev/null +++ b/src/test/ui/issues/issue-1866.stderr @@ -0,0 +1,19 @@ +warning: `rust_task_is_unwinding` redeclared with a different signature + --> $DIR/issue-1866.rs:23:13 + | +LL | pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool; + | ------------------------------------------------------------ `rust_task_is_unwinding` previously declared here +... +LL | pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | +note: the lint level is defined here + --> $DIR/issue-1866.rs:4:9 + | +LL | #![warn(clashing_extern_decl)] + | ^^^^^^^^^^^^^^^^^^^^ + = note: expected `unsafe extern "C" fn(*const usize) -> bool` + found `unsafe extern "C" fn(*const bool) -> bool` + +warning: 1 warning emitted + diff --git a/src/test/ui/issues/issue-5791.rs b/src/test/ui/issues/issue-5791.rs index 2f8bf1e9369..fda72a1b20e 100644 --- a/src/test/ui/issues/issue-5791.rs +++ b/src/test/ui/issues/issue-5791.rs @@ -1,11 +1,13 @@ // run-pass #![allow(dead_code)] +#![warn(clashing_extern_decl)] // pretty-expanded FIXME #23616 extern { #[link_name = "malloc"] fn malloc1(len: i32) -> *const u8; #[link_name = "malloc"] + //~^ WARN `malloc2` redeclares `malloc` with a different signature fn malloc2(len: i32, foo: i32) -> *const u8; } diff --git a/src/test/ui/issues/issue-5791.stderr b/src/test/ui/issues/issue-5791.stderr new file mode 100644 index 00000000000..7ae83c43f13 --- /dev/null +++ b/src/test/ui/issues/issue-5791.stderr @@ -0,0 +1,21 @@ +warning: `malloc2` redeclares `malloc` with a different signature + --> $DIR/issue-5791.rs:9:5 + | +LL | / #[link_name = "malloc"] +LL | | fn malloc1(len: i32) -> *const u8; + | |______________________________________- `malloc` previously declared here +LL | / #[link_name = "malloc"] +LL | | +LL | | fn malloc2(len: i32, foo: i32) -> *const u8; + | |________________________________________________^ this signature doesn't match the previous declaration + | +note: the lint level is defined here + --> $DIR/issue-5791.rs:3:9 + | +LL | #![warn(clashing_extern_decl)] + | ^^^^^^^^^^^^^^^^^^^^ + = note: expected `unsafe extern "C" fn(i32) -> *const u8` + found `unsafe extern "C" fn(i32, i32) -> *const u8` + +warning: 1 warning emitted + diff --git a/src/test/ui/lint/clashing-extern-fn.stderr b/src/test/ui/lint/clashing-extern-fn.stderr index 7e85e38a5b8..fb7bf135f53 100644 --- a/src/test/ui/lint/clashing-extern-fn.stderr +++ b/src/test/ui/lint/clashing-extern-fn.stderr @@ -12,8 +12,8 @@ note: the lint level is defined here | LL | #![warn(clashing_extern_decl)] | ^^^^^^^^^^^^^^^^^^^^ - = note: expected `unsafe extern "C" fn(u8)` - found `unsafe extern "C" fn(u64)` + = note: expected `unsafe extern "C" fn(u8)` + found `unsafe extern "C" fn(u64)` warning: `extern_fn` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:39:9 @@ -24,8 +24,8 @@ LL | fn extern_fn(x: u64); LL | fn extern_fn(x: u32); | ^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | - = note: expected `unsafe extern "C" fn(u64)` - found `unsafe extern "C" fn(u32)` + = note: expected `unsafe extern "C" fn(u64)` + found `unsafe extern "C" fn(u32)` warning: `extern_link_name` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:64:9 @@ -37,8 +37,8 @@ LL | | fn some_new_name(x: i16); LL | fn extern_link_name(x: u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | - = note: expected `unsafe extern "C" fn(i16)` - found `unsafe extern "C" fn(u32)` + = note: expected `unsafe extern "C" fn(i16)` + found `unsafe extern "C" fn(u32)` warning: `some_other_extern_link_name` redeclares `some_other_new_name` with a different signature --> $DIR/clashing-extern-fn.rs:67:9 @@ -51,8 +51,8 @@ LL | | LL | | fn some_other_extern_link_name(x: u32); | |_______________________________________________^ this signature doesn't match the previous declaration | - = note: expected `unsafe extern "C" fn(i16)` - found `unsafe extern "C" fn(u32)` + = note: expected `unsafe extern "C" fn(i16)` + found `unsafe extern "C" fn(u32)` warning: `other_both_names_different` redeclares `link_name_same` with a different signature --> $DIR/clashing-extern-fn.rs:71:9 @@ -66,8 +66,8 @@ LL | | LL | | fn other_both_names_different(x: u32); | |______________________________________________^ this signature doesn't match the previous declaration | - = note: expected `unsafe extern "C" fn(i16)` - found `unsafe extern "C" fn(u32)` + = note: expected `unsafe extern "C" fn(i16)` + found `unsafe extern "C" fn(u32)` warning: `different_mod` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:84:9 @@ -78,8 +78,8 @@ LL | fn different_mod(x: u8); LL | fn different_mod(x: u64); | ^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | - = note: expected `unsafe extern "C" fn(u8)` - found `unsafe extern "C" fn(u64)` + = note: expected `unsafe extern "C" fn(u8)` + found `unsafe extern "C" fn(u64)` warning: `variadic_decl` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:94:9 @@ -90,8 +90,8 @@ LL | fn variadic_decl(x: u8, ...); LL | fn variadic_decl(x: u8); | ^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | - = note: expected `unsafe extern "C" fn(u8, ...)` - found `unsafe extern "C" fn(u8)` + = note: expected `unsafe extern "C" fn(u8, ...)` + found `unsafe extern "C" fn(u8)` warning: `weigh_banana` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:137:22 @@ -102,8 +102,8 @@ LL | extern "C" { fn weigh_banana(count: *const Banana) -> u64; } LL | extern "C" { fn weigh_banana(count: *const Banana) -> u64; } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | - = note: expected `unsafe extern "C" fn(*const banana::one::Banana) -> u64` - found `unsafe extern "C" fn(*const banana::three::Banana) -> u64` + = note: expected `unsafe extern "C" fn(*const banana::one::Banana) -> u64` + found `unsafe extern "C" fn(*const banana::three::Banana) -> u64` warning: `draw_point` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:157:22 @@ -114,8 +114,8 @@ LL | extern "C" { fn draw_point(p: Point); } LL | extern "C" { fn draw_point(p: Point); } | ^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | - = note: expected `unsafe extern "C" fn(sameish_members::a::Point)` - found `unsafe extern "C" fn(sameish_members::b::Point)` + = note: expected `unsafe extern "C" fn(sameish_members::a::Point)` + found `unsafe extern "C" fn(sameish_members::b::Point)` warning: 9 warnings emitted diff --git a/src/test/ui/lint/dead-code/lint-dead-code-3.rs b/src/test/ui/lint/dead-code/lint-dead-code-3.rs index 6826d2cd67e..ff33abfa645 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-3.rs +++ b/src/test/ui/lint/dead-code/lint-dead-code-3.rs @@ -1,5 +1,6 @@ #![allow(unused_variables)] #![allow(non_camel_case_types)] +#![allow(clashing_extern_decl)] #![deny(dead_code)] #![crate_type="lib"] diff --git a/src/test/ui/lint/dead-code/lint-dead-code-3.stderr b/src/test/ui/lint/dead-code/lint-dead-code-3.stderr index 6d174e8d9bc..cf8f01ea19f 100644 --- a/src/test/ui/lint/dead-code/lint-dead-code-3.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-3.stderr @@ -1,35 +1,35 @@ error: struct is never constructed: `Foo` - --> $DIR/lint-dead-code-3.rs:13:8 + --> $DIR/lint-dead-code-3.rs:14:8 | LL | struct Foo; | ^^^ | note: the lint level is defined here - --> $DIR/lint-dead-code-3.rs:3:9 + --> $DIR/lint-dead-code-3.rs:4:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ error: associated function is never used: `foo` - --> $DIR/lint-dead-code-3.rs:15:8 + --> $DIR/lint-dead-code-3.rs:16:8 | LL | fn foo(&self) { | ^^^ error: function is never used: `bar` - --> $DIR/lint-dead-code-3.rs:20:4 + --> $DIR/lint-dead-code-3.rs:21:4 | LL | fn bar() { | ^^^ error: enum is never used: `c_void` - --> $DIR/lint-dead-code-3.rs:59:6 + --> $DIR/lint-dead-code-3.rs:60:6 | LL | enum c_void {} | ^^^^^^ error: function is never used: `free` - --> $DIR/lint-dead-code-3.rs:61:5 + --> $DIR/lint-dead-code-3.rs:62:5 | LL | fn free(p: *const c_void); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/parser/extern-abi-from-mac-literal-frag.rs b/src/test/ui/parser/extern-abi-from-mac-literal-frag.rs index 4ecb21d26ab..a516aa44c65 100644 --- a/src/test/ui/parser/extern-abi-from-mac-literal-frag.rs +++ b/src/test/ui/parser/extern-abi-from-mac-literal-frag.rs @@ -1,3 +1,4 @@ +#![allow(clashing_extern_decl)] // check-pass // In this test we check that the parser accepts an ABI string when it |
