We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
const trait
1 parent 7d86f87 commit 3f38757Copy full SHA for 3f38757
const-generic-const-fn-bounds.md
@@ -328,6 +328,22 @@ const fn foo<T: ?const Foo>() -> i32 {
328
329
even though the `?const` modifier explicitly opts out of constness.
330
331
+### `const` traits
332
+
333
+A further extension could be `const trait` declarations, which desugar to all methods being `const`:
334
335
+```rust
336
+const trait V {
337
+ fn foo(C) -> D;
338
+ fn bar(E) -> F;
339
+}
340
+// ...desugars to...
341
+trait V {
342
+ const fn foo(C) -> D;
343
+ const fn bar(E) -> F;
344
345
+```
346
347
## `?const` modifiers in trait methods
348
349
This RFC does not touch `trait` methods at all, all traits are defined as they would be defined
0 commit comments