@@ -688,8 +688,8 @@ See also https://doc.rust-lang.org/book/first-edition/no-stdlib.html
688
688
"## ,
689
689
690
690
E0214 : r##"
691
- A generic type was described using parentheses rather than angle brackets. For
692
- example:
691
+ A generic type was described using parentheses rather than angle brackets.
692
+ For example:
693
693
694
694
```compile_fail,E0214
695
695
fn main() {
@@ -702,6 +702,93 @@ Parentheses are currently only used with generic types when defining parameters
702
702
for `Fn`-family traits.
703
703
"## ,
704
704
705
+ E0230 : r##"
706
+ The `#[rustc_on_unimplemented]` attribute lets you specify a custom error
707
+ message for when a particular trait isn't implemented on a type placed in a
708
+ position that needs that trait. For example, when the following code is
709
+ compiled:
710
+
711
+ ```compile_fail
712
+ #![feature(on_unimplemented)]
713
+
714
+ fn foo<T: Index<u8>>(x: T){}
715
+
716
+ #[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
717
+ trait Index<Idx> { /* ... */ }
718
+
719
+ foo(true); // `bool` does not implement `Index<u8>`
720
+ ```
721
+
722
+ There will be an error about `bool` not implementing `Index<u8>`, followed by a
723
+ note saying "the type `bool` cannot be indexed by `u8`".
724
+
725
+ As you can see, you can specify type parameters in curly braces for
726
+ substitution with the actual types (using the regular format string syntax) in
727
+ a given situation. Furthermore, `{Self}` will substitute to the type (in this
728
+ case, `bool`) that we tried to use.
729
+
730
+ This error appears when the curly braces contain an identifier which doesn't
731
+ match with any of the type parameters or the string `Self`. This might happen
732
+ if you misspelled a type parameter, or if you intended to use literal curly
733
+ braces. If it is the latter, escape the curly braces with a second curly brace
734
+ of the same type; e.g. a literal `{` is `{{`.
735
+ "## ,
736
+
737
+ E0231 : r##"
738
+ The `#[rustc_on_unimplemented]` attribute lets you specify a custom error
739
+ message for when a particular trait isn't implemented on a type placed in a
740
+ position that needs that trait. For example, when the following code is
741
+ compiled:
742
+
743
+ ```compile_fail
744
+ #![feature(on_unimplemented)]
745
+
746
+ fn foo<T: Index<u8>>(x: T){}
747
+
748
+ #[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
749
+ trait Index<Idx> { /* ... */ }
750
+
751
+ foo(true); // `bool` does not implement `Index<u8>`
752
+ ```
753
+
754
+ there will be an error about `bool` not implementing `Index<u8>`, followed by a
755
+ note saying "the type `bool` cannot be indexed by `u8`".
756
+
757
+ As you can see, you can specify type parameters in curly braces for
758
+ substitution with the actual types (using the regular format string syntax) in
759
+ a given situation. Furthermore, `{Self}` will substitute to the type (in this
760
+ case, `bool`) that we tried to use.
761
+
762
+ This error appears when the curly braces do not contain an identifier. Please
763
+ add one of the same name as a type parameter. If you intended to use literal
764
+ braces, use `{{` and `}}` to escape them.
765
+ "## ,
766
+
767
+ E0232 : r##"
768
+ The `#[rustc_on_unimplemented]` attribute lets you specify a custom error
769
+ message for when a particular trait isn't implemented on a type placed in a
770
+ position that needs that trait. For example, when the following code is
771
+ compiled:
772
+
773
+ ```compile_fail
774
+ #![feature(on_unimplemented)]
775
+
776
+ fn foo<T: Index<u8>>(x: T){}
777
+
778
+ #[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
779
+ trait Index<Idx> { /* ... */ }
780
+
781
+ foo(true); // `bool` does not implement `Index<u8>`
782
+ ```
783
+
784
+ there will be an error about `bool` not implementing `Index<u8>`, followed by a
785
+ note saying "the type `bool` cannot be indexed by `u8`".
786
+
787
+ For this to work, some note must be specified. An empty attribute will not do
788
+ anything, please remove the attribute or add some helpful note for users of the
789
+ trait.
790
+ "## ,
791
+
705
792
E0261 : r##"
706
793
When using a lifetime like `'a` in a type, it must be declared before being
707
794
used.
@@ -917,92 +1004,6 @@ for v in &vs {
917
1004
```
918
1005
"## ,
919
1006
920
- E0272 : r##"
921
- The `#[rustc_on_unimplemented]` attribute lets you specify a custom error
922
- message for when a particular trait isn't implemented on a type placed in a
923
- position that needs that trait. For example, when the following code is
924
- compiled:
925
-
926
- ```compile_fail
927
- #![feature(on_unimplemented)]
928
-
929
- fn foo<T: Index<u8>>(x: T){}
930
-
931
- #[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
932
- trait Index<Idx> { /* ... */ }
933
-
934
- foo(true); // `bool` does not implement `Index<u8>`
935
- ```
936
-
937
- There will be an error about `bool` not implementing `Index<u8>`, followed by a
938
- note saying "the type `bool` cannot be indexed by `u8`".
939
-
940
- As you can see, you can specify type parameters in curly braces for
941
- substitution with the actual types (using the regular format string syntax) in
942
- a given situation. Furthermore, `{Self}` will substitute to the type (in this
943
- case, `bool`) that we tried to use.
944
-
945
- This error appears when the curly braces contain an identifier which doesn't
946
- match with any of the type parameters or the string `Self`. This might happen
947
- if you misspelled a type parameter, or if you intended to use literal curly
948
- braces. If it is the latter, escape the curly braces with a second curly brace
949
- of the same type; e.g. a literal `{` is `{{`.
950
- "## ,
951
-
952
- E0273 : r##"
953
- The `#[rustc_on_unimplemented]` attribute lets you specify a custom error
954
- message for when a particular trait isn't implemented on a type placed in a
955
- position that needs that trait. For example, when the following code is
956
- compiled:
957
-
958
- ```compile_fail
959
- #![feature(on_unimplemented)]
960
-
961
- fn foo<T: Index<u8>>(x: T){}
962
-
963
- #[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
964
- trait Index<Idx> { /* ... */ }
965
-
966
- foo(true); // `bool` does not implement `Index<u8>`
967
- ```
968
-
969
- there will be an error about `bool` not implementing `Index<u8>`, followed by a
970
- note saying "the type `bool` cannot be indexed by `u8`".
971
-
972
- As you can see, you can specify type parameters in curly braces for
973
- substitution with the actual types (using the regular format string syntax) in
974
- a given situation. Furthermore, `{Self}` will substitute to the type (in this
975
- case, `bool`) that we tried to use.
976
-
977
- This error appears when the curly braces do not contain an identifier. Please
978
- add one of the same name as a type parameter. If you intended to use literal
979
- braces, use `{{` and `}}` to escape them.
980
- "## ,
981
-
982
- E0274 : r##"
983
- The `#[rustc_on_unimplemented]` attribute lets you specify a custom error
984
- message for when a particular trait isn't implemented on a type placed in a
985
- position that needs that trait. For example, when the following code is
986
- compiled:
987
-
988
- ```compile_fail
989
- #![feature(on_unimplemented)]
990
-
991
- fn foo<T: Index<u8>>(x: T){}
992
-
993
- #[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
994
- trait Index<Idx> { /* ... */ }
995
-
996
- foo(true); // `bool` does not implement `Index<u8>`
997
- ```
998
-
999
- there will be an error about `bool` not implementing `Index<u8>`, followed by a
1000
- note saying "the type `bool` cannot be indexed by `u8`".
1001
-
1002
- For this to work, some note must be specified. An empty attribute will not do
1003
- anything, please remove the attribute or add some helpful note for users of the
1004
- trait.
1005
- "## ,
1006
1007
1007
1008
E0275 : r##"
1008
1009
This error occurs when there was a recursive trait requirement that overflowed
@@ -2011,6 +2012,9 @@ register_diagnostics! {
2011
2012
// E0102, // replaced with E0282
2012
2013
// E0134,
2013
2014
// E0135,
2015
+ // E0272, // on_unimplemented #0
2016
+ // E0273, // on_unimplemented #1
2017
+ // E0274, // on_unimplemented #2
2014
2018
E0278 , // requirement is not satisfied
2015
2019
E0279 , // requirement is not satisfied
2016
2020
E0280 , // requirement is not satisfied
0 commit comments