Skip to content

Commit 5331fea

Browse files
committed
Update tests
1 parent ea988af commit 5331fea

File tree

4 files changed

+30
-32
lines changed

4 files changed

+30
-32
lines changed

tests/ui/transmute.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(const_fn_transmute)]
21
#![allow(dead_code)]
32

43
extern crate core;

tests/ui/transmute.stderr

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,155 +1,155 @@
11
error: transmute from a type (`&T`) to itself
2-
--> $DIR/transmute.rs:20:20
2+
--> $DIR/transmute.rs:19:20
33
|
44
LL | let _: &'a T = core::intrinsics::transmute(t);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::useless-transmute` implied by `-D warnings`
88

99
error: transmute from a reference to a pointer
10-
--> $DIR/transmute.rs:24:23
10+
--> $DIR/transmute.rs:23:23
1111
|
1212
LL | let _: *const T = core::intrinsics::transmute(t);
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T`
1414

1515
error: transmute from a reference to a pointer
16-
--> $DIR/transmute.rs:26:21
16+
--> $DIR/transmute.rs:25:21
1717
|
1818
LL | let _: *mut T = core::intrinsics::transmute(t);
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *mut T`
2020

2121
error: transmute from a reference to a pointer
22-
--> $DIR/transmute.rs:28:23
22+
--> $DIR/transmute.rs:27:23
2323
|
2424
LL | let _: *const U = core::intrinsics::transmute(t);
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *const U`
2626

2727
error: transmute from a type (`std::vec::Vec<i32>`) to itself
28-
--> $DIR/transmute.rs:34:27
28+
--> $DIR/transmute.rs:33:27
2929
|
3030
LL | let _: Vec<i32> = core::intrinsics::transmute(my_vec());
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3232

3333
error: transmute from a type (`std::vec::Vec<i32>`) to itself
34-
--> $DIR/transmute.rs:36:27
34+
--> $DIR/transmute.rs:35:27
3535
|
3636
LL | let _: Vec<i32> = core::mem::transmute(my_vec());
3737
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3838

3939
error: transmute from a type (`std::vec::Vec<i32>`) to itself
40-
--> $DIR/transmute.rs:38:27
40+
--> $DIR/transmute.rs:37:27
4141
|
4242
LL | let _: Vec<i32> = std::intrinsics::transmute(my_vec());
4343
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4444

4545
error: transmute from a type (`std::vec::Vec<i32>`) to itself
46-
--> $DIR/transmute.rs:40:27
46+
--> $DIR/transmute.rs:39:27
4747
|
4848
LL | let _: Vec<i32> = std::mem::transmute(my_vec());
4949
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5050

5151
error: transmute from a type (`std::vec::Vec<i32>`) to itself
52-
--> $DIR/transmute.rs:42:27
52+
--> $DIR/transmute.rs:41:27
5353
|
5454
LL | let _: Vec<i32> = my_transmute(my_vec());
5555
| ^^^^^^^^^^^^^^^^^^^^^^
5656

5757
error: transmute from an integer to a pointer
58-
--> $DIR/transmute.rs:44:31
58+
--> $DIR/transmute.rs:43:31
5959
|
6060
LL | let _: *const usize = std::mem::transmute(5_isize);
6161
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `5_isize as *const usize`
6262

6363
error: transmute from an integer to a pointer
64-
--> $DIR/transmute.rs:48:31
64+
--> $DIR/transmute.rs:47:31
6565
|
6666
LL | let _: *const usize = std::mem::transmute(1 + 1usize);
6767
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(1 + 1usize) as *const usize`
6868

6969
error: transmute from a type (`*const Usize`) to the type that it points to (`Usize`)
70-
--> $DIR/transmute.rs:63:24
70+
--> $DIR/transmute.rs:62:24
7171
|
7272
LL | let _: Usize = core::intrinsics::transmute(int_const_ptr);
7373
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7474
|
7575
= note: `-D clippy::crosspointer-transmute` implied by `-D warnings`
7676

7777
error: transmute from a type (`*mut Usize`) to the type that it points to (`Usize`)
78-
--> $DIR/transmute.rs:65:24
78+
--> $DIR/transmute.rs:64:24
7979
|
8080
LL | let _: Usize = core::intrinsics::transmute(int_mut_ptr);
8181
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8282

8383
error: transmute from a type (`Usize`) to a pointer to that type (`*const Usize`)
84-
--> $DIR/transmute.rs:67:31
84+
--> $DIR/transmute.rs:66:31
8585
|
8686
LL | let _: *const Usize = core::intrinsics::transmute(my_int());
8787
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8888

8989
error: transmute from a type (`Usize`) to a pointer to that type (`*mut Usize`)
90-
--> $DIR/transmute.rs:69:29
90+
--> $DIR/transmute.rs:68:29
9191
|
9292
LL | let _: *mut Usize = core::intrinsics::transmute(my_int());
9393
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9494

