Improve diagnostics for function passed when a type was expected.
This commit is contained in:
parent
e11a9fa52a
commit
e558ddbb3a
5 changed files with 41 additions and 0 deletions
6
src/test/ui/generics/generic-function-item-where-type.rs
Normal file
6
src/test/ui/generics/generic-function-item-where-type.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
fn foo<U>() {}
|
||||
|
||||
fn main() {
|
||||
foo::<main>()
|
||||
//~^ ERROR constant provided when a type was expected
|
||||
}
|
||||
12
src/test/ui/generics/generic-function-item-where-type.stderr
Normal file
12
src/test/ui/generics/generic-function-item-where-type.stderr
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
error[E0747]: constant provided when a type was expected
|
||||
--> $DIR/generic-function-item-where-type.rs:4:11
|
||||
|
|
||||
LL | foo::<main>()
|
||||
| ^^^^
|
||||
|
|
||||
= help: `main` is a function item, not a type
|
||||
= help: function item types cannot be named directly
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0747`.
|
||||
|
|
@ -57,6 +57,9 @@ error[E0747]: constant provided when a type was expected
|
|||
|
|
||||
LL | let _x: Box<Bar>;
|
||||
| ^^^
|
||||
|
|
||||
= help: `Bar` is a function item, not a type
|
||||
= help: function item types cannot be named directly
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -83,12 +83,18 @@ error[E0747]: constant provided when a type was expected
|
|||
|
|
||||
LL | let _x : Box<Bar>;
|
||||
| ^^^
|
||||
|
|
||||
= help: `Bar` is a function item, not a type
|
||||
= help: function item types cannot be named directly
|
||||
|
||||
error[E0747]: constant provided when a type was expected
|
||||
--> $DIR/privacy-ns2.rs:48:17
|
||||
|
|
||||
LL | let _x: Box<Bar>;
|
||||
| ^^^
|
||||
|
|
||||
= help: `Bar` is a function item, not a type
|
||||
= help: function item types cannot be named directly
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue