]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0518.md
Rollup merge of #62514 - stephaneyfx:box-ffi, r=nikomatsakis
[rust.git] / src / librustc_error_codes / error_codes / E0518.md
1 This error indicates that an `#[inline(..)]` attribute was incorrectly placed
2 on something other than a function or method.
3
4 Examples of erroneous code:
5
6 ```compile_fail,E0518
7 #[inline(always)]
8 struct Foo;
9
10 #[inline(never)]
11 impl Foo {
12     // ...
13 }
14 ```
15
16 `#[inline]` hints the compiler whether or not to attempt to inline a method or
17 function. By default, the compiler does a pretty good job of figuring this out
18 itself, but if you feel the need for annotations, `#[inline(always)]` and
19 `#[inline(never)]` can override or force the compiler's decision.
20
21 If you wish to apply this attribute to all methods in an impl, manually annotate
22 each method; it is not possible to annotate the entire impl with an `#[inline]`
23 attribute.