Skip to content

const generics for standalone fns #7175

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

Merged
merged 6 commits into from
May 23, 2025

Conversation

xunilrj
Copy link
Contributor

@xunilrj xunilrj commented May 14, 2025

Description

This PR is part of #6860 and allows standalone functions to have "const generics" like the code below:

fn return_n<const NNN: u64>() -> u64 {
    NNN
}

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.

@xunilrj xunilrj temporarily deployed to fuel-sway-bot May 14, 2025 14:43 — with GitHub Actions Inactive
Copy link

codspeed-hq bot commented May 14, 2025

CodSpeed Performance Report

Merging #7175 will not alter performance

Comparing xunilrj/standalone-fn-const-generics (b271777) with master (ee565f9)

Summary

✅ 24 untouched benchmarks

@xunilrj xunilrj force-pushed the xunilrj/standalone-fn-const-generics branch from de6c368 to 004f72a Compare May 15, 2025 20:57
@xunilrj xunilrj temporarily deployed to fuel-sway-bot May 15, 2025 20:57 — with GitHub Actions Inactive
@xunilrj xunilrj temporarily deployed to fuel-sway-bot May 15, 2025 21:24 — with GitHub Actions Inactive
@xunilrj xunilrj temporarily deployed to fuel-sway-bot May 15, 2025 21:28 — with GitHub Actions Inactive
@xunilrj xunilrj self-assigned this May 15, 2025
@xunilrj xunilrj marked this pull request as ready for review May 16, 2025 12:03
@xunilrj xunilrj requested review from a team as code owners May 16, 2025 12:03
@xunilrj xunilrj mentioned this pull request May 19, 2025
17 tasks
tritao
tritao previously approved these changes May 20, 2025
Copy link
Contributor

@tritao tritao left a comment

Choose a reason for hiding this comment

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

Looks good, just a few nits

@xunilrj xunilrj force-pushed the xunilrj/standalone-fn-const-generics branch from 4cccaa0 to b271777 Compare May 22, 2025 20:07
@xunilrj xunilrj temporarily deployed to fuel-sway-bot May 22, 2025 20:07 — with GitHub Actions Inactive
@JoshuaBatty JoshuaBatty merged commit 5e7e4bc into master May 23, 2025
43 checks passed
@JoshuaBatty JoshuaBatty deleted the xunilrj/standalone-fn-const-generics branch May 23, 2025 00:08
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 this pull request may close these issues.

3 participants