-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
String slices #4778
Closed
Closed
String slices #4778
Conversation
This file contains 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
d6a9250
to
ecd562a
Compare
IGI-111
added a commit
to FuelLabs/fuels-rs
that referenced
this pull request
Jul 17, 2023
Add support for `str` in prevision for FuelLabs/sway#4778 This also changes the way slices are coded in general by adding a data section their pointer value indexes into.
6 tasks
IGI-111
added a commit
to FuelLabs/fuels-rs
that referenced
this pull request
Jul 17, 2023
Add support for `str` in prevision for FuelLabs/sway#4778 This also changes the way slices are coded in general by adding an explicit data section. Dynamic data pointers are now always relative to the start of the data section, similar to Solidity's ABI spec.
IGI-111
added a commit
to FuelLabs/fuels-rs
that referenced
this pull request
Jul 17, 2023
Add support for `str` in prevision for FuelLabs/sway#4778 This also changes the way slices are coded in general by adding an explicit data section. Dynamic data pointers are now always relative to the start of the data section, similar to Solidity's ABI spec.
IGI-111
added a commit
to FuelLabs/fuels-rs
that referenced
this pull request
Jul 17, 2023
Add support for `str` in prevision for FuelLabs/sway#4778
IGI-111
added a commit
to FuelLabs/fuels-rs
that referenced
this pull request
Jul 17, 2023
Add support for `str` in prevision for FuelLabs/sway#4778
42784c0
to
e791811
Compare
IGI-111
added a commit
to FuelLabs/fuels-rs
that referenced
this pull request
Jul 17, 2023
Add support for `str` in prevision for FuelLabs/sway#4778
IGI-111
added a commit
to FuelLabs/fuels-rs
that referenced
this pull request
Jul 17, 2023
Add support for `str` in prevision for FuelLabs/sway#4778
IGI-111
added a commit
to FuelLabs/fuels-rs
that referenced
this pull request
Jul 18, 2023
Add support for `str` in prevision for FuelLabs/sway#4778
IGI-111
added a commit
to FuelLabs/fuels-rs
that referenced
this pull request
Jul 18, 2023
Add support for `str` in prevision for FuelLabs/sway#4778
This issue looks like a related one: #1060 |
IGI-111
added a commit
to FuelLabs/fuels-rs
that referenced
this pull request
Jul 20, 2023
Add support for `str` in prevision for FuelLabs/sway#4778
IGI-111
added a commit
to FuelLabs/fuels-rs
that referenced
this pull request
Jul 21, 2023
Add support for `str` in prevision for FuelLabs/sway#4778 ### Checklist - [x] I have linked to any relevant issues. - [x] I have updated the documentation. - [x] I have added tests that prove my fix is effective or that my feature works. - [x] I have added necessary labels. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers. Co-authored-by: hal3e <git@hal3e.io>
9c73736
to
38ba68f
Compare
db1d75a
to
c1c8d76
Compare
This change formalizes the `str` type to represent string data using string slices. String literals now evaluate to dynamically sized string slices that contain a pointer to what used to the packed data representation and a length. The standard library `String` and `Bytes` have had their interface changed to interact with `str`s idiomatically. The `__size_of_str` intrinsic is removed as it is no longer needed. Types and functions that carry the literal data for the string in IR generation have been renamed from `String` to `StringData` to avoid confusion.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking
May cause existing user code to break. Requires a minor or major release.
compiler: frontend
Everything to do with type checking, control flow analysis, and everything between parsing and IRgen
compiler: ir
IRgen and sway-ir including optimization passes
compiler: parser
Everything to do with the parser
language feature
Core language features visible to end users
lib: core
Core library
lib: std
Standard library
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.
Description
This change formalizes the
str
type to represent string data using string slices.String literals now evaluate to dynamically sized string slices that contain a pointer to what used to the packed data representation and a length.
The standard library
String
andBytes
have had their interface changed to interact withstr
s idiomatically.The
__size_of_str
intrinsic is removed as it is no longer needed.Types and functions that carry the literal data for the string in IR generation have been renamed from
String
toStringData
to avoid confusion.Part of #4375
Fixes #1060
Checklist
Breaking*
orNew Feature
labels where relevant.