Clarify the 'default is only allowed on...' error
Code like impl Foo { default fn foo() {} } will trigger the error error: `default` is only allowed on items in `impl` definitions --> src/lib.rs:5:5 | 5 | default fn foo() {} | -------^^^^^^^^^ | | | `default` because of this but that's very confusing! I *did* put it on an item in an impl! So this commit changes the message to error: `default` is only allowed on items in trait impls --> src/lib.rs:5:5 | 5 | default fn foo() {} | -------^^^^^^^^^ | | | `default` because of this
This commit is contained in:
parent
5bb68c31f8
commit
4e21942ba4
3 changed files with 13 additions and 13 deletions
|
@ -3,10 +3,10 @@
|
|||
fn main() {}
|
||||
|
||||
trait X {
|
||||
default const A: u8; //~ ERROR `default` is only allowed on items in `impl` definitions
|
||||
default const B: u8 = 0; //~ ERROR `default` is only allowed on items in `impl` definitions
|
||||
default type D; //~ ERROR `default` is only allowed on items in `impl` definitions
|
||||
default type C: Ord; //~ ERROR `default` is only allowed on items in `impl` definitions
|
||||
default fn f1(); //~ ERROR `default` is only allowed on items in `impl` definitions
|
||||
default fn f2() {} //~ ERROR `default` is only allowed on items in `impl` definitions
|
||||
default const A: u8; //~ ERROR `default` is only allowed on items in trait impls
|
||||
default const B: u8 = 0; //~ ERROR `default` is only allowed on items in trait impls
|
||||
default type D; //~ ERROR `default` is only allowed on items in trait impls
|
||||
default type C: Ord; //~ ERROR `default` is only allowed on items in trait impls
|
||||
default fn f1(); //~ ERROR `default` is only allowed on items in trait impls
|
||||
default fn f2() {} //~ ERROR `default` is only allowed on items in trait impls
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue