aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2020-09-07 22:26:46 -0700
committerDavid Tolnay <dtolnay@gmail.com>2020-09-07 22:31:03 -0700
commit9f6c075e3ccadb38ed73b416c8eaf1122e16afde (patch)
tree3133d606465efd2aba884df2dbfdb88fbacbe5cd
parent7aa5e21ab799f689de0a94fd35a03e90e28d6745 (diff)
downloadcxx-9f6c075e3ccadb38ed73b416c8eaf1122e16afde.tar.gz
Inline cxx-symbols crate into cxx
The separation is no longer needed for Buck when linking with lld.
-rw-r--r--BUCK9
-rw-r--r--BUILD15
-rw-r--r--Cargo.toml3
-rw-r--r--src/lib.rs4
-rw-r--r--src/macros/assert.rs (renamed from src/symbols/macros/assert.rs)0
-rw-r--r--src/macros/concat.rs (renamed from src/symbols/macros/concat.rs)0
-rw-r--r--src/macros/mod.rs (renamed from src/symbols/macros/mod.rs)0
-rw-r--r--src/rust_vec.rs2
-rw-r--r--src/symbols/Cargo.toml13
-rw-r--r--src/symbols/lib.rs9
-rw-r--r--src/symbols/mod.rs4
-rw-r--r--src/symbols/rust_string.rs5
-rw-r--r--src/symbols/rust_vec.rs6
-rw-r--r--third-party/Cargo.lock5
14 files changed, 13 insertions, 62 deletions
diff --git a/BUCK b/BUCK
index 5f2a65fc..695c0796 100644
--- a/BUCK
+++ b/BUCK
@@ -1,11 +1,10 @@
rust_library(
name = "cxx",
- srcs = glob(["src/**"], exclude = ["src/symbols/**"]),
+ srcs = glob(["src/**"]),
visibility = ["PUBLIC"],
deps = [
":core",
":macro",
- ":symbols",
],
)
@@ -32,12 +31,6 @@ cxx_library(
"cxx.h": "include/cxx.h",
},
exported_linker_flags = ["-lstdc++"],
- deps = [":symbols"],
-)
-
-rust_library(
- name = "symbols",
- srcs = glob(["src/symbols/**"]),
)
rust_library(
diff --git a/BUILD b/BUILD
index 197cef22..27c69319 100644
--- a/BUILD
+++ b/BUILD
@@ -2,18 +2,12 @@ load("//tools/bazel:rust.bzl", "rust_binary", "rust_library")
rust_library(
name = "cxx",
- srcs = glob(
- ["src/**/*.rs"],
- exclude = ["src/symbols/**/*.rs"],
- ),
+ srcs = glob(["src/**/*.rs"]),
proc_macro_deps = [
":cxxbridge-macro",
],
visibility = ["//visibility:public"],
- deps = [
- ":core-lib",
- ":symbols",
- ],
+ deps = [":core-lib"],
)
rust_binary(
@@ -45,11 +39,6 @@ cc_library(
)
rust_library(
- name = "symbols",
- srcs = glob(["src/symbols/**/*.rs"]),
-)
-
-rust_library(
name = "cxxbridge-macro",
srcs = glob(["macro/src/**"]),
crate_type = "proc-macro",
diff --git a/Cargo.toml b/Cargo.toml
index a2aaf8ac..73539f71 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,7 +20,6 @@ default = ["cxxbridge-flags/default"] # c++11
"c++20" = ["cxxbridge-flags/c++20"]
[dependencies]
-cxx-symbols = { version = "=0.4.3", path = "src/symbols" }
cxxbridge-macro = { version = "=0.4.3", path = "macro" }
link-cplusplus = "1.0"
@@ -35,7 +34,7 @@ rustversion = "1.0"
trybuild = { version = "1.0.33", features = ["diff"] }
[workspace]
-members = ["demo", "flags", "gen/build", "gen/cmd", "gen/lib", "macro", "src/symbols", "tests/ffi"]
+members = ["demo", "flags", "gen/build", "gen/cmd", "gen/lib", "macro", "tests/ffi"]
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
diff --git a/src/lib.rs b/src/lib.rs
index 8c7344bf..b0fe00df 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -369,8 +369,9 @@
#[cfg(built_with_cargo)]
extern crate link_cplusplus;
+
#[macro_use]
-extern crate symbols;
+mod macros;
mod cxx_string;
mod cxx_vector;
@@ -383,6 +384,7 @@ mod rust_sliceu8;
mod rust_str;
mod rust_string;
mod rust_vec;
+mod symbols;
mod unique_ptr;
mod unwind;
diff --git a/src/symbols/macros/assert.rs b/src/macros/assert.rs
index 5d5ea9e3..5d5ea9e3 100644
--- a/src/symbols/macros/assert.rs
+++ b/src/macros/assert.rs
diff --git a/src/symbols/macros/concat.rs b/src/macros/concat.rs
index 5ee77c52..5ee77c52 100644
--- a/src/symbols/macros/concat.rs
+++ b/src/macros/concat.rs
diff --git a/src/symbols/macros/mod.rs b/src/macros/mod.rs
index d12d96bd..d12d96bd 100644
--- a/src/symbols/macros/mod.rs
+++ b/src/macros/mod.rs
diff --git a/src/rust_vec.rs b/src/rust_vec.rs
index 5e7082ae..6f1d567a 100644
--- a/src/rust_vec.rs
+++ b/src/rust_vec.rs
@@ -3,7 +3,7 @@ use std::mem::ManuallyDrop;
#[repr(C)]
pub struct RustVec<T> {
- repr: Vec<T>,
+ pub(crate) repr: Vec<T>,
}
impl<T> RustVec<T> {
diff --git a/src/symbols/Cargo.toml b/src/symbols/Cargo.toml
deleted file mode 100644
index 93283add..00000000
--- a/src/symbols/Cargo.toml
+++ /dev/null
@@ -1,13 +0,0 @@
-[package]
-name = "cxx-symbols"
-version = "0.4.3"
-authors = ["David Tolnay <dtolnay@gmail.com>"]
-edition = "2018"
-license = "MIT OR Apache-2.0"
-description = "Implementation detail of the `cxx` crate"
-repository = "https://github.com/dtolnay/cxx"
-documentation = "https://docs.rs/cxx"
-
-[lib]
-name = "symbols"
-path = "lib.rs"
diff --git a/src/symbols/lib.rs b/src/symbols/lib.rs
deleted file mode 100644
index da0f223b..00000000
--- a/src/symbols/lib.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//! *Implementation detail of the `cxx` crate.*
-
-#[macro_use]
-mod macros;
-
-mod exception;
-mod rust_str;
-mod rust_string;
-mod rust_vec;
diff --git a/src/symbols/mod.rs b/src/symbols/mod.rs
new file mode 100644
index 00000000..a9d158db
--- /dev/null
+++ b/src/symbols/mod.rs
@@ -0,0 +1,4 @@
+mod exception;
+mod rust_str;
+mod rust_string;
+mod rust_vec;
diff --git a/src/symbols/rust_string.rs b/src/symbols/rust_string.rs
index 94b2110d..5c2982d8 100644
--- a/src/symbols/rust_string.rs
+++ b/src/symbols/rust_string.rs
@@ -3,11 +3,6 @@ use std::ptr;
use std::slice;
use std::str;
-#[repr(C)]
-pub(crate) struct RustString {
- repr: String,
-}
-
#[export_name = "cxxbridge04$string$new"]
unsafe extern "C" fn string_new(this: &mut MaybeUninit<String>) {
ptr::write(this.as_mut_ptr(), String::new());
diff --git a/src/symbols/rust_vec.rs b/src/symbols/rust_vec.rs
index 77894544..fb49b40c 100644
--- a/src/symbols/rust_vec.rs
+++ b/src/symbols/rust_vec.rs
@@ -1,12 +1,8 @@
use crate::rust_string::RustString;
+use crate::rust_vec::RustVec;
use std::mem;
use std::ptr;
-#[repr(C)]
-pub(crate) struct RustVec<T> {
- repr: Vec<T>,
-}
-
macro_rules! rust_vec_shims {
($segment:expr, $ty:ty) => {
const_assert_eq!(mem::size_of::<[usize; 3]>(), mem::size_of::<Vec<$ty>>());
diff --git a/third-party/Cargo.lock b/third-party/Cargo.lock
index 92ac6b32..8a2ee256 100644
--- a/third-party/Cargo.lock
+++ b/third-party/Cargo.lock
@@ -63,7 +63,6 @@ version = "0.4.3"
dependencies = [
"cc",
"cxx-build",
- "cxx-symbols",
"cxx-test-suite",
"cxxbridge-flags",
"cxxbridge-macro",
@@ -96,10 +95,6 @@ dependencies = [
]
[[package]]
-name = "cxx-symbols"
-version = "0.4.3"
-
-[[package]]
name = "cxx-test-suite"
version = "0.0.0"
dependencies = [