Skip to content

Use adt_const_params for Scope and Semantics const generics - #635

Open
nazar-pc wants to merge 1 commit into
Rust-GPU:mainfrom
nazar-pc:adt_const_params-scope-semantics
Open

Use adt_const_params for Scope and Semantics const generics#635
nazar-pc wants to merge 1 commit into
Rust-GPU:mainfrom
nazar-pc:adt_const_params-scope-semantics

Conversation

@nazar-pc

@nazar-pc nazar-pc commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

This implements #607 and resolves #414 using adt_const_params.

Implementation has been on nightly for a long time without major known issues AFAIK. docs.rs already compiles docs with nightly toolchain, so should not be a problem there either.

This makes developer experience better with improved type safety. As a bonus ordering validity is now checked at compile time.

| between memory semantics options is technically possible with even more nightly features, but didn't seem worth it for now.

The changes are essentially mechanical.

@Firestar99
Firestar99 force-pushed the adt_const_params-scope-semantics branch from 80bf1ad to 0c20561 Compare August 4, 2026 11:40

@Firestar99 Firestar99 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not considering this patch requiring a nightly feature, I think the patch looks good. I squashed in a small cleanup to deduplicate

-    const {
-        assert!(
-            SEMANTICS.has_valid_ordering(),
-            "at most one memory-ordering flag (ACQUIRE, RELEASE, ACQUIRE_RELEASE or \
-             SEQUENTIALLY_CONST) may be set"
-        );
-    }
-
+    const { SEMANTICS.assert_valid() }

Give me an hour or two, I have an idea I want to toy around with that may solve our stable vs nightly feature problem...

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.

Make Scope and Semantics normal arguments rather than const generics

2 participants