Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return to stable Rust when 1.65 is released #443

Closed
zslayton opened this issue Oct 13, 2022 · 0 comments
Closed

Return to stable Rust when 1.65 is released #443

zslayton opened this issue Oct 13, 2022 · 0 comments

Comments

@zslayton
Copy link
Contributor

zslayton commented Oct 13, 2022

Generic associated types (GATs) are being stabilized in v1.65, due out in November.

PR #442 switched our CI builds to beta so we could leverage GATs in the run up to 1.65. When it's released, we need to switch back to stable. We should also specify a Minimum Supported Version of Rust (MSRV, see rust-clippy #6097 for discussion) for the crate.

zslayton added a commit that referenced this issue Oct 13, 2022
This PR replaces all uses of `Box<dyn Iterator<Item=_> + 'a>`
in the `Element` and `ElementRef` APIs with generic associated
types. This means that heap allocations are no longer required
to iterate over annotations, sequence elements, or struct fields.

Because this change uses generic associated types, it also
configures the CI tests to use the beta channel of cargo. GATs will
be available in the next release of Rust (v1.65, out in November);
once that happens, we can and should switch back to 
stable. (#443)

This change also removes the recently added dependency
on the `linkhash` crate. That dependency was originally pulled
in so structs could remember the order in which their fields were
inserted for later iteration. However, it only worked if the struct
did not contain duplicate field names. This PR changes the field
storage for `Struct` and `StructRef` to store their fields in a
`Vec` and also maintain a `HashMap<Symbol, IndexVec>`
that remembers all of the indexes at which values for a given
field can be found.

Further, it moves `Sequence` elements and `Struct` fields into
an `Rc` to make clone() operations cheaper. A future PR will
modify iterators over collection types to clone the `Rc` and
thus remove one of their lifetime constraints, making it much
easier to write a recursive iterator over an element tree without
constant cloning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant