Skip to content

Commit a92fad8

Browse files
Allow function_casts_as_integer in non-related ui tests
1 parent 564224b commit a92fad8

16 files changed

+56
-30
lines changed

tests/ui/abi/stack-protector.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
//@ compile-flags: -C opt-level=2
66
//@ compile-flags: -g
77

8+
#![allow(function_casts_as_integer)]
9+
810
use std::env;
911
use std::process::{Command, ExitStatus};
1012

tests/ui/cast/cast-rfc0401.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ run-pass
22

3-
#![allow(dead_code)]
3+
#![allow(dead_code, function_casts_as_integer)]
44

55
use std::vec;
66

tests/ui/consts/const-eval/const_prop_errors.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@ check-pass
22

3+
#![allow(function_casts_as_integer)]
4+
35
pub trait Foo {
46
fn foo(self) -> u32;
57
}

tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
//@ normalize-stderr: "\[i8\]" -> "[i8 or u8 (arch dependant)]"
55
//@ normalize-stderr: "\[u8\]" -> "[i8 or u8 (arch dependant)]"
66

7+
#![allow(function_casts_as_integer)]
8+
79
type Foo = extern "C" fn(::std::ffi::CStr);
810
//~^ WARN `extern` fn uses type
911
extern "C" {

tests/ui/extern/extern-C-non-FFI-safe-arg-ice-52334.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: `extern` fn uses type `CStr`, which is not FFI-safe
2-
--> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:7:12
2+
--> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:9:12
33
|
44
LL | type Foo = extern "C" fn(::std::ffi::CStr);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -9,7 +9,7 @@ LL | type Foo = extern "C" fn(::std::ffi::CStr);
99
= note: `#[warn(improper_ctypes_definitions)]` on by default
1010

1111
warning: `extern` block uses type `CStr`, which is not FFI-safe
12-
--> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:10:18
12+
--> $DIR/extern-C-non-FFI-safe-arg-ice-52334.rs:12:18
1313
|
1414
LL | fn meh(blah: Foo);
1515
| ^^^ not FFI-safe

tests/ui/issues/issue-54094.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
//@ check-pass
2+
3+
#![allow(function_casts_as_integer)]
4+
25
trait Zoo {
36
type X;
47
}

tests/ui/issues/issue-56870.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
//@ build-pass
22
// Regression test for #56870: Internal compiler error (traits & associated consts)
33

4+
#![allow(function_casts_as_integer)]
5+
46
use std::fmt::Debug;
57

68
pub trait Foo<T> {

tests/ui/lint/ptr_null_checks.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@ check-pass
22

3+
#![allow(function_casts_as_integer)]
4+
35
use std::ptr;
46

57
extern "C" fn c_fn() {}

tests/ui/lint/ptr_null_checks.stderr

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: function pointers are not nullable, so checking them for null will always return false
2-
--> $DIR/ptr_null_checks.rs:12:8
2+
--> $DIR/ptr_null_checks.rs:14:8
33
|
44
LL | if (fn_ptr as *mut ()).is_null() {}
55
| ^------^^^^^^^^^^^^^^^^^^^^^^
@@ -10,7 +10,7 @@ LL | if (fn_ptr as *mut ()).is_null() {}
1010
= note: `#[warn(useless_ptr_null_checks)]` on by default
1111

1212
warning: function pointers are not nullable, so checking them for null will always return false
13-
--> $DIR/ptr_null_checks.rs:14:8
13+
--> $DIR/ptr_null_checks.rs:16:8
1414
|
1515
LL | if (fn_ptr as *const u8).is_null() {}
1616
| ^------^^^^^^^^^^^^^^^^^^^^^^^^
@@ -20,7 +20,7 @@ LL | if (fn_ptr as *const u8).is_null() {}
2020
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
2121

2222
warning: function pointers are not nullable, so checking them for null will always return false
23-
--> $DIR/ptr_null_checks.rs:16:8
23+
--> $DIR/ptr_null_checks.rs:18:8
2424
|
2525
LL | if (fn_ptr as *const ()) == std::ptr::null() {}
2626
| ^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -30,7 +30,7 @@ LL | if (fn_ptr as *const ()) == std::ptr::null() {}
3030
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
3131

3232
warning: function pointers are not nullable, so checking them for null will always return false
33-
--> $DIR/ptr_null_checks.rs:18:8
33+
--> $DIR/ptr_null_checks.rs:20:8
3434
|
3535
LL | if (fn_ptr as *mut ()) == std::ptr::null_mut() {}
3636
| ^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -40,7 +40,7 @@ LL | if (fn_ptr as *mut ()) == std::ptr::null_mut() {}
4040
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
4141

4242
warning: function pointers are not nullable, so checking them for null will always return false
43-
--> $DIR/ptr_null_checks.rs:20:8
43+
--> $DIR/ptr_null_checks.rs:22:8
4444
|
4545
LL | if (fn_ptr as *const ()) == (0 as *const ()) {}
4646
| ^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -50,7 +50,7 @@ LL | if (fn_ptr as *const ()) == (0 as *const ()) {}
5050
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
5151

5252
warning: function pointers are not nullable, so checking them for null will always return false
53-
--> $DIR/ptr_null_checks.rs:22:8
53+
--> $DIR/ptr_null_checks.rs:24:8
5454
|
5555
LL | if <*const _>::is_null(fn_ptr as *const ()) {}
5656
| ^^^^^^^^^^^^^^^^^^^^------^^^^^^^^^^^^^^
@@ -60,7 +60,7 @@ LL | if <*const _>::is_null(fn_ptr as *const ()) {}
6060
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
6161

6262
warning: function pointers are not nullable, so checking them for null will always return false
63-
--> $DIR/ptr_null_checks.rs:24:8
63+
--> $DIR/ptr_null_checks.rs:26:8
6464
|
6565
LL | if (fn_ptr as *mut fn() as *const fn() as *const ()).is_null() {}
6666
| ^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -70,7 +70,7 @@ LL | if (fn_ptr as *mut fn() as *const fn() as *const ()).is_null() {}
7070
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
7171

7272
warning: function pointers are not nullable, so checking them for null will always return false
73-
--> $DIR/ptr_null_checks.rs:26:8
73+
--> $DIR/ptr_null_checks.rs:28:8
7474
|
7575
LL | if (fn_ptr as *mut fn() as *const fn()).cast_mut().is_null() {}
7676
| ^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -80,7 +80,7 @@ LL | if (fn_ptr as *mut fn() as *const fn()).cast_mut().is_null() {}
8080
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
8181

8282
warning: function pointers are not nullable, so checking them for null will always return false
83-
--> $DIR/ptr_null_checks.rs:28:8
83+
--> $DIR/ptr_null_checks.rs:30:8
8484
|
8585
LL | if ((fn_ptr as *mut fn()).cast() as *const fn()).cast_mut().is_null() {}
8686
| ^^------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -90,7 +90,7 @@ LL | if ((fn_ptr as *mut fn()).cast() as *const fn()).cast_mut().is_null() {
9090
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
9191

9292
warning: function pointers are not nullable, so checking them for null will always return false
93-
--> $DIR/ptr_null_checks.rs:30:8
93+
--> $DIR/ptr_null_checks.rs:32:8
9494
|
9595
LL | if (fn_ptr as fn() as *const ()).is_null() {}
9696
| ^--------------^^^^^^^^^^^^^^^^^^^^^^^^
@@ -100,7 +100,7 @@ LL | if (fn_ptr as fn() as *const ()).is_null() {}
100100
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
101101

102102
warning: function pointers are not nullable, so checking them for null will always return false
103-
--> $DIR/ptr_null_checks.rs:32:8
103+
--> $DIR/ptr_null_checks.rs:34:8
104104
|
105105
LL | if (c_fn as *const fn()).is_null() {}
106106
| ^----^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -110,117 +110,117 @@ LL | if (c_fn as *const fn()).is_null() {}
110110
= help: wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
111111

112112
warning: references are not nullable, so checking them for null will always return false
113-
--> $DIR/ptr_null_checks.rs:36:8
113+
--> $DIR/ptr_null_checks.rs:38:8
114114
|
115115
LL | if (&mut 8 as *mut i32).is_null() {}
116116
| ^------^^^^^^^^^^^^^^^^^^^^^^^
117117
| |
118118
| expression has type `&mut i32`
119119

120120
warning: returned pointer of `from_mut` call is never null, so checking it for null will always return false
121-
--> $DIR/ptr_null_checks.rs:38:8
121+
--> $DIR/ptr_null_checks.rs:40:8
122122
|
123123
LL | if ptr::from_mut(&mut 8).is_null() {}
124124
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
125125

126126
warning: references are not nullable, so checking them for null will always return false
127-
--> $DIR/ptr_null_checks.rs:40:8
127+
--> $DIR/ptr_null_checks.rs:42:8
128128
|
129129
LL | if (&8 as *const i32).is_null() {}
130130
| ^--^^^^^^^^^^^^^^^^^^^^^^^^^
131131
| |
132132
| expression has type `&i32`
133133

134134
warning: returned pointer of `from_ref` call is never null, so checking it for null will always return false
135-
--> $DIR/ptr_null_checks.rs:42:8
135+
--> $DIR/ptr_null_checks.rs:44:8
136136
|
137137
LL | if ptr::from_ref(&8).is_null() {}
138138
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
139139

140140
warning: returned pointer of `from_ref` call is never null, so checking it for null will always return false
141-
--> $DIR/ptr_null_checks.rs:44:8
141+
--> $DIR/ptr_null_checks.rs:46:8
142142
|
143143
LL | if ptr::from_ref(&8).cast_mut().is_null() {}
144144
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
145145

146146
warning: returned pointer of `from_ref` call is never null, so checking it for null will always return false
147-
--> $DIR/ptr_null_checks.rs:46:8
147+
--> $DIR/ptr_null_checks.rs:48:8
148148
|
149149
LL | if (ptr::from_ref(&8).cast_mut() as *mut i32).is_null() {}
150150
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
151151

152152
warning: references are not nullable, so checking them for null will always return false
153-
--> $DIR/ptr_null_checks.rs:48:8
153+
--> $DIR/ptr_null_checks.rs:50:8
154154
|
155155
LL | if (&8 as *const i32) == std::ptr::null() {}
156156
| ^--^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
157157
| |
158158
| expression has type `&i32`
159159

160160
warning: references are not nullable, so checking them for null will always return false
161-
--> $DIR/ptr_null_checks.rs:51:8
161+
--> $DIR/ptr_null_checks.rs:53:8
162162
|
163163
LL | if (ref_num as *const i32) == std::ptr::null() {}
164164
| ^-------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
165165
| |
166166
| expression has type `&i32`
167167

168168
warning: references are not nullable, so checking them for null will always return false
169-
--> $DIR/ptr_null_checks.rs:53:8
169+
--> $DIR/ptr_null_checks.rs:55:8
170170
|
171171
LL | if (b"\0" as *const u8).is_null() {}
172172
| ^-----^^^^^^^^^^^^^^^^^^^^^^^^
173173
| |
174174
| expression has type `&[u8; 1]`
175175

176176
warning: references are not nullable, so checking them for null will always return false
177-
--> $DIR/ptr_null_checks.rs:55:8
177+
--> $DIR/ptr_null_checks.rs:57:8
178178
|
179179
LL | if ("aa" as *const str).is_null() {}
180180
| ^----^^^^^^^^^^^^^^^^^^^^^^^^^
181181
| |
182182
| expression has type `&str`
183183

184184
warning: references are not nullable, so checking them for null will always return false
185-
--> $DIR/ptr_null_checks.rs:57:8
185+
--> $DIR/ptr_null_checks.rs:59:8
186186
|
187187
LL | if (&[1, 2] as *const i32).is_null() {}
188188
| ^-------^^^^^^^^^^^^^^^^^^^^^^^^^
189189
| |
190190
| expression has type `&[i32; 2]`
191191

192192
warning: references are not nullable, so checking them for null will always return false
193-
--> $DIR/ptr_null_checks.rs:59:8
193+
--> $DIR/ptr_null_checks.rs:61:8
194194
|
195195
LL | if (&mut [1, 2] as *mut i32) == std::ptr::null_mut() {}
196196
| ^-----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
197197
| |
198198
| expression has type `&mut [i32; 2]`
199199

200200
warning: references are not nullable, so checking them for null will always return false
201-
--> $DIR/ptr_null_checks.rs:61:8
201+
--> $DIR/ptr_null_checks.rs:63:8
202202
|
203203
LL | if (static_i32() as *const i32).is_null() {}
204204
| ^------------^^^^^^^^^^^^^^^^^^^^^^^^^
205205
| |
206206
| expression has type `&i32`
207207

208208
warning: references are not nullable, so checking them for null will always return false
209-
--> $DIR/ptr_null_checks.rs:63:8
209+
--> $DIR/ptr_null_checks.rs:65:8
210210
|
211211
LL | if (&*{ static_i32() } as *const i32).is_null() {}
212212
| ^------------------^^^^^^^^^^^^^^^^^^^^^^^^^
213213
| |
214214
| expression has type `&i32`
215215

216216
warning: returned pointer of `as_ptr` call is never null, so checking it for null will always return false
217-
--> $DIR/ptr_null_checks.rs:67:8
217+
--> $DIR/ptr_null_checks.rs:69:8
218218
|
219219
LL | if ptr::NonNull::new(&mut 8).unwrap().as_ptr().is_null() {}
220220
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
221221

222222
warning: returned pointer of `as_ptr` call is never null, so checking it for null will always return false
223-
--> $DIR/ptr_null_checks.rs:69:8
223+
--> $DIR/ptr_null_checks.rs:71:8
224224
|
225225
LL | if ptr::NonNull::<u8>::dangling().as_ptr().is_null() {}
226226
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/lto/thin-lto-inlines.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// praying two functions go into separate codegen units and then assuming that
99
// if inlining *doesn't* happen the first byte of the functions will differ.
1010

11+
#![allow(function_casts_as_integer)]
12+
1113
pub fn foo() -> u32 {
1214
bar::bar()
1315
}

tests/ui/lto/thin-lto-inlines2.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
// praying two functions go into separate codegen units and then assuming that
1111
// if inlining *doesn't* happen the first byte of the functions will differ.
1212

13+
#![allow(function_casts_as_integer)]
14+
1315
extern crate thin_lto_inlines_aux as bar;
1416

1517
pub fn foo() -> u32 {

tests/ui/mir/mir_coercions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@ run-pass
22
#![feature(coerce_unsized, unsize)]
3+
#![allow(function_casts_as_integer)]
34

45
use std::ops::CoerceUnsized;
56
use std::marker::Unsize;

tests/ui/mir/mir_misc_casts.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
//@ run-pass
2+
3+
#![allow(function_casts_as_integer)]
4+
25
fn func(){}
36

47
const STR: &'static str = "hello";

tests/ui/mir/mir_refs_correct.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
//@ run-pass
22
//@ aux-build:mir_external_refs.rs
33

4+
#![allow(function_casts_as_integer)]
5+
46
extern crate mir_external_refs as ext;
57

68
struct S(#[allow(dead_code)] u8);

tests/ui/runtime/signal-alternate-stack-cleanup.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
//@ ignore-vxworks no SIGWINCH in user space
1010
//@ ignore-nto no SA_ONSTACK
1111

12+
#![allow(function_casts_as_integer)]
1213
#![feature(rustc_private)]
1314
extern crate libc;
1415

tests/ui/traits/trait-upcasting/mono-impossible.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@ build-pass
22

3+
#![allow(function_casts_as_integer)]
4+
35
trait Supertrait<T> {
46
fn method(&self) {}
57
}

0 commit comments

Comments
 (0)