-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Open
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.D-lack-of-suggestionDiagnostics: Adding a (structured) suggestion would increase the quality of the diagnostic.Diagnostics: Adding a (structured) suggestion would increase the quality of the diagnostic.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Found this while working on PR #150843.
Suggests binding const argument to assoc type
fn take(_: impl Iterator<0>) {}error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> src/lib.rs:1:17
|
1 | fn take(_: impl Iterator<0>) {}
| ^^^^^^^^ expected 0 generic arguments
|
note: trait defined here, with 0 generic parameters
--> /playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:40:11
|
40 | pub trait Iterator {
| ^^^^^^^^
help: replace the generic bound with the associated type
|
1 | fn take(_: impl Iterator<Item = 0>) {}
| ++++++
Doesn't suggest binding const argument to type assoc const under mGCA
#![feature(min_generic_const_args)]
trait Trait { #[type_const] const K: i32; }
fn take(_: impl Trait<0>) {}error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
--> src/lib.rs:3:17
|
3 | fn take(_: impl Trait<0>) {}
| ^^^^^--- help: remove the unnecessary generics
| |
| expected 0 generic arguments
|
note: trait defined here, with 0 generic parameters
--> src/lib.rs:2:7
|
2 | trait Trait { #[type_const] const K: i32; }
| ^^^^^
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.D-lack-of-suggestionDiagnostics: Adding a (structured) suggestion would increase the quality of the diagnostic.Diagnostics: Adding a (structured) suggestion would increase the quality of the diagnostic.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.