Using mmap to read files#4
Merged
Merged
Conversation
daxpedda
requested changes
Jan 26, 2026
Comment on lines
+628
to
+632
| fn map_file(path: &Path) -> Result<Mmap, Error> { | ||
| let file = File::open(path)?; | ||
| // Safety: the file is not mutated while the mapping is in use. | ||
| unsafe { Mmap::map(&file) } | ||
| } |
Member
There was a problem hiding this comment.
We need to account for targets memmap2 doesn't support. So we need some type that abstracts over File and Mmap.
Contributor
Author
There was a problem hiding this comment.
Which targets are not supported? I took a quick look, and it supports most unix and windows targets, which I think should be sufficient for our needs.
Member
There was a problem hiding this comment.
Honestly, I've no idea. But we need to ship this to Rustc eventually, so we really need to cover all our bases.
Feel free to dig into Rustc and see what they are doing, if they don't think its necessary we can go ahead and remove the abstraction I added as well.
daxpedda
reviewed
Jan 26, 2026
daxpedda
approved these changes
Jan 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.