Skip to content

Promote const_generics to a standard feature - #7592

Merged
xunilrj merged 1 commit into
masterfrom
ironcev/promote-const-generics-feature
Apr 13, 2026
Merged

Promote const_generics to a standard feature#7592
xunilrj merged 1 commit into
masterfrom
ironcev/promote-const-generics-feature

Conversation

@ironcev

@ironcev ironcev commented Apr 11, 2026

Copy link
Copy Markdown
Member

Description

This PR promotes const_generics to a standard feature not anymore behind a feature flag.

#7512 made const_generic experimental feature enabled by default, but still kept it as experimental, with the decision to remove the feature flag as a part of the next breaking release 0.71.0.

Breaking change

The const_generic experimental feature is removed. If a compilation used --experimental/no-experimental const_generic or #[cfg(experimental_const_generics)] it will fail now. The solution is to simply remove all the usages of the feature flag.

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@cursor

cursor Bot commented Apr 11, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Promotes const_generics out of the experimental/flagged path and rewires stdlib encoding/decoding and generic-param handling, which could affect compilation and ABI behavior for arrays/str[N] across projects. Most changes are mechanical removals of cfg(experimental_const_generics) branches, but the surface area is large in sway-lib-std.

Overview
Promotes const_generics to always-on behavior by removing the const_generics entry from sway-features and dropping related #[cfg(experimental_const_generics = ...)] gating in docs and stdlib.

In sway-core, const generic parameters are now always converted into ConstGenericParameters without emitting “feature disabled” diagnostics.

In sway-lib-std, array and str[N] support is simplified to rely on const generics directly: the code generator script stops emitting the many fixed-size non-const-generic AbiEncode/AbiDecode/Debug impls, and the stdlib keeps only the generic [T; N] and str[N] implementations (still respecting experimental_str_array_no_padding).

Reviewed by Cursor Bugbot for commit 14da455. Bugbot is set up for automated code reviews on this repo. Configure here.

@ironcev ironcev self-assigned this Apr 11, 2026
@ironcev ironcev added compiler General compiler. Should eventually become more specific as the issue is triaged compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler: ui Mostly compiler messages labels Apr 11, 2026
@ironcev

ironcev commented Apr 11, 2026

Copy link
Copy Markdown
Member Author

👍

@codspeed-hq

codspeed-hq Bot commented Apr 11, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 25 untouched benchmarks


Comparing ironcev/promote-const-generics-feature (14da455) with master (0507c2c)

Open in CodSpeed

@ironcev
ironcev marked this pull request as ready for review April 12, 2026 03:25
@ironcev
ironcev requested review from a team as code owners April 12, 2026 03:25
@ironcev
ironcev requested a review from Dentosal April 12, 2026 03:25
@ironcev ironcev added the breaking May cause existing user code to break. Requires a minor or major release. label Apr 13, 2026
@xunilrj
xunilrj merged commit 4382e71 into master Apr 13, 2026
47 checks passed
@xunilrj
xunilrj deleted the ironcev/promote-const-generics-feature branch April 13, 2026 13:52
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: ui Mostly compiler messages compiler General compiler. Should eventually become more specific as the issue is triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Const Generics

3 participants