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

Misleading raw_slice error message #5145

Closed
segfault-magnet opened this issue Sep 25, 2023 · 0 comments · Fixed by #6079
Closed

Misleading raw_slice error message #5145

segfault-magnet opened this issue Sep 25, 2023 · 0 comments · Fixed by #6079
Assignees

Comments

@segfault-magnet
Copy link
Contributor

script;

struct Wrapper {
    field: raw_slice,
}

fn main(wrapper: Wrapper) -> raw_slice {
    wrapper.field
}

Causes the following error:

5 | 
6 | 
7 | fn main(wrapper: Wrapper) -> raw_slice {
  |                  ^^^^^^^ Returning a type containing `raw_slice` from `main()` is not allowed. Consider converting it into a flat `raw_slice` first.
8 |     wrapper.field
9 | }

It would seem that 0.46.0 dropped support for raw_slice in inputs or this is a regression.

In either case the message needs to be updated since the returned raw_slice is the top level type.

@xunilrj xunilrj self-assigned this Sep 25, 2023
@xunilrj xunilrj mentioned this issue Sep 25, 2023
11 tasks
IGI-111 added a commit that referenced this issue Jun 19, 2024
## Description

This PR, for encoding v1, allows string slices in inputs and outputs of
scripts and contracts; and in inputs of predicates.
For encoding v0, the limitation is kept.

This PR will also land the necessary start of future improvements on
"slices" (including string slices).

This PR closes #5145

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [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: IGI-111 <[email protected]>
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 a pull request may close this issue.

2 participants