Skip to content

Commit ded5c40

Browse files
committed
Placeholder syntax for method bodies that are const
1 parent 0293ea7 commit ded5c40

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

const-generic-const-fn-bounds.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,14 @@ in an `impl`. This has several uses, most notably
185185
* adding new methods is not a breaking change if they also have a default body
186186

187187
In order to keep both advantages in the presence of `impl const`s, we need a way to declare the
188-
method default body as being `const`. The author of this RFC considers prepending the default body's
189-
method signature with `const` to be the most intuitive syntax.
188+
method default body as being `const`. The exact syntax for doing so is left as an open question to
189+
be decided during the implementation and following final comment period. For now one can add the
190+
`#[default_method_body_is_const]` attribute to the method.
190191

191192
```rust
192193
trait Foo {
193-
const fn bar() {}
194+
#[default_method_body_is_const]
195+
fn bar() {}
194196
}
195197
```
196198

@@ -493,4 +495,5 @@ the function, would allow the above function to actually exist.
493495
# Unresolved questions
494496
[unresolved-questions]: #unresolved-questions
495497

496-
Everything has been addressed in the reviews
498+
The syntax for specifying that a trait method's default body is `const` is left unspecified and uses
499+
the `#[default_method_body_is_const]` attribute as the placeholder syntax.

0 commit comments

Comments
 (0)