mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 09:23:05 +00:00
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
This commit is contained in:
parent
8f079522e4
commit
556b7baca2
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
19
src/test/ui/issues/issue-1866.stderr
Normal file
19
src/test/ui/issues/issue-1866.stderr
Normal file
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
21
src/test/ui/issues/issue-5791.stderr
Normal file
21
src/test/ui/issues/issue-5791.stderr
Normal file
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#![allow(unused_variables)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(clashing_extern_decl)]
|
||||
#![deny(dead_code)]
|
||||
|
||||
#![crate_type="lib"]
|
||||
|
@ -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);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,3 +1,4 @@
|
||||
#![allow(clashing_extern_decl)]
|
||||
// check-pass
|
||||
|
||||
// In this test we check that the parser accepts an ABI string when it
|
||||
|
Loading…
Reference in New Issue
Block a user