Don't use extern crate aliases when searching for dependencies
This commit is contained in:
parent
0c9c32ecdb
commit
cf3529fa84
@ -351,11 +351,7 @@ impl Parser {
|
||||
}
|
||||
}
|
||||
&syn::Item::ExternCrate(ref item) => {
|
||||
let dep_pkg_name = if let Some((_, ref name)) = item.rename {
|
||||
name.to_string()
|
||||
} else {
|
||||
item.ident.to_string()
|
||||
};
|
||||
let dep_pkg_name = item.ident.to_string();
|
||||
|
||||
let cfg = Cfg::load(&item.attrs);
|
||||
if let &Some(ref cfg) = &cfg {
|
||||
|
9
tests/expectations/rename-crate.c
Normal file
9
tests/expectations/rename-crate.c
Normal file
@ -0,0 +1,9 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct {
|
||||
int32_t x;
|
||||
} Foo;
|
||||
|
||||
void root(Foo a);
|
12
tests/expectations/rename-crate.cpp
Normal file
12
tests/expectations/rename-crate.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
|
||||
struct Foo {
|
||||
int32_t x;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
|
||||
void root(Foo a);
|
||||
|
||||
} // extern "C"
|
11
tests/rust/rename-crate/Cargo.lock
generated
Normal file
11
tests/rust/rename-crate/Cargo.lock
generated
Normal file
@ -0,0 +1,11 @@
|
||||
[[package]]
|
||||
name = "dependency"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "rename-crate"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"dependency 0.1.0",
|
||||
]
|
||||
|
7
tests/rust/rename-crate/Cargo.toml
Normal file
7
tests/rust/rename-crate/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "rename-crate"
|
||||
version = "0.1.0"
|
||||
authors = ["Ryan Hunt <rhunt@eqrion.net>"]
|
||||
|
||||
[dependencies]
|
||||
dependency = { path = "./dependency/" }
|
2
tests/rust/rename-crate/cbindgen.toml
Normal file
2
tests/rust/rename-crate/cbindgen.toml
Normal file
@ -0,0 +1,2 @@
|
||||
[parse]
|
||||
parse_deps = true
|
6
tests/rust/rename-crate/dependency/Cargo.toml
Normal file
6
tests/rust/rename-crate/dependency/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "dependency"
|
||||
version = "0.1.0"
|
||||
authors = ["Ryan Hunt <rhunt@eqrion.net>"]
|
||||
|
||||
[dependencies]
|
4
tests/rust/rename-crate/dependency/src/lib.rs
Normal file
4
tests/rust/rename-crate/dependency/src/lib.rs
Normal file
@ -0,0 +1,4 @@
|
||||
#[repr(C)]
|
||||
pub struct Foo {
|
||||
x: i32,
|
||||
}
|
7
tests/rust/rename-crate/src/lib.rs
Normal file
7
tests/rust/rename-crate/src/lib.rs
Normal file
@ -0,0 +1,7 @@
|
||||
extern crate dependency as internal_name;
|
||||
|
||||
pub use internal_name::*;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn root(a: Foo) {
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user