@@ -494,17 +494,17 @@ The `cold` and `inline` attributes give suggestions to the compiler to compile
494
494
your code in a way that may be faster than what it would do without the hint .
495
495
The attributes are only suggestions , and the compiler may choose to ignore it .
496
496
497
+ Both attributes can be used on closures , [functions ] and function prototypes ,
498
+ although they do not do anything on function prototypes . When applied to a
499
+ function in a [trait ], they apply only to that function when used as a default
500
+ function for a trait implementation and not to all trait implementations .
501
+
497
502
#### `inline ` Attribute
498
503
499
504
The * `inline ` attribute * suggests to the compiler that it should place a copy of
500
505
the attributed function in the caller , rather than generating code to call the
501
506
function where it is defined .
502
507
503
- This attribute can be used on [functions ] and function prototypes , although it
504
- does not do anything on function prototypes . When this attribute is applied to
505
- a function in a [trait ], it applies only to that function when used as a default
506
- function for a trait implementation and not to all trait implementations .
507
-
508
508
> ** * Note *** : The compiler automatically inlines functions based on internal
509
509
> heuristics . Incorrectly inlining functions can actually make the program
510
510
> slower , so this attribute should be used with care .
@@ -517,13 +517,8 @@ There are three ways of using the inline attribute:
517
517
518
518
#### `cold ` Attribute
519
519
520
- The * `cold ` attribute * suggests to the compiler that the attributed function is
521
- unlikely to be called .
522
-
523
- This attribute can be used on [functions ] and function prototypes , although it
524
- does not do anything on function prototypes . When this attribute is applied to
525
- a function in a [trait ], it applies only to that function when used as a default
526
- function for a trait implementation and not to all trait implementations .
520
+ The * `cold ` attribute * suggests to the compiler that the attributed function or
521
+ closure is unlikely to be called .
527
522
528
523
### `derive `
529
524
0 commit comments