]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/diagnostics.rs
Rollup merge of #32447 - nodakai:dots-in-err-idx, r=Manishearth
[rust.git] / src / librustc / diagnostics.rs
index 92db527ef9803ac3b0e1f8b52a994f113a0de5c1..9348c05d444613ee930062f449f99d28e53fb83f 100644 (file)
@@ -1261,7 +1261,7 @@ fn foo<T>(t: T) where T: Trait<AssociatedType = &'static str> {
 fn foo<T: Index<u8>>(x: T){}
 
 #[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
-trait Index<Idx> { ... }
+trait Index<Idx> { /* ... */ }
 
 foo(true); // `bool` does not implement `Index<u8>`
 ```
@@ -1291,7 +1291,7 @@ trait Index<Idx> { ... }
 fn foo<T: Index<u8>>(x: T){}
 
 #[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
-trait Index<Idx> { ... }
+trait Index<Idx> { /* ... */ }
 
 foo(true); // `bool` does not implement `Index<u8>`
 ```
@@ -1319,7 +1319,7 @@ trait Index<Idx> { ... }
 fn foo<T: Index<u8>>(x: T){}
 
 #[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
-trait Index<Idx> { ... }
+trait Index<Idx> { /* ... */ }
 
 foo(true); // `bool` does not implement `Index<u8>`
 ```
@@ -1962,6 +1962,23 @@ impl Foo {
 attribute.
 "##,
 
+E0522: r##"
+The lang attribute is intended for marking special items that are built-in to
+Rust itself. This includes special traits (like `Copy` and `Sized`) that affect
+how the compiler behaves, as well as special functions that may be automatically
+invoked (such as the handler for out-of-bounds accesses when indexing a slice).
+Erroneous code example:
+
+```compile_fail
+#![feature(lang_items)]
+
+#[lang = "cookie"]
+fn cookie() -> ! { // error: definition of an unknown language item: `cookie`
+    loop {}
+}
+```
+"##,
+
 }