diff --git a/compiler/rustc_error_codes/src/error_codes/E0747.md b/compiler/rustc_error_codes/src/error_codes/E0747.md index caf7e0fba07a3..9514c7dac6bdf 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0747.md +++ b/compiler/rustc_error_codes/src/error_codes/E0747.md @@ -1,5 +1,6 @@ Generic arguments were not provided in the same order as the corresponding -generic parameters are declared. +generic parameters are declared, or a type was provided when a constant +was expected. Erroneous code example: @@ -18,3 +19,21 @@ struct S<'a, T>(&'a T); type X = S<'static, ()>; // ok ``` + +Another erroneous code example: + +```compile_fail,E0747 +struct Foo; + +fn foo() -> Foo {} // error: type provided when a constant was + // expected +``` + +A constant expression must be provided when a constant generic parameter +is declared, not a type, as in the following: + +``` +struct Foo; + +fn foo() -> Foo<3> { Foo } +```