Skip to content

Commit 8d82555

Browse files
committed
Remove i128 and u128 from improper_ctypes_definitions
Rust's 128-bit integers have historically been incompatible with C [1]. However, there have been a number of changes in Rust and LLVM that mean this is no longer the case: * Incorrect alignment of `i128` on x86 [1]: adjusting Rust's alignment proposed at rust-lang/compiler-team#683, implemented at rust-lang#116672. * LLVM version of the above: resolved in LLVM, including ABI fix. Present in LLVM18 (our minimum supported version). * Incorrect alignment of `i128` on 64-bit PowerPC, SPARC, and MIPS [2]: Rust's data layouts adjusted at rust-lang#132422, rust-lang#132741, rust-lang#134115. * LLVM version of the above: done in LLVM 20 llvm/llvm-project#102783. * Incorrect return convention of `i128` on Windows: adjusted to match GCC and Clang at rust-lang#134290. At [3], the lang team considered it acceptable to remove `i128` from `improper_ctypes_definitions` if the LLVM version is known to be compatible. Time has elapsed since then and we have dropped support for LLVM versions that do not have the x86 fixes, meaning a per-llvm-version lint should no longer be necessary. The PowerPC, SPARC, and MIPS changes only came in LLVM 20 but since Rust's datalayouts have also been updated to match, we will be using the correct alignment regardless of LLVM version. `repr(i128)` was added to this lint in [4], but is also removed here. Part of the decision is that `i128` should match `__int128` in C on platforms that provide it, which documentation is updated to indicate. We will not guarantee that `i128` matches `_BitInt(128)` since that can be different from `__int128`. Some platforms (usually 32-bit) do not provide `__int128`; if any ABIs are extended in the future to define it, we will need to make sure that our ABI matches. Closes: rust-lang#134288 Closes: rust-lang#128950 [1]: rust-lang#54341 [2]: rust-lang#128950 [3]: rust-lang/lang-team#255 (comment) [4]: rust-lang#138282
1 parent 7205fc5 commit 8d82555

11 files changed

+75
-235
lines changed

compiler/rustc_lint/messages.ftl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,6 @@ lint_improper_ctypes = `extern` {$desc} uses type `{$ty}`, which is not FFI-safe
372372
.label = not FFI-safe
373373
.note = the type is defined here
374374
375-
lint_improper_ctypes_128bit = 128-bit integers don't currently have a known stable ABI
376-
377375
lint_improper_ctypes_array_help = consider passing a pointer to the array
378376
379377
lint_improper_ctypes_array_reason = passing raw arrays by value is not FFI-safe

compiler/rustc_lint/src/types.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use std::iter;
22
use std::ops::ControlFlow;
33

4-
use rustc_abi::{
5-
BackendRepr, Integer, IntegerType, TagEncoding, VariantIdx, Variants, WrappingRange,
6-
};
4+
use rustc_abi::{BackendRepr, TagEncoding, VariantIdx, Variants, WrappingRange};
75
use rustc_data_structures::fx::FxHashSet;
86
use rustc_errors::DiagMessage;
97
use rustc_hir::intravisit::VisitorExt;
@@ -1274,14 +1272,6 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
12741272
};
12751273
}
12761274

1277-
if let Some(IntegerType::Fixed(Integer::I128, _)) = def.repr().int {
1278-
return FfiUnsafe {
1279-
ty,
1280-
reason: fluent::lint_improper_ctypes_128bit,
1281-
help: None,
1282-
};
1283-
}
1284-
12851275
use improper_ctypes::check_non_exhaustive_variant;
12861276

12871277
let non_exhaustive = def.variant_list_has_applicable_non_exhaustive();
@@ -1314,10 +1304,6 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
13141304
// but only the base type is relevant for being representable in FFI.
13151305
ty::Pat(base, ..) => self.check_type_for_ffi(acc, base),
13161306

1317-
ty::Int(ty::IntTy::I128) | ty::Uint(ty::UintTy::U128) => {
1318-
FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_128bit, help: None }
1319-
}
1320-
13211307
// Primitive types with a stable representation.
13221308
ty::Bool | ty::Int(..) | ty::Uint(..) | ty::Float(..) | ty::Never => FfiSafe,
13231309

library/core/src/primitive_docs.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,18 @@ mod prim_i64 {}
14281428
#[rustc_doc_primitive = "i128"]
14291429
//
14301430
/// The 128-bit signed integer type.
1431+
///
1432+
/// # ABI compatibility
1433+
///
1434+
/// Rust's `i128` is expected to be ABI-compatible with C's `__int128` on platforms where the type
1435+
/// is available, which includes most 64-bit architectures. If any platforms that do not specify
1436+
/// `__int128` are updated to introduce it, the Rust `i128` ABI on relevant targets will be changed
1437+
/// to match.
1438+
///
1439+
/// It is important to note that in C, `__int128` is _not_ the same as `_BitInt(128)`, and the two
1440+
/// types are allowed to have different ABIs. In particular, on x86, `__int128` and `_BitInt(128)`
1441+
/// do not use the same alignment. `i128` is intended to always match `__int128` and does not
1442+
/// attempt to match `_BitInt(128)` on platforms without `__int128`.
14311443
#[stable(feature = "i128", since = "1.26.0")]
14321444
mod prim_i128 {}
14331445

@@ -1458,6 +1470,8 @@ mod prim_u64 {}
14581470
#[rustc_doc_primitive = "u128"]
14591471
//
14601472
/// The 128-bit unsigned integer type.
1473+
///
1474+
/// Please see [the documentation for `i128`](prim@i128) for information on ABI compatibility.
14611475
#[stable(feature = "i128", since = "1.26.0")]
14621476
mod prim_u128 {}
14631477

tests/ui/asm/naked-functions-ffi.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ use std::arch::naked_asm;
77
#[unsafe(naked)]
88
pub extern "C" fn naked(p: char) -> u128 {
99
//~^ WARN uses type `char`
10-
//~| WARN uses type `u128`
1110
naked_asm!("")
1211
}

