]> git.proxmox.com Git - rustc.git/blob - src/librustc_error_codes/error_codes/E0518.md
New upstream version 1.44.1+dfsg1
[rustc.git] / src / librustc_error_codes / error_codes / E0518.md
1 An `#[inline(..)]` attribute was incorrectly placed on something other than a
2 function or method.
3
4 Example 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.