improper_ctypes incorrectly warns on projections featuring opaque types · Issue #73251 · rust-lang/rust (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@lcnr

Description

@lcnr

cc @davidtwco

#![feature(type_alias_impl_trait)]

pub trait Foo { type Assoc; }

impl Foo for () { type Assoc = u32; }

type Bar = impl Foo;

fn assign() -> Bar {}

extern "C" { pub fn lint_me() -> ::Assoc; }

Gives the following incorrect warning:

warning: `extern` block uses type `Bar`, which is not FFI-safe
  --> src/lib.rs:16:25
   |
16 |     pub fn lint_me() -> <Bar as Foo>::Assoc;
   |                         ^^^^^^^^^^^^^^^^^^^ not FFI-safe
   |
   = note: `#[warn(improper_ctypes)]` on by default
   = note: opaque types have no C equivalent

warning: 1 warning emitted