tests/ui/asm/naked-functions-ffi.stderr

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,5 @@ LL | pub extern "C" fn naked(p: char) -> u128 {
88
= note: the `char` type has no C equivalent
99
= note: `#[warn(improper_ctypes_definitions)]` on by default
1010

11-
warning: `extern` fn uses type `u128`, which is not FFI-safe
12-
--> $DIR/naked-functions-ffi.rs:8:37
13-
|
14-
LL | pub extern "C" fn naked(p: char) -> u128 {
15-
| ^^^^ not FFI-safe
16-
|
17-
= note: 128-bit integers don't currently have a known stable ABI
18-
19-
warning: 2 warnings emitted
11+
warning: 1 warning emitted
2012

tests/ui/lint/lint-ctypes-enum.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ extern "C" {
8787
fn repr_c(x: ReprC);
8888
fn repr_u8(x: U8);
8989
fn repr_isize(x: Isize);
90-
fn repr_u128(x: U128); //~ ERROR `extern` block uses type `U128`
91-
fn repr_i128(x: I128); //~ ERROR `extern` block uses type `I128`
90+
fn repr_u128(x: U128);
91+
fn repr_i128(x: I128);
9292
fn option_ref(x: Option<&'static u8>);
9393
fn option_fn(x: Option<extern "C" fn()>);
9494
fn option_nonnull(x: Option<std::ptr::NonNull<u8>>);
@@ -98,14 +98,12 @@ extern "C" {
9898
fn option_nonzero_u32(x: Option<num::NonZero<u32>>);
9999
fn option_nonzero_u64(x: Option<num::NonZero<u64>>);
100100
fn option_nonzero_u128(x: Option<num::NonZero<u128>>);
101-
//~^ ERROR `extern` block uses type `u128`
102101
fn option_nonzero_usize(x: Option<num::NonZero<usize>>);
103102
fn option_nonzero_i8(x: Option<num::NonZero<i8>>);
104103
fn option_nonzero_i16(x: Option<num::NonZero<i16>>);
105104
fn option_nonzero_i32(x: Option<num::NonZero<i32>>);
106105
fn option_nonzero_i64(x: Option<num::NonZero<i64>>);
107106
fn option_nonzero_i128(x: Option<num::NonZero<i128>>);
108-
//~^ ERROR `extern` block uses type `i128`
109107
fn option_nonzero_isize(x: Option<num::NonZero<isize>>);
110108
fn option_transparent_struct(x: Option<TransparentStruct<num::NonZero<u8>>>);
111109
fn option_transparent_enum(x: Option<TransparentEnum<num::NonZero<u8>>>);
@@ -123,14 +121,12 @@ extern "C" {
123121
fn result_nonzero_u32_t(x: Result<num::NonZero<u32>, ()>);
124122
fn result_nonzero_u64_t(x: Result<num::NonZero<u64>, ()>);
125123
fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>);
126-
//~^ ERROR `extern` block uses type `u128`
127124
fn result_nonzero_usize_t(x: Result<num::NonZero<usize>, ()>);
128125
fn result_nonzero_i8_t(x: Result<num::NonZero<i8>, ()>);
129126
fn result_nonzero_i16_t(x: Result<num::NonZero<i16>, ()>);
130127
fn result_nonzero_i32_t(x: Result<num::NonZero<i32>, ()>);
131128
fn result_nonzero_i64_t(x: Result<num::NonZero<i64>, ()>);
132129
fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>);
133-
//~^ ERROR `extern` block uses type `i128`
134130
fn result_nonzero_isize_t(x: Result<num::NonZero<isize>, ()>);
135131
fn result_transparent_struct_t(x: Result<TransparentStruct<num::NonZero<u8>>, ()>);
136132
fn result_transparent_enum_t(x: Result<TransparentEnum<num::NonZero<u8>>, ()>);
@@ -161,14 +157,12 @@ extern "C" {
161157
fn result_nonzero_u32_e(x: Result<(), num::NonZero<u32>>);
162158
fn result_nonzero_u64_e(x: Result<(), num::NonZero<u64>>);
163159
fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>);
164-
//~^ ERROR `extern` block uses type `u128`
165160
fn result_nonzero_usize_e(x: Result<(), num::NonZero<usize>>);
166161
fn result_nonzero_i8_e(x: Result<(), num::NonZero<i8>>);
167162
fn result_nonzero_i16_e(x: Result<(), num::NonZero<i16>>);
168163
fn result_nonzero_i32_e(x: Result<(), num::NonZero<i32>>);
169164
fn result_nonzero_i64_e(x: Result<(), num::NonZero<i64>>);
170165
fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>);
171-
//~^ ERROR `extern` block uses type `i128`
172166
fn result_nonzero_isize_e(x: Result<(), num::NonZero<isize>>);
173167
fn result_transparent_struct_e(x: Result<(), TransparentStruct<num::NonZero<u8>>>);
174168
fn result_transparent_enum_e(x: Result<(), TransparentEnum<num::NonZero<u8>>>);

tests/ui/lint/lint-ctypes-enum.stderr

Lines changed: 19 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -45,50 +45,8 @@ note: the type is defined here
4545
LL | enum T {
4646
| ^^^^^^
4747

48-
error: `extern` block uses type `U128`, which is not FFI-safe
49-
--> $DIR/lint-ctypes-enum.rs:90:21
50-
|
51-
LL | fn repr_u128(x: U128);
52-
| ^^^^ not FFI-safe
53-
|
54-
= note: 128-bit integers don't currently have a known stable ABI
55-
note: the type is defined here
56-
--> $DIR/lint-ctypes-enum.rs:46:1
57-
|
58-
LL | enum U128 {
59-
| ^^^^^^^^^
60-
61-
error: `extern` block uses type `I128`, which is not FFI-safe
62-
--> $DIR/lint-ctypes-enum.rs:91:21
63-
|
64-
LL | fn repr_i128(x: I128);
65-
| ^^^^ not FFI-safe
66-
|
67-
= note: 128-bit integers don't currently have a known stable ABI
68-
note: the type is defined here
69-
--> $DIR/lint-ctypes-enum.rs:53:1
70-
|
71-
LL | enum I128 {
72-
| ^^^^^^^^^
73-
74-
error: `extern` block uses type `u128`, which is not FFI-safe
75-
--> $DIR/lint-ctypes-enum.rs:100:31
76-
|
77-
LL | fn option_nonzero_u128(x: Option<num::NonZero<u128>>);
78-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
79-
|
80-
= note: 128-bit integers don't currently have a known stable ABI
81-
82-
error: `extern` block uses type `i128`, which is not FFI-safe
83-
--> $DIR/lint-ctypes-enum.rs:107:31
84-
|
85-
LL | fn option_nonzero_i128(x: Option<num::NonZero<i128>>);
86-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
87-
|
88-
= note: 128-bit integers don't currently have a known stable ABI
89-
9048
error: `extern` block uses type `Option<TransparentUnion<NonZero<u8>>>`, which is not FFI-safe
91-
--> $DIR/lint-ctypes-enum.rs:112:36
49+
--> $DIR/lint-ctypes-enum.rs:110:36
9250
|
9351
LL | fn option_transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>);
9452
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -97,7 +55,7 @@ LL | fn option_transparent_union(x: Option<TransparentUnion<num::NonZero<u8>
9755
= note: enum has no representation hint
9856

9957
error: `extern` block uses type `Option<Rust<NonZero<u8>>>`, which is not FFI-safe
100-
--> $DIR/lint-ctypes-enum.rs:114:28
58+
--> $DIR/lint-ctypes-enum.rs:112:28
10159
|
10260
LL | fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>);
10361
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -106,32 +64,16 @@ LL | fn option_repr_rust(x: Option<Rust<num::NonZero<u8>>>);
10664
= note: enum has no representation hint
10765

10866
error: `extern` block uses type `Option<u8>`, which is not FFI-safe
109-
--> $DIR/lint-ctypes-enum.rs:115:21
67+
--> $DIR/lint-ctypes-enum.rs:113:21
11068
|
11169
LL | fn option_u8(x: Option<u8>);
11270
| ^^^^^^^^^^ not FFI-safe
11371
|
11472
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
11573
= note: enum has no representation hint
11674

117-
error: `extern` block uses type `u128`, which is not FFI-safe
118-
--> $DIR/lint-ctypes-enum.rs:125:33
119-
|
120-
LL | fn result_nonzero_u128_t(x: Result<num::NonZero<u128>, ()>);
121-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
122-
|
123-
= note: 128-bit integers don't currently have a known stable ABI
124-
125-
error: `extern` block uses type `i128`, which is not FFI-safe
126-
--> $DIR/lint-ctypes-enum.rs:132:33
127-
|
128-
LL | fn result_nonzero_i128_t(x: Result<num::NonZero<i128>, ()>);
129-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
130-
|
131-
= note: 128-bit integers don't currently have a known stable ABI
132-
13375
error: `extern` block uses type `Result<TransparentUnion<NonZero<u8>>, ()>`, which is not FFI-safe
134-
--> $DIR/lint-ctypes-enum.rs:137:38
76+
--> $DIR/lint-ctypes-enum.rs:133:38
13577
|
13678
LL | fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u8>>, ()>);
13779
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -140,7 +82,7 @@ LL | fn result_transparent_union_t(x: Result<TransparentUnion<num::NonZero<u
14082
= note: enum has no representation hint
14183

14284
error: `extern` block uses type `Result<Rust<NonZero<u8>>, ()>`, which is not FFI-safe
143-
--> $DIR/lint-ctypes-enum.rs:139:30
85+
--> $DIR/lint-ctypes-enum.rs:135:30
14486
|
14587
LL | fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>);
14688
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -149,7 +91,7 @@ LL | fn result_repr_rust_t(x: Result<Rust<num::NonZero<u8>>, ()>);
14991
= note: enum has no representation hint
15092

15193
error: `extern` block uses type `Result<NonZero<u8>, U>`, which is not FFI-safe
152-
--> $DIR/lint-ctypes-enum.rs:143:51
94+
--> $DIR/lint-ctypes-enum.rs:139:51
15395
|
15496
LL | fn result_1zst_exhaustive_single_variant_t(x: Result<num::NonZero<u8>, U>);
15597
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -158,7 +100,7 @@ LL | fn result_1zst_exhaustive_single_variant_t(x: Result<num::NonZero<u8>,
158100
= note: enum has no representation hint
159101

160102
error: `extern` block uses type `Result<NonZero<u8>, B>`, which is not FFI-safe
161-
--> $DIR/lint-ctypes-enum.rs:145:53
103+
--> $DIR/lint-ctypes-enum.rs:141:53
162104
|
163105
LL | fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8>, B>);
164106
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -167,7 +109,7 @@ LL | fn result_1zst_exhaustive_multiple_variant_t(x: Result<num::NonZero<u8>
167109
= note: enum has no representation hint
168110

169111
error: `extern` block uses type `Result<NonZero<u8>, NonExhaustive>`, which is not FFI-safe
170-
--> $DIR/lint-ctypes-enum.rs:147:51
112+
--> $DIR/lint-ctypes-enum.rs:143:51
171113
|
172114
LL | fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>, NonExhaustive>);
173115
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -176,7 +118,7 @@ LL | fn result_1zst_non_exhaustive_no_variant_t(x: Result<num::NonZero<u8>,
176118
= note: enum has no representation hint
177119

178120
error: `extern` block uses type `Result<NonZero<u8>, Field>`, which is not FFI-safe
179-
--> $DIR/lint-ctypes-enum.rs:150:49
121+
--> $DIR/lint-ctypes-enum.rs:146:49
180122
|
181123
LL | fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Field>);
182124
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -185,32 +127,16 @@ LL | fn result_1zst_exhaustive_single_field_t(x: Result<num::NonZero<u8>, Fi
185127
= note: enum has no representation hint
186128

187129
error: `extern` block uses type `Result<Result<(), NonZero<u8>>, ()>`, which is not FFI-safe
188-
--> $DIR/lint-ctypes-enum.rs:152:30
130+
--> $DIR/lint-ctypes-enum.rs:148:30
189131
|
190132
LL | fn result_cascading_t(x: Result<Result<(), num::NonZero<u8>>, ()>);
191133
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
192134
|
193135
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
194136
= note: enum has no representation hint
195137

196-
error: `extern` block uses type `u128`, which is not FFI-safe
197-
--> $DIR/lint-ctypes-enum.rs:163:33
198-
|
199-
LL | fn result_nonzero_u128_e(x: Result<(), num::NonZero<u128>>);
200-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
201-
|
202-
= note: 128-bit integers don't currently have a known stable ABI
203-
204-
error: `extern` block uses type `i128`, which is not FFI-safe
205-
--> $DIR/lint-ctypes-enum.rs:170:33
206-
|
207-
LL | fn result_nonzero_i128_e(x: Result<(), num::NonZero<i128>>);
208-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
209-
|
210-
= note: 128-bit integers don't currently have a known stable ABI
211-
212138
error: `extern` block uses type `Result<(), TransparentUnion<NonZero<u8>>>`, which is not FFI-safe
213-
--> $DIR/lint-ctypes-enum.rs:175:38
139+
--> $DIR/lint-ctypes-enum.rs:169:38
214140
|
215141
LL | fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZero<u8>>>);
216142
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -219,7 +145,7 @@ LL | fn result_transparent_union_e(x: Result<(), TransparentUnion<num::NonZe
219145
= note: enum has no representation hint
220146

221147
error: `extern` block uses type `Result<(), Rust<NonZero<u8>>>`, which is not FFI-safe
222-
--> $DIR/lint-ctypes-enum.rs:177:30
148+
--> $DIR/lint-ctypes-enum.rs:171:30
223149
|
224150
LL | fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>);
225151
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -228,7 +154,7 @@ LL | fn result_repr_rust_e(x: Result<(), Rust<num::NonZero<u8>>>);
228154
= note: enum has no representation hint
229155

230156
error: `extern` block uses type `Result<U, NonZero<u8>>`, which is not FFI-safe
231-
--> $DIR/lint-ctypes-enum.rs:181:51
157+
--> $DIR/lint-ctypes-enum.rs:175:51
232158
|
233159
LL | fn result_1zst_exhaustive_single_variant_e(x: Result<U, num::NonZero<u8>>);
234160
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -237,7 +163,7 @@ LL | fn result_1zst_exhaustive_single_variant_e(x: Result<U, num::NonZero<u8
237163
= note: enum has no representation hint
238164

239165
error: `extern` block uses type `Result<B, NonZero<u8>>`, which is not FFI-safe
240-
--> $DIR/lint-ctypes-enum.rs:183:53
166+
--> $DIR/lint-ctypes-enum.rs:177:53
241167
|
242168
LL | fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero<u8>>);
243169
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -246,7 +172,7 @@ LL | fn result_1zst_exhaustive_multiple_variant_e(x: Result<B, num::NonZero<
246172
= note: enum has no representation hint
247173

248174
error: `extern` block uses type `Result<NonExhaustive, NonZero<u8>>`, which is not FFI-safe
249-
--> $DIR/lint-ctypes-enum.rs:185:51
175+
--> $DIR/lint-ctypes-enum.rs:179:51
250176
|
251177
LL | fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num::NonZero<u8>>);
252178
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -255,7 +181,7 @@ LL | fn result_1zst_non_exhaustive_no_variant_e(x: Result<NonExhaustive, num
255181
= note: enum has no representation hint
256182

257183
error: `extern` block uses type `Result<Field, NonZero<u8>>`, which is not FFI-safe
258-
--> $DIR/lint-ctypes-enum.rs:188:49
184+
--> $DIR/lint-ctypes-enum.rs:182:49
259185
|
260186
LL | fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero<u8>>);
261187
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -264,7 +190,7 @@ LL | fn result_1zst_exhaustive_single_field_e(x: Result<Field, num::NonZero<
264190
= note: enum has no representation hint
265191

266192
error: `extern` block uses type `Result<(), Result<(), NonZero<u8>>>`, which is not FFI-safe
267-
--> $DIR/lint-ctypes-enum.rs:190:30
193+
--> $DIR/lint-ctypes-enum.rs:184:30
268194
|
269195
LL | fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>);
270196
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -273,13 +199,13 @@ LL | fn result_cascading_e(x: Result<(), Result<(), num::NonZero<u8>>>);
273199
= note: enum has no representation hint
274200

275201
error: `extern` block uses type `Result<(), ()>`, which is not FFI-safe
276-
--> $DIR/lint-ctypes-enum.rs:192:27
202+
--> $DIR/lint-ctypes-enum.rs:186:27
277203
|
278204
LL | fn result_unit_t_e(x: Result<(), ()>);
279205
| ^^^^^^^^^^^^^^ not FFI-safe
280206
|
281207
= help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
282208
= note: enum has no representation hint
283209

284-
error: aborting due to 29 previous errors
210+
error: aborting due to 21 previous errors
285211

0 commit comments

Comments
 (0)