aboutsummaryrefslogtreecommitdiff
path: root/syntax/atom.rs
diff options
context:
space:
mode:
authorAdrian Taylor <adetaylor@chromium.org>2020-10-21 18:20:55 -0700
committerAdrian Taylor <adetaylor@chromium.org>2020-10-26 15:23:34 -0700
commitc871343ac270f073fd4790269da267e8cb91dbde (patch)
treee8f3c8e0a48e75c3a1fcb520834d6da2f15d4816 /syntax/atom.rs
parent0fac32193904fdd75dcff71e5e4bd846b6e560b7 (diff)
downloadcxx-c871343ac270f073fd4790269da267e8cb91dbde.tar.gz
Allow namespace override.
This change allows a #[namespace (namespace = A::B)] attribute for each item in a cxx::bridge. We now have a fair number of different types of name floating around: * C++ identifiers * C++ fully-qualified names * Rust identifiers * Rust fully-qualified names (future, when we support sub-modules) * Items with both a Rust and C++ name (a 'Pair') * Types with only a known Rust name, which can be resolved to a C++ name. This change attempts to put some sensible names for all these things in syntax/mod.rs, and so that would be a good place to start review. At the moment, the Namespace (included in each CppName) is ruthlessly cloned all over the place. As a given namespace is likely to be applicable to many types and functions, it may save significant memory in future to use Rc<> here. But let's not optimise too early.
Diffstat (limited to 'syntax/atom.rs')
-rw-r--r--syntax/atom.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/syntax/atom.rs b/syntax/atom.rs
index 6e5fa880..7d0ef6b6 100644
--- a/syntax/atom.rs
+++ b/syntax/atom.rs
@@ -81,7 +81,7 @@ impl AsRef<str> for Atom {
impl PartialEq<Atom> for Type {
fn eq(&self, atom: &Atom) -> bool {
match self {
- Type::Ident(ident) => ident == atom,
+ Type::Ident(ident) => ident.rust == atom,
_ => false,
}
}