Skip to content

Fix improper_ctypes warnings in Rust Nightly #24684

@SimonSapin

Description

@SimonSapin

Steps:

  • Make a branch up to date with origin/master
  • Run ./mach rustup, which updates the rust-toolchain file
  • Run ./mach build
  • See many warnings like
    warning: `extern` fn uses type `script_runtime::JSContext`, which is not FFI-safe
       --> components/script/script_runtime.rs:829:56
        |
    829 | unsafe extern "C" fn report_stream_error_callback(_cx: *mut JSContext, error_code: usize) {
        |                                                        ^^^^^^^^^^^^^^ not FFI-safe
        |
        = note: `#[warn(improper_ctypes)]` on by default
        = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
        = note: this struct has unspecified layout
  • Find a way to fix them. This may involve upgrading rust-bindgen, or making changes rust-bindgen and then upgrading to a version with those changes
  • Revert the rust-toolchain change
  • Submit a PR

We don’t need to upgrade the Rust version yet, but the next time we do those warnings would block landing the upgrade unless we change CI to allow build warnings.

Is suspect that rust-lang/rust#65134 is what introduced these warnings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-more-complexVariable effort required; may require a mentor. Recommended solution is clearly described in the iss

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions