Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion compiler/rustc_error_codes/src/error_codes/E0747.md
Original file line number Diff line number Diff line change
@@ -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:

Expand All @@ -18,3 +19,21 @@ struct S<'a, T>(&'a T);

type X = S<'static, ()>; // ok
```

Another erroneous code example:

```compile_fail,E0747
struct Foo<const N: usize>;

fn foo() -> Foo<usize> {} // 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<const N: usize>;

fn foo() -> Foo<3> { Foo }
```
Loading