@@ -20,7 +20,7 @@ const trait Default {
20
20
}
21
21
22
22
impl const Default for () {
23
- const fn default () {}
23
+ ( const ) fn default () {}
24
24
}
25
25
26
26
struct Thing <T >(T );
@@ -180,11 +180,11 @@ Free functions are unaffected and will stay as `const fn`.
180
180
181
181
### Impls for conditionally const methods
182
182
183
- Methods that are declared as ` (const) ` on a trait can now be made ` const ` in an impl, if that impl is marked as ` impl cosnt Trait ` :
183
+ Methods that are declared as ` (const) ` on a trait can now also be made ` ( const) ` in an impl, if that impl is marked as ` impl const Trait ` :
184
184
185
185
``` rust
186
186
impl const Trait for Type {
187
- const fn thing () {}
187
+ ( const ) fn thing () {}
188
188
}
189
189
```
190
190
@@ -202,7 +202,7 @@ const trait Foo {
202
202
}
203
203
204
204
impl const Foo for () {
205
- const fn foo (& self ) {}
205
+ ( const ) fn foo (& self ) {}
206
206
fn bar (& self ) {
207
207
println! (" writing to terminal is not possible in const eval" );
208
208
}
@@ -221,11 +221,11 @@ const trait Default {
221
221
}
222
222
223
223
impl const Default for () {
224
- const fn default () {}
224
+ ( const ) fn default () {}
225
225
}
226
226
227
227
impl <T : Default > const Default for Box <T > {
228
- fn default () -> Self { Box :: new (T :: default ()) }
228
+ ( const ) fn default () -> Self { Box :: new (T :: default ()) }
229
229
}
230
230
231
231
// This function requires a `const` impl for the type passed for T,
@@ -304,7 +304,7 @@ struct MyStruct<T>(T);
304
304
305
305
impl <T : (const ) Add <Output = T >> const Add for MyStruct <T > {
306
306
type Output = MyStruct <T >;
307
- const fn add (self , other : MyStruct <T >) -> MyStruct <T > {
307
+ ( const ) fn add (self , other : MyStruct <T >) -> MyStruct <T > {
308
308
MyStruct (self . 0 + other . 0 )
309
309
}
310
310
}
@@ -314,7 +314,7 @@ where
314
314
for <'a > & 'a T : (const ) Add <Output = T >,
315
315
{
316
316
type Output = MyStruct <T >;
317
- const fn add (self , other : & MyStruct <T >) -> MyStruct <T > {
317
+ ( const ) fn add (self , other : & MyStruct <T >) -> MyStruct <T > {
318
318
MyStruct (& self . 0 + & other . 0 )
319
319
}
320
320
}
@@ -605,7 +605,7 @@ struct NewType<T>(T);
605
605
606
606
impl <T : (const ) Add <Output = T >> const Add for NewType <T > {
607
607
type Output = Self ;
608
- fn add (self , other : Self ) -> Self :: Output {
608
+ ( const ) fn add (self , other : Self ) -> Self :: Output {
609
609
NewType (self . 0 + other . 0 )
610
610
}
611
611
}
@@ -620,7 +620,7 @@ struct Error;
620
620
621
621
impl <T : (const ) Add <Output = T >> const Add for NewType <T > {
622
622
type Output = Result <Self , Error >;
623
- fn add (self , other : Self ) -> Self :: Output {
623
+ ( const ) fn add (self , other : Self ) -> Self :: Output {
624
624
if self . 1 {
625
625
Ok (NewType (self . 0 + other . 0 , other . 1 ))
626
626
} else {
@@ -670,7 +670,7 @@ const trait Bar {
670
670
struct Foo <T : Bar >(T );
671
671
672
672
impl <T : (const ) Bar > const Drop for Foo <T > {
673
- const fn drop (& mut self ) {
673
+ ( const ) fn drop (& mut self ) {
674
674
self . 0. thing ();
675
675
}
676
676
}
@@ -689,7 +689,7 @@ Extraneous `(const) Trait` bounds where `Trait` isn't a bound on the type at all
689
689
690
690
``` rust
691
691
impl <T : (const ) Bar + (const ) Baz > const Drop for Foo <T > {
692
- const fn drop (& mut self ) {
692
+ ( const ) fn drop (& mut self ) {
693
693
self . 0. thing ();
694
694
}
695
695
}
0 commit comments