Skip to content

Commit

Permalink
Update existing test cases.
Browse files Browse the repository at this point in the history
- Allow ClashingExternDecl for lint-dead-code-3
- Update test case for #5791
- Update test case for #1866
- Update extern-abi-from-macro test case
  • Loading branch information
jumbatm committed May 20, 2020
1 parent b389eed commit 337abf1
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/test/ui/issues/issue-1866.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// build-pass
#![allow(dead_code)]
#![allow(non_camel_case_types)]
#![warn(clashing_extern_decl)]

// pretty-expanded FIXME #23616

Expand All @@ -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
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions src/test/ui/issues/issue-1866.stderr
Original file line number Diff line number Diff line change
@@ -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

2 changes: 2 additions & 0 deletions src/test/ui/issues/issue-5791.rs
Original file line number Diff line number Diff line change
@@ -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;
}

Expand Down
21 changes: 21 additions & 0 deletions src/test/ui/issues/issue-5791.stderr
Original file line number Diff line number Diff line change
@@ -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

1 change: 1 addition & 0 deletions src/test/ui/lint/dead-code/lint-dead-code-3.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![allow(unused_variables)]
#![allow(non_camel_case_types)]
#![allow(clashing_extern_decl)]
#![deny(dead_code)]

#![crate_type="lib"]
Expand Down
12 changes: 6 additions & 6 deletions src/test/ui/lint/dead-code/lint-dead-code-3.stderr
Original file line number Diff line number Diff line change
@@ -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);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/parser/extern-abi-from-mac-literal-frag.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clashing_extern_decl)]
// check-pass

// In this test we check that the parser accepts an ABI string when it
Expand Down

0 comments on commit 337abf1

Please sign in to comment.