-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added improved diagnostic for a function defined with an invalid qual…
…ifier
- Loading branch information
akabinds
committed
Aug 18, 2022
1 parent
801821d
commit 1b54ad0
Showing
9 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Check what happens when `def` is used to define a function, instead of `fn` | ||
// edition:2021 | ||
|
||
#![allow(dead_code)] | ||
|
||
def foo() {} | ||
//~^ ERROR expected one of `!` or `::`, found `foo` | ||
//~^^ HELP write `fn` instead of `def` to declare a function | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error: expected one of `!` or `::`, found `foo` | ||
--> $DIR/fn-defined-using-def.rs:6:5 | ||
| | ||
LL | def foo() {} | ||
| --- ^^^ expected one of `!` or `::` | ||
| | | ||
| help: write `fn` instead of `def` to declare a function | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Check what happens when `fun` is used to define a function, instead of `fn` | ||
// edition:2021 | ||
|
||
#![allow(dead_code)] | ||
|
||
fun foo() {} | ||
//~^ ERROR expected one of `!` or `::`, found `foo` | ||
//~^^ HELP write `fn` instead of `fun` to declare a function | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error: expected one of `!` or `::`, found `foo` | ||
--> $DIR/fn-defined-using-fun.rs:6:5 | ||
| | ||
LL | fun foo() {} | ||
| --- ^^^ expected one of `!` or `::` | ||
| | | ||
| help: write `fn` instead of `fun` to declare a function | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Check what happens when `func` is used to define a function, instead of `fn` | ||
// edition:2021 | ||
|
||
#![allow(dead_code)] | ||
|
||
func foo() {} | ||
//~^ ERROR expected one of `!` or `::`, found `foo` | ||
//~^^ HELP write `fn` instead of `func` to declare a function | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error: expected one of `!` or `::`, found `foo` | ||
--> $DIR/fn-defined-using-func.rs:6:6 | ||
| | ||
LL | func foo() {} | ||
| ---- ^^^ expected one of `!` or `::` | ||
| | | ||
| help: write `fn` instead of `func` to declare a function | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Check what happens when `function` is used to define a function, instead of `fn` | ||
// edition:2021 | ||
|
||
#![allow(dead_code)] | ||
|
||
function foo() {} | ||
//~^ ERROR expected one of `!` or `::`, found `foo` | ||
//~^^ HELP write `fn` instead of `function` to declare a function | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error: expected one of `!` or `::`, found `foo` | ||
--> $DIR/fn-defined-using-function.rs:6:10 | ||
| | ||
LL | function foo() {} | ||
| -------- ^^^ expected one of `!` or `::` | ||
| | | ||
| help: write `fn` instead of `function` to declare a function | ||
|
||
error: aborting due to previous error | ||
|