Skip to content

Better warnings for types with the same name as rust types #1382

@akshayknarayan

Description

@akshayknarayan

Input C/C++ Header

See invocation below

Bindgen Invocation

    bindgen::builder()
        .header_contents("bug.h", "#include <stdint.h>\ntypedef uint64_t u64;")
        .generate()
        .unwrap()

Actual Results

   Compiling bindgen-typedef-primitive v0.1.0 (file:///home/jon/dev/tmp/bindgen-typedef-primitive)
error[E0391]: cycle detected when processing `u64`
   --> /home/jon/dev/tmp/cargo-target/debug/build/bindgen-typedef-primitive-177200f3c53a8948/out/bindings.rs:193:16
    |
193 | pub type u64 = u64;
    |                ^^^
    |
    = note: ...which again requires processing `u64`, completing the cycle

error: aborting due to previous error

Expected Results

This error message is rather confusing, especially when the header file for which bindings are being generated is large.
Rather, it would be nice if generating bindings for types which have the same name as rust types failed.

cc @jonhoo

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions