Skip to content

core::ffi::VaList does not pass improper_ctypes lint #58280

@dlrobertson

Description

@dlrobertson

Summary

On x86_64, Aarch64, and PowerPC core::ffi::VaList will not pass the improper_ctypes lint, but it should.

Example

Given the following:

#![no_std]
#![feature(c_variadic)]
#![deny(improper_ctypes)]
use core::ffi::VaList;

extern "C" {
    pub fn some_fn(_: i32, _: VaList);
}

The compiler will yield:

error: `extern` block uses type `()` which is not FFI-safe: tuples have unspecified layout
 --> test.rs:7:31
  |
7 |     pub fn some_fn(_: i32, _: VaList);
  |                               ^^^^^^
  |
note: lint level defined here
 --> test.rs:3:9
  |
3 | #![deny(improper_ctypes)]
  |         ^^^^^^^^^^^^^^^
  = help: consider using a struct instead

error: aborting due to previous error

Description

The implementation of VaListImpl for the x86_64, Aarch64, and PowerPC architectures uses *mut () or *const () as the pointer type for the pointers to the architecture specific save areas (e.g., the x86_64 implementation).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions