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

Use lifetime GAT for Source::Slice #332

Merged
merged 2 commits into from
Aug 17, 2023
Merged

Conversation

kmicklas
Copy link
Contributor

This is required to write a Source impl for any type whose slice is a custom type and not a bare reference. For example, see ropey::RopeSlice.

Relates to #222.

@jeertmans
Copy link
Collaborator

Nice, thanks! I have read about GAT, but not actually used them.

do you have an example code that would now work with the new change, and that would not work previously?

@kmicklas
Copy link
Contributor Author

I think the change in tests/src/lib.rs is indicative of the types of changes that would be required in user code. In general I wouldn't expect too many incompatibilities in user code (i.e. using default Sources) since the current Slice definitions and the new ones both resolve to &str/&[u8] for the appropriate lifetime.

The bigger source of breakages would be that this invalidates any Source impl.

@jeertmans
Copy link
Collaborator

Could you update Rust's MSRV so that it passes the tests? You can use cargo-msrv for that purpose :-)

@jeertmans jeertmans merged commit ea31a43 into maciejhirsz:master Aug 17, 2023
16 checks passed
@kmicklas kmicklas deleted the gat-slice branch August 17, 2023 19:58
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

Successfully merging this pull request may close these issues.

2 participants