1104 Commits

Author SHA1 Message Date
Adrian Taylor
9238b706a8 Test for namespace order sensitivity. 2020-10-31 22:15:24 -07:00
David Tolnay
5fedc9a359
Use a less strange return type for NamespaceEntries::children 2020-10-30 21:46:17 -07:00
David Tolnay
a7c2ea10f1
Avoid passing Types around everywhere 2020-10-30 21:40:14 -07:00
David Tolnay
b560a0fabf
Make type information accessible through OutFile 2020-10-30 21:40:03 -07:00
David Tolnay
598154250c
Remove unneeded derives on ResolvableName 2020-10-30 21:24:05 -07:00
David Tolnay
be7e30e0c9
Clarify name struct comments 2020-10-30 21:21:23 -07:00
David Tolnay
abff2d5ed0
Rewrap name struct comments to 80 columns 2020-10-30 21:20:07 -07:00
David Tolnay
9071c264e2
Collect name-related structs to the bottom of syntax tree definition 2020-10-30 21:18:54 -07:00
David Tolnay
50de2c4813
Remove various Ident type aliases
I don't see these being particularly helpful to maintaining correctness.
Where needed, we should clarify the meaning of a field with a comment
rather than writing its type as an alias.
2020-10-30 21:16:05 -07:00
David Tolnay
bf23e3e185
Format PR 370 with clang-format 2020-10-30 21:12:50 -07:00
David Tolnay
2e5c529055
Merge pull request #385 from dtolnay/string
Add asserts to protect string construction from nullptr when building with assertions
2020-10-30 21:08:17 -07:00
David Tolnay
54b13222e2
Add asserts to protect string construction from nullptr when building with assertions 2020-10-30 20:58:44 -07:00
David Tolnay
6d431e8e24
Merge pull request #384 from dtolnay/string
Reduce duplicated checks in string construction
2020-10-30 20:58:36 -07:00
David Tolnay
032d853161
Reduce duplicated checks in string construction 2020-10-30 20:51:51 -07:00
David Tolnay
9167590318
Merge pull request #383 from dtolnay/nullempty
Match std::string's behavior on (nullptr, 0) construction
2020-10-30 20:51:26 -07:00
David Tolnay
8d32366682
Match std::string's behavior on (nullptr, 0) construction 2020-10-30 20:29:49 -07:00
David Tolnay
6791c39ec6
Merge pull request #382 from adetaylor/namespace-code-review
Namespace code review
2020-10-30 14:07:14 -07:00
Adrian Taylor
451ec9f44b Clippy fixes. 2020-10-29 22:51:30 -07:00
Adrian Taylor
7827d78f29 Add tests for namespace sorter. 2020-10-29 22:14:34 -07:00
Adrian Taylor
0f8ab22aee Improving Pair construction. 2020-10-29 21:33:49 -07:00
Adrian Taylor
0447e96b84 Revert to older error string. 2020-10-29 21:22:24 -07:00
Adrian Taylor
f2d9d86c3d Simplify test suite. 2020-10-29 21:21:30 -07:00
Adrian Taylor
565ddf035e Code review comments on namespace work. 2020-10-29 21:12:36 -07:00
David Tolnay
71b34be0be
Merge pull request #380 from adetaylor/namespaces-syntax-update
Switch to #[namespace = A::B] syntax.
2020-10-29 20:05:09 -07:00
Adrian Taylor
3e5cff4a3d Switch to #[namespace = A::B] syntax.
Thanks to sbrocket for this parsing code.
2020-10-29 19:48:45 -07:00
David Tolnay
d60c07b762
Merge pull request 370 from adetaylor/allow-namespace-override 2020-10-29 16:46:40 -07:00
David Tolnay
7b14585af9
Merge pull request #377 from dtolnay/unsupported-type
Include typename in diagnostic on unsupported type
2020-10-28 18:27:36 -07:00
David Tolnay
dbc5377e9f
Avoid repeating the underlined type in the label 2020-10-28 17:28:51 -07:00
David Tolnay
353d98cdd9
Move syntax Include to gen Include conversion to From impl 2020-10-28 15:43:35 -07:00
David Tolnay
2cc2e3a4d1
Include angle brackets in include-related errors 2020-10-28 13:48:34 -07:00
David Tolnay
faa1a7c448
Merge pull request #375 from dtolnay/include
Check for disallowed include strings in Cargo-based workflow
2020-10-28 13:48:22 -07:00
David Tolnay
75c2385e30
Check for disallowed include strings
error[cxxbridge]: #include relative to `.` or `..` is not supported in Cargo builds
       ┌─ src/main.rs:10:18
       │
    10 │         include!("../header.h");
       │                  ^^^^^^^^^^^^^ #include relative to `.` or `..` is not supported in Cargo builds
       │
       = note: use a path starting with the crate name
2020-10-28 13:41:45 -07:00
David Tolnay
d5107638a1
Merge pull request #374 from dtolnay/include
Expose IncludeKind to cxx_gen library
2020-10-28 13:41:36 -07:00
David Tolnay
700cd0c1df
Expose IncludeKind to cxx_gen library 2020-10-28 13:33:41 -07:00
David Tolnay
36b1dbac2f
Merge pull request #373 from dtolnay/include
Distinguish quoted vs bracketed includes in gen::include
2020-10-28 13:33:33 -07:00
David Tolnay
4aae7c09b7
Distinguish quoted vs bracketed includes in gen::include 2020-10-28 13:23:21 -07:00
David Tolnay
d927633b8a
Merge pull request #372 from dtolnay/include
Track span information of include statements
2020-10-28 13:22:51 -07:00
David Tolnay
b0cd3270b6
Track span information of include statements 2020-10-28 12:36:02 -07:00
Adrian Taylor
c871343ac2 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.
2020-10-26 15:23:34 -07:00
Adrian Taylor
0fac321939 Adding tests for method calls in foreign namespaces 2020-10-26 15:17:02 -07:00
Adrian Taylor
ddc146ef9f Adding tests for functions in other namespaces. 2020-10-26 15:17:02 -07:00
Adrian Taylor
d47af7a9d3 Tests for opaque C types in namepsaces 2020-10-26 15:17:02 -07:00
Adrian Taylor
585bb0bc56 Tests for namespaced extern trivial types 2020-10-26 15:17:02 -07:00
Adrian Taylor
5e79c64769 Tests for namespaced opaque extern types. 2020-10-26 15:17:02 -07:00
Adrian Taylor
9a158e408f Adding tests for types in namespaces. 2020-10-26 15:17:02 -07:00
Adrian Taylor
cca5215060 Diagnostic improvement. 2020-10-22 17:56:53 -07:00
David Tolnay
e37ce2f4ee
Release 0.5.2 0.5.2 2020-10-16 13:32:07 -07:00
David Tolnay
a32ca3080b
Lockfile update 2020-10-16 13:31:09 -07:00
David Tolnay
743caa283c
Remove duplicated UniquePtr<C> impl in ui test 2020-10-16 13:22:47 -07:00
David Tolnay
441956e803
Match layout of C++ tests::E and struct E in Rust 2020-10-16 13:21:51 -07:00