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