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

chore(compiler): store paths with Utf8PathBuf #4009

Merged
merged 1 commit into from
Aug 30, 2023
Merged

Conversation

Chriscbr
Copy link
Contributor

A str or String in Rust represents a sequence of Unicode characters, while a Path or PathBuf in Rust represents a sequence of any bytes that represents a path. In practice though, non-Unicode paths are vanishingly uncommon, and there isn't a strong need to support them in Wing. (https://crates.io/crates/camino has some more details)

In this PR I've updated our Rust crates to use the Utf8PathBuf and Utf8Path types throughout. By doing so we're able to check that our paths are UTF-8 once, and then manipulate them as valid UTF-8 from there on, avoiding repeated lossy and confusing conversions like path.to_str().unwrap() and path.display().

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • Tests added (always)
  • Docs updated (only required for features)
  • Added pr/e2e-full label if this feature requires end-to-end testing

By submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.

Copy link
Contributor

@MarkMcCulloh MarkMcCulloh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I'm into it

@mergify
Copy link
Contributor

mergify bot commented Aug 30, 2023

Thanks for contributing, @Chriscbr! This PR will now be added to the merge queue, or immediately merged if rybickic/camino is up-to-date with main and the queue is empty.

mergify bot added a commit that referenced this pull request Aug 30, 2023
@mergify mergify bot merged commit 915f263 into main Aug 30, 2023
21 checks passed
@mergify mergify bot deleted the rybickic/camino branch August 30, 2023 02:55
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.27.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants