David Tolnay
06ef96fa5f
Handle unrecognized type names in checking signature for mutable return type
2021-03-28 04:07:57 -04:00
David Tolnay
5f5602c2e5
Print type name in type resolver error
2021-03-28 03:58:06 -04:00
David Tolnay
9dab9d8e38
Track the outer type's spans too for implicit impls
2021-03-27 01:51:08 -04:00
David Tolnay
fedc63bfb7
Simplify type resolution of named impl keys
2021-03-27 01:23:04 -04:00
David Tolnay
dde630235b
Track the angle brackets attached to generic implicit impls
2021-03-27 01:23:04 -04:00
David Tolnay
795e7b478f
Factor out impl/ty generic splitting to module
2021-03-27 01:23:04 -04:00
David Tolnay
6edd2d2a59
Add a void ptr cast for extern type aliases containing Rust-native types
2021-03-26 18:13:41 -04:00
David Tolnay
47b820940c
Remove multiple arg lifetimes check
...
This was made obsolete by support for explicit lifetime annotations
in cxx 1.0.26.
2021-03-26 18:05:28 -04:00
David Tolnay
b55bd6392b
Allow mutable return reference on signatures with any lifetime in argument
2021-03-26 17:59:14 -04:00
David Tolnay
a17230db8c
Factor out Type traversal to a Visit trait
2021-03-26 17:36:51 -04:00
David Tolnay
4a024613f1
Fix wording of unsupported vector element type error
...
Vectors have elements, not targets. (Pointers, like unique_ptr and
shared_ptr, have targets -- matching the terminology of Target in the
std::ops::Deref trait.)
2021-03-26 17:14:24 -04:00
David Tolnay
04376c7d94
Permit mut from ref in unsafe-to-call signatures
2021-03-26 17:08:48 -04:00
David Tolnay
2dec4215e3
Include unsafe token in notional span of extern fn signatures
2021-03-26 17:07:54 -04:00
David Tolnay
5f04fda69d
Merge pull request #750 from dtolnay/pointers
...
Pointer to pointer, pointer to reference, reference to pointer
2021-03-22 19:41:13 -07:00
David Tolnay
d2d225c10c
East const to make nested pointer types work
2021-03-22 19:23:51 -07:00
David Tolnay
bd313d5e92
Add dedicated error message for ptr to ptr and ref to ptr
2021-03-22 19:23:51 -07:00
David Tolnay
2a2264c483
Add dedicated error message for pointer to reference
2021-03-22 19:23:50 -07:00
David Tolnay
d91d2a8d4a
Relax restriction on target types of pointer
2021-03-22 19:23:49 -07:00
David Tolnay
aba7ab1bb0
Detect pointer argument inside of function pointer
2021-03-22 19:18:18 -07:00
David Tolnay
285779635a
Defer unsafety check for fn with ptr argument
...
That error does not need to be fatal at parse time, because the parser
still understands exactly what was written. We accumulate and emit it
alongside other type errors that might be present in the same function
signature.
2021-03-22 19:12:06 -07:00
David Tolnay
b70310b760
Remove unneeded pointer parse check
...
A pointer with neither `const` nor `mut` would not have parsed as a
syn::Type::Ptr.
2021-03-22 19:06:08 -07:00
David Tolnay
beba43d024
Touch up PR 689 imports
2021-03-22 19:06:07 -07:00
David Tolnay
94909e0a6e
Remove duplicate unsafety parse from PR 689
2021-03-22 19:06:07 -07:00
David Tolnay
7c3197eba8
Format PR 689 with rustfmt
2021-03-22 19:06:02 -07:00
David Tolnay
9fc8138823
Merge pull request #689 from adetaylor/pointers
...
Support raw pointers in cxx::bridge.
2021-03-22 19:04:37 -07:00
David Tolnay
2e43b51227
Consistently use 'other: &Self' in homogeneous comparison impls
2021-03-18 13:35:38 -07:00
Adrian Taylor
57832124b4
Merge fix.
2021-02-17 16:11:08 -08:00
David Tolnay
6c39d4b9c8
Document the arrangements of preprocessor variables
2021-02-17 15:56:07 -08:00
David Tolnay
415f23255e
Document the possible arrangements of mangled symbols
2021-02-17 15:49:39 -08:00
adetaylor
f67287db6f
Merge branch 'master' into pointers
2021-02-17 15:32:06 -08:00
David Tolnay
dfafc8b210
Move span of inherited pub to next consecutive token
2021-02-11 22:03:48 -08:00
David Tolnay
35f07dbdf8
Avoid wrapping error message across source lines
...
This makes the source of the message easier to locate for someone using
grep with the full message.
The Linux kernel coding style follows the same approach:
https://www.kernel.org/doc/html/v5.10/process/coding-style.html#breaking-long-lines-and-strings
> never break user-visible strings such as printk messages because that
> breaks the ability to grep for them.
2021-02-07 13:38:01 -08:00
David Tolnay
d15608434d
Touch up error message from PR 688
2021-02-07 13:36:35 -08:00
Adrian Taylor
38ae228834
Support raw pointers in cxx::bridge.
...
This allows raw pointers to types to be passed into and out of
cxx::bridge extern "C++" APIs. As normal with raw pointers in Rust,
there are no safety or lifetime guarantees.
Passing a raw pointer into such an API requires that the
function be marked "unsafe".
2021-01-23 11:34:13 -08:00
Fletcher Woodruff
0ba1079dd0
Clarify error for using enum as method receiver
...
Update the syntax checker to print a more specific error when an enum is
used as a method receiver, rather than printing a misleading "unrecognized
receiver type" error.
This is done because C++ prohibits enums from having member functions.
2021-01-20 14:09:04 -07:00
David Tolnay
2d1fcc2d2e
Implement Vec<&str>
2021-01-03 22:47:35 -08:00
David Tolnay
9bd65aa60c
Implement lifetime elision inside of pins
2021-01-03 21:04:55 -08:00
David Tolnay
8c28af564f
Improve extern fn with body error message
2021-01-03 20:23:52 -08:00
David Tolnay
aea7a5869e
Extract extern verbatim type parsing to function
2021-01-03 20:14:08 -08:00
David Tolnay
58183e2228
Enable support for extern Rust types containing lifetimes
2021-01-02 23:47:16 -08:00
David Tolnay
06c60a32a7
Remove opaque C++ type lifetimes gates
2021-01-02 23:35:18 -08:00
David Tolnay
3a48021f54
Include lifetimes in error reporting spans
2021-01-02 23:25:53 -08:00
David Tolnay
bf9d6e815b
Enable slices and arrays containing str/slice
2021-01-02 23:11:01 -08:00
David Tolnay
10852ed506
Fix slice restriction to exclude slice of CxxString
2021-01-02 23:07:18 -08:00
David Tolnay
43d03b6737
Parse lifetimes on shared structs
2021-01-02 22:47:46 -08:00
David Tolnay
233e60e231
Resolve unnecessary_wraps clippy lint
2021-01-01 22:12:50 -08:00
David Tolnay
dc09c52a3d
Tweak enum generics error handling
2021-01-01 21:52:08 -08:00
David Tolnay
c417977d27
Distinguish Impl's impl generics vs generics on the Self type
2021-01-01 19:51:13 -08:00
David Tolnay
eb472ad837
Remove unused Impl hashing impls
...
These used to be for a HashSet<&Impl> held by Types, which has since
been refactored into a different data structure.
2021-01-01 19:40:19 -08:00
David Tolnay
1d5ffbb4c9
Fix span placement on ForeignName parse error
2021-01-01 19:28:34 -08:00
David Tolnay
1e5fe237d8
Record lifetimes associated with generic type instantiation
2021-01-01 18:28:28 -08:00
David Tolnay
038b29a024
Add place for struct and enum lifetime parameters
2021-01-01 18:26:26 -08:00
David Tolnay
ed6ba4a63c
Add ForeignName wrapper around non-Rust names
2021-01-01 17:57:14 -08:00
David Tolnay
9f84fe8bbd
Check rust idents for cxxbridge prefix
2021-01-01 15:59:59 -08:00
David Tolnay
0a89256c28
Support rename attributes on struct fields
2021-01-01 15:53:56 -08:00
David Tolnay
84ed6adda5
Track independent Rust/C++ names on struct fields and fn args
2021-01-01 15:46:10 -08:00
David Tolnay
b97a245c93
Avoid hashing arg names in hash of function signature
2021-01-01 15:32:35 -08:00
David Tolnay
3abed4794a
Generate all explicit and implicit impls based on one map
2021-01-01 14:28:38 -08:00
David Tolnay
77a5e758e6
Rename RustName -> NamedType
2021-01-01 14:15:26 -08:00
David Tolnay
95bc57fc47
Remove RustName::to_symbol in favor of explicit resolve
2021-01-01 13:36:49 -08:00
David Tolnay
873b822c54
Add OrderedMap type
2020-12-31 23:39:06 -08:00
David Tolnay
e352c1e140
Add wrapper to prevent iteration of unordered maps
2020-12-31 17:15:56 -08:00
David Tolnay
292cfffe5a
Downgrade some ordered type checker sets to unordered
2020-12-31 16:37:55 -08:00
David Tolnay
c455e97405
Parse generic params on impl block
2020-12-31 15:38:19 -08:00
David Tolnay
4c6052d749
Key impls by an enum rather than by Type
2020-12-31 15:31:28 -08:00
David Tolnay
89fd09b66b
Emit lifetime parameters in ToTokens of Type
2020-12-31 14:51:12 -08:00
David Tolnay
679b15d677
Parse lifetimes on Ident type names
2020-12-30 20:51:39 -08:00
David Tolnay
4a79b7f8d8
Track lifetimes on rust name types
2020-12-30 20:03:35 -08:00
David Tolnay
0c669ea3d1
Replace ref cast to RustName with just using Ident
2020-12-30 20:02:35 -08:00
David Tolnay
444f2dce6b
Update ToTokens impls with exhaustive field matching
2020-12-30 20:02:12 -08:00
David Tolnay
a00f468cfa
Factor out visibility conversion helper
2020-12-30 18:11:16 -08:00
David Tolnay
49f9df7923
Fix span placement on extern functions
2020-12-30 18:07:30 -08:00
David Tolnay
291c9350d6
Fix span placement on type aliases
2020-12-30 17:57:14 -08:00
David Tolnay
524ff68081
Fix span placement on extern C++ type
2020-12-30 17:29:12 -08:00
David Tolnay
8fbaea8dbb
Fix span placement on shared enums
2020-12-30 17:21:28 -08:00
David Tolnay
41e147c5cf
Process outer attributes on the bridge module
2020-12-30 17:06:45 -08:00
David Tolnay
dc182794ec
Handle tool attrs inside the bridge module
2020-12-30 17:01:34 -08:00
David Tolnay
511c6fdb55
Pass through two other diagnostics attributes as well
2020-12-30 16:58:54 -08:00
David Tolnay
f08e94d2d6
Update attrs::Parser intended usage comment
2020-12-30 16:50:06 -08:00
David Tolnay
cba3d44638
Add wrapper type for tokenizing passthrough attrs
2020-12-30 16:50:05 -08:00
David Tolnay
067638ea15
Store passthrough attributes for diagnostic lint levels
2020-12-30 16:50:05 -08:00
David Tolnay
20d980be78
Skip over rust diagnostic attributes
2020-12-30 16:44:05 -08:00
David Tolnay
15a1fc110e
Consume attributes in attr parser
2020-12-30 16:13:59 -08:00
David Tolnay
b4a05c3621
Preserve doc attributes on struct fields
2020-12-30 15:46:47 -08:00
David Tolnay
64343af04d
Fix span placement on shared structs
2020-12-30 15:34:09 -08:00
David Tolnay
89902443e8
Preserve visibility token's span on struct field
2020-12-30 15:17:58 -08:00
David Tolnay
4486f7261e
Preserve doc comments on enum variants
2020-12-30 00:01:26 -08:00
David Tolnay
d61437042d
Ignore visibility on extern type alias like on other items
2020-12-29 23:48:09 -08:00
David Tolnay
b4c14554aa
Avoid triggering used_underscore_binding on unnamed extern fn args
2020-12-29 15:44:19 -08:00
David Tolnay
8c80de77c6
Emit lifetimes on extern type into Rust macro output
2020-12-28 22:41:59 -08:00
David Tolnay
ee3123241f
Store additional token information with extern type lifetimes
2020-12-28 22:12:28 -08:00
David Tolnay
446756f4c9
Indicate that extern type with lifetimes is not implemented yet
2020-12-28 21:04:12 -08:00
David Tolnay
a870ac7724
Handle extern time lifetimes followed by semicolon
2020-12-28 21:04:12 -08:00
David Tolnay
e81647ffda
Parse lifetimes on foreign module types
2020-12-28 21:04:11 -08:00
David Tolnay
3d2ef674a4
Add lifetimes to ExternType and TypeAlias syntax tree
2020-12-28 21:04:11 -08:00
David Tolnay
215e77fbec
Add Rust std::weak_ptr binding
2020-12-28 17:41:20 -08:00
David Tolnay
cd1430c5ef
Add SharedPtr<bool>
2020-12-28 17:25:37 -08:00
David Tolnay
378cd6e5ca
Update SharedPtr target type check
...
These types were implemented in #563 .
2020-12-28 17:24:28 -08:00
David Tolnay
3adf3c81b6
Allow passing slice of extern Rust type across FFI
2020-12-27 13:19:45 -08:00
David Tolnay
6bf9ef4749
Parse cxx_name and rust_name attributes on enum variants
2020-12-21 16:26:41 -08:00