Matt Corallo [Fri, 24 Jun 2022 01:16:46 +0000 (01:16 +0000)]
Correctly set the `ptr_for_ref` arg on `write_c_type` calls in enum printing
This avoids adding references to opaque structs in enum fields,
where we should, of course, map them as owned opaque structs.
It does generate some difficult-to-parse-by-downstream-bindings
code, which is addressed in a later commit by adding documentation.
Note that it also relies on the types being mapped differently
being opaque as it now needs logic to map a reference to a
non-reference with `is_owned` unset.
Matt Corallo [Mon, 30 May 2022 23:51:54 +0000 (23:51 +0000)]
Include the `where` clause from a "real" type when mapping type aliases
ie if we have a
```
struct A<T: Deref> where T::Target: Trait {}
pub type B<T> = A<T>;
```
this includes the `where` clause so that we end up calling
`writeln_opaque` for `struct B<T: Deref> where T::Target: Trait {}`
instead of `struct B<T: Deref> {}`.
Matt Corallo [Wed, 22 Jun 2022 19:30:05 +0000 (19:30 +0000)]
Add where-clause generic params to `default_generics` map
This moves yet more generic resolution to being able to rely on the
`default_generics` map for full-`Type` resolution rather than
string-based name resolution.
Jeffrey Czyz [Thu, 19 May 2022 15:26:35 +0000 (10:26 -0500)]
Support arrays inside Option types
Previously we'd supported arrays in options only if the real type
was something which we'd aliased to an array, so its not a big
stretch to support Options containing arrays explicitly.
Matt Corallo [Fri, 29 Apr 2022 19:30:05 +0000 (19:30 +0000)]
[ldk-net] Correct pollfds array offset after reads
Previously, we were copying the pollfds array at an offset of one
into the handler thread's stack. However, when it was changed to
copying at a 0 offset (adding the pipe read fd at the end instead
of beginning), the disable-read handling code was not updated.
This leads to an assertion failure at runtime if LDK decides we
need to stop reading due to the outbound buffer of a peer being
full.
Matt Corallo [Tue, 19 Apr 2022 19:24:50 +0000 (19:24 +0000)]
Use full paths in impl block handling instead of assuming in-file idents
In the next commit we'll want to handle impl blocks in one module
for an object that is defined in a different model. This violates
several existing assumptions in the impl block handling code,
namely that we're implementing for an object declared in the
current module. This relaxes that assumption in a few places.
Matt Corallo [Mon, 18 Apr 2022 02:56:05 +0000 (02:56 +0000)]
Make `Str`'s `clone` always clone the underlying bytes
Its incredibly unexpected that you can clone a higher-level object
(eg an Event with a ClosureReason that contains an `Str`) and have
a pointer back to the original object. To avoid this, `clone` needs
to actually `clone`.
Matt Corallo [Tue, 29 Mar 2022 22:33:27 +0000 (22:33 +0000)]
Crack `ReadableArgs` params when they're tuples
This replaces the special handling we'd had in 0.0.105.2 for
tuples-containing-references by instead just cracking open the
tuples and converting each field individually when calling
`ReadableArgs` where the argument is a tuple.
Matt Corallo [Wed, 23 Mar 2022 16:29:40 +0000 (16:29 +0000)]
Manually handle generated types containing references to opaques
This is really disgusting, we really shouldn't have references in
generated types at all, its just a mess. Instead, we should break
apart arguments when its a tuple, which would solve this more
cleanly.
Matt Corallo [Mon, 21 Mar 2022 01:21:50 +0000 (01:21 +0000)]
Pass types through `resolve_type` in a few additional places
Over time I'd like to swap all of our generic resolution to pass
through `resolve_type` instead of the current path resolution, as
its strictly more flexible, but for now we just add the few we need.
Matt Corallo [Fri, 18 Mar 2022 03:23:28 +0000 (03:23 +0000)]
Process all type aliases as C types, leaning on annotations to skip
Previously we'd used the presence of generics on a type alias
definition to decide when to skip creation of a corresponding C
type. However, with `ProbabilisticScorer`, we now have a type alias
which has a generic bound but which we still want to create a C
type for.
Matt Corallo [Wed, 2 Mar 2022 03:19:46 +0000 (03:19 +0000)]
Add function-call generic parameters when they're resovable
We really shouldn't ever actually need to do this - rustc should be
smart enough to figure out what we're doing given all the
parameters are concrete types, but this appears to be failing
sometimes.