Skip to content

std::vector<int>::iterator creates trouble #1839

Open
@Volker-Weissmann

Description

@Volker-Weissmann

Input C/C++ Header

#include <vector>
namespace MySpace {
	std::vector<int>::iterator x;
}

Bindgen Invocation

bindgen::Builder::default()
        .header("wrapper.hpp")
        .parse_callbacks(Box::new(bindgen::CargoCallbacks))
        .clang_arg("-x")
        .clang_arg("c++")
        .opaque_type("std::.*")
        .whitelist_var("MySpace::.*")
        .whitelist_type("MySpace::.*")
        .whitelist_function("MySpace::.*")
        .generate()
        .expect("Unable to generate bindings");

Actual Results

... 89 lines of code ...
pub type pointer = pointer;
pub type pointer = pointer;
pub type pointer = pointer;
pub type pointer = *mut ::std::os::raw::c_int;

If you try to compile this, you get:

error[E0428]: the name `pointer` is defined multiple times
  --> /home/volker/Sync/git/latexrust/latex_to_symbolic/target/debug/build/latex_to_symbolic-2a7cee1167c646ae/out/bindings.rs:91:1
   |
90 | pub type pointer = pointer;
   | --------------------------- previous definition of the type `pointer` here
91 | pub type pointer = pointer;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `pointer` redefined here
   |
   = note: `pointer` must be defined only once in the type namespace of this module

error[E0428]: the name `pointer` is defined multiple times
  --> /home/volker/Sync/git/latexrust/latex_to_symbolic/target/debug/build/latex_to_symbolic-2a7cee1167c646ae/out/bindings.rs:92:1
   |
90 | pub type pointer = pointer;
   | --------------------------- previous definition of the type `pointer` here
91 | pub type pointer = pointer;
92 | pub type pointer = pointer;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `pointer` redefined here
   |
   = note: `pointer` must be defined only once in the type namespace of this module

error[E0428]: the name `pointer` is defined multiple times
  --> /home/volker/Sync/git/latexrust/latex_to_symbolic/target/debug/build/latex_to_symbolic-2a7cee1167c646ae/out/bindings.rs:93:1
   |
90 | pub type pointer = pointer;
   | --------------------------- previous definition of the type `pointer` here
...
93 | pub type pointer = *mut ::std::os::raw::c_int;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `pointer` redefined here
   |
   = note: `pointer` must be defined only once in the type namespace of this module

error[E0391]: cycle detected when processing `pointer`
  --> /home/volker/Sync/git/latexrust/latex_to_symbolic/target/debug/build/latex_to_symbolic-2a7cee1167c646ae/out/bindings.rs:90:20
   |
90 | pub type pointer = pointer;
   |                    ^^^^^^^
   |
   = note: ...which again requires processing `pointer`, completing the cycle
note: cycle used when processing `MySpace_x`
  --> /home/volker/Sync/git/latexrust/latex_to_symbolic/target/debug/build/latex_to_symbolic-2a7cee1167c646ae/out/bindings.rs:88:59
   |
88 |     pub static mut MySpace_x: __gnu_cxx___normal_iterator<pointer>;
   |                                                           ^^^^^^^

Expected Results

No compile errors?

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