]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0522.md
Rollup merge of #93556 - dtolnay:trailingcomma, r=cjgillot
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0522.md
1 The lang attribute was used in an invalid context.
2
3 Erroneous code example:
4
5 ```compile_fail,E0522
6 #![feature(lang_items)]
7
8 #[lang = "cookie"]
9 fn cookie() -> ! { // error: definition of an unknown language item: `cookie`
10     loop {}
11 }
12 ```
13
14 The lang attribute is intended for marking special items that are built-in to
15 Rust itself. This includes special traits (like `Copy` and `Sized`) that affect
16 how the compiler behaves, as well as special functions that may be automatically
17 invoked (such as the handler for out-of-bounds accesses when indexing a slice).