9595
error: transmute from a `u32` to a `char`
96-
--> $DIR/transmute.rs:75:28
96+
--> $DIR/transmute.rs:74:28
9797
|
9898
LL | let _: char = unsafe { std::mem::transmute(0_u32) };
9999
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::char::from_u32(0_u32).unwrap()`
100100
|
101101
= note: `-D clippy::transmute-int-to-char` implied by `-D warnings`
102102

103103
error: transmute from a `i32` to a `char`
104-
--> $DIR/transmute.rs:76:28
104+
--> $DIR/transmute.rs:75:28
105105
|
106106
LL | let _: char = unsafe { std::mem::transmute(0_i32) };
107107
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::char::from_u32(0_i32 as u32).unwrap()`
108108

109109
error: transmute from a `u8` to a `bool`
110-
--> $DIR/transmute.rs:81:28
110+
--> $DIR/transmute.rs:80:28
111111
|
112112
LL | let _: bool = unsafe { std::mem::transmute(0_u8) };
113113
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `0_u8 != 0`
114114
|
115115
= note: `-D clippy::transmute-int-to-bool` implied by `-D warnings`
116116

117117
error: transmute from a `u32` to a `f32`
118-
--> $DIR/transmute.rs:87:31
118+
--> $DIR/transmute.rs:86:31
119119
|
120120
LL | let _: f32 = unsafe { std::mem::transmute(0_u32) };
121121
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f32::from_bits(0_u32)`
122122
|
123123
= note: `-D clippy::transmute-int-to-float` implied by `-D warnings`
124124

125125
error: transmute from a `i32` to a `f32`
126-
--> $DIR/transmute.rs:88:31
126+
--> $DIR/transmute.rs:87:31
127127
|
128128
LL | let _: f32 = unsafe { std::mem::transmute(0_i32) };
129129
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f32::from_bits(0_i32 as u32)`
130130

131131
error: transmute from a `u64` to a `f64`
132-
--> $DIR/transmute.rs:89:31
132+
--> $DIR/transmute.rs:88:31
133133
|
134134
LL | let _: f64 = unsafe { std::mem::transmute(0_u64) };
135135
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f64::from_bits(0_u64)`
136136

137137
error: transmute from a `i64` to a `f64`
138-
--> $DIR/transmute.rs:90:31
138+
--> $DIR/transmute.rs:89:31
139139
|
140140
LL | let _: f64 = unsafe { std::mem::transmute(0_i64) };
141141
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `f64::from_bits(0_i64 as u64)`
142142

143143
error: transmute from a `&[u8]` to a `&str`
144-
--> $DIR/transmute.rs:108:28
144+
--> $DIR/transmute.rs:107:28
145145
|
146146
LL | let _: &str = unsafe { std::mem::transmute(b) };
147147
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8(b).unwrap()`
148148
|
149149
= note: `-D clippy::transmute-bytes-to-str` implied by `-D warnings`
150150

151151
error: transmute from a `&mut [u8]` to a `&mut str`
152-
--> $DIR/transmute.rs:109:32
152+
--> $DIR/transmute.rs:108:32
153153
|
154154
LL | let _: &mut str = unsafe { std::mem::transmute(mb) };
155155
| ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8_mut(mb).unwrap()`

tests/ui/transmute_float_to_int.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(const_fn_transmute)]
21
#![warn(clippy::transmute_float_to_int)]
32

43
fn float_to_int() {

tests/ui/transmute_float_to_int.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
error: transmute from a `f32` to a `u32`
2-
--> $DIR/transmute_float_to_int.rs:5:27
2+
--> $DIR/transmute_float_to_int.rs:4:27
33
|
44
LL | let _: u32 = unsafe { std::mem::transmute(1f32) };
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f32.to_bits()`
66
|
77
= note: `-D clippy::transmute-float-to-int` implied by `-D warnings`
88

99
error: transmute from a `f32` to a `i32`
10-
--> $DIR/transmute_float_to_int.rs:6:27
10+
--> $DIR/transmute_float_to_int.rs:5:27
1111
|
1212
LL | let _: i32 = unsafe { std::mem::transmute(1f32) };
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f32.to_bits() as i32`
1414

1515
error: transmute from a `f64` to a `u64`
16-
--> $DIR/transmute_float_to_int.rs:7:27
16+
--> $DIR/transmute_float_to_int.rs:6:27
1717
|
1818
LL | let _: u64 = unsafe { std::mem::transmute(1f64) };
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f64.to_bits()`
2020

2121
error: transmute from a `f64` to a `i64`
22-
--> $DIR/transmute_float_to_int.rs:8:27
22+
--> $DIR/transmute_float_to_int.rs:7:27
2323
|
2424
LL | let _: i64 = unsafe { std::mem::transmute(1f64) };
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1f64.to_bits() as i64`
2626

2727
error: transmute from a `f64` to a `u64`
28-
--> $DIR/transmute_float_to_int.rs:9:27
28+
--> $DIR/transmute_float_to_int.rs:8:27
2929
|
3030
LL | let _: u64 = unsafe { std::mem::transmute(1.0) };
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `1.0f64.to_bits()`
3232

3333
error: transmute from a `f64` to a `u64`
34-
--> $DIR/transmute_float_to_int.rs:10:27
34+
--> $DIR/transmute_float_to_int.rs:9:27
3535
|
3636
LL | let _: u64 = unsafe { std::mem::transmute(-1.0) };
3737
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(-1.0f64).to_bits()`

0 commit comments

Comments
 (0)