Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

ices/80125.rs: fixed with no errors #1620

Merged
merged 1 commit into from
Jul 8, 2023
Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Jul 4, 2023

Issue: rust-lang/rust#80125

type ExternCallback = extern "C" fn(*const u8, u32, str);

pub struct Struct(ExternCallback);

#[no_mangle]
pub extern "C" fn register_something(bind: ExternCallback) -> Struct {
    Struct(bind)
}

fn main() {}
=== stdout ===
=== stderr ===
warning: `extern` fn uses type `str`, which is not FFI-safe
 --> /home/runner/work/glacier/glacier/ices/80125.rs:1:23
  |
1 | type ExternCallback = extern "C" fn(*const u8, u32, str);
  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
  |
  = help: consider using `*const u8` and a length instead
  = note: string slices have no C equivalent
  = note: `#[warn(improper_ctypes_definitions)]` on by default

warning: `extern` fn uses type `str`, which is not FFI-safe
 --> /home/runner/work/glacier/glacier/ices/80125.rs:6:44
  |
6 | pub extern "C" fn register_something(bind: ExternCallback) -> Struct {
  |                                            ^^^^^^^^^^^^^^ not FFI-safe
  |
  = help: consider using `*const u8` and a length instead
  = note: string slices have no C equivalent

warning: `extern` fn uses type `Struct`, which is not FFI-safe
 --> /home/runner/work/glacier/glacier/ices/80125.rs:6:63
  |
6 | pub extern "C" fn register_something(bind: ExternCallback) -> Struct {
  |                                                               ^^^^^^ not FFI-safe
  |
  = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
  = note: this struct has unspecified layout
note: the type is defined here
 --> /home/runner/work/glacier/glacier/ices/80125.rs:3:1
  |
3 | pub struct Struct(ExternCallback);
  | ^^^^^^^^^^^^^^^^^

warning: 3 warnings emitted

==============

=== stdout ===
=== stderr ===
warning: `extern` fn uses type `str`, which is not FFI-safe
 --> /home/runner/work/glacier/glacier/ices/80125.rs:1:23
  |
1 | type ExternCallback = extern "C" fn(*const u8, u32, str);
  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
  |
  = help: consider using `*const u8` and a length instead
  = note: string slices have no C equivalent
  = note: `#[warn(improper_ctypes_definitions)]` on by default

warning: `extern` fn uses type `str`, which is not FFI-safe
 --> /home/runner/work/glacier/glacier/ices/80125.rs:6:44
  |
6 | pub extern "C" fn register_something(bind: ExternCallback) -> Struct {
  |                                            ^^^^^^^^^^^^^^ not FFI-safe
  |
  = help: consider using `*const u8` and a length instead
  = note: string slices have no C equivalent

warning: `extern` fn uses type `Struct`, which is not FFI-safe
 --> /home/runner/work/glacier/glacier/ices/80125.rs:6:63
  |
6 | pub extern "C" fn register_something(bind: ExternCallback) -> Struct {
  |                                                               ^^^^^^ not FFI-safe
  |
  = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
  = note: this struct has unspecified layout
note: the type is defined here
 --> /home/runner/work/glacier/glacier/ices/80125.rs:3:1
  |
3 | pub struct Struct(ExternCallback);
  | ^^^^^^^^^^^^^^^^^

warning: 3 warnings emitted

==============
@JohnTitor JohnTitor merged commit b98888c into master Jul 8, 2023
@JohnTitor JohnTitor deleted the autofix/ices/80125.rs branch July 8, 2023 02:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants