FuelLabs / FuelLabs/sway

Typed Pointers and Slices

Open
#4,375 2 comments 1 reaction 1 assignee Assigned to @IGI-111 View on GitHub
compiler: frontend compiler: ir lib: core lib: std team:compiler
Dominant language
Rust
Stars
61.4k
Forks
5.4k
Avg merge
3h 33m
Merged PRs (30d)
4

Description

Previously on Sway, we have introduced `raw_ptr` and `raw_slice` types as better alternatives to using `u64` and `(u64,u64)`. While we eventually wanted to get rid of these types, they helped identify cases where we play with raw memory and organize our code.

Experiments with their typed variants, `struct ptr` and `struct slice`, have shown that they significantly improve core- and std-lib code.

With typed variants:
- We can leverage the type info to offer more methods, reducing implementation complexity of `RawVec` and such.
- All this complexity will move to intrinsics and reduce a lot of bloat. (See: https://github.com/FuelLabs/sway/issues/3112#issuecomment-1292356870)
- We will be able to remove `raw_ptr` and `raw_slice`, making Sway safer.
- I think we can even remove `std::alloc` and `std::mem`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.