-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lint: check for unit ret type after normalization
This commit moves the check that skips unit return types to after where the return type has been normalized - therefore ensuring that FFI-safety lints are not emitted for types which normalize to unit. Signed-off-by: David Wood <david@davidtw.co>
- Loading branch information
Showing
3 changed files
with
26 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,20 @@ | ||
error: `extern` block uses type `()`, which is not FFI-safe | ||
--> $DIR/lint-ctypes-66202.rs:11:27 | ||
error: `extern` block uses type `W<()>`, which is not FFI-safe | ||
--> $DIR/lint-ctypes-66202.rs:12:29 | ||
| | ||
LL | pub fn normalize() -> <() as ToOwned>::Owned; | ||
| ^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe | ||
LL | pub fn transparent() -> W<()>; | ||
| ^^^^^ not FFI-safe | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/lint-ctypes-66202.rs:1:9 | ||
| | ||
LL | #![deny(improper_ctypes)] | ||
| ^^^^^^^^^^^^^^^ | ||
= help: consider using a struct instead | ||
= note: tuples have unspecified layout | ||
|
||
error: `extern` block uses type `W<()>`, which is not FFI-safe | ||
--> $DIR/lint-ctypes-66202.rs:13:29 | ||
| | ||
LL | pub fn transparent() -> W<()>; | ||
| ^^^^^ not FFI-safe | ||
| | ||
= note: composed only of `PhantomData` | ||
note: the type is defined here | ||
--> $DIR/lint-ctypes-66202.rs:7:1 | ||
| | ||
LL | pub struct W<T>(T); | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
error: aborting due to previous error | ||
|