diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-08-20 07:09:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-20 07:09:05 +0200 |
| commit | af89769c82eeae85d5e7ecac94ac97ede0f0f147 (patch) | |
| tree | d0854d61c9a2e3114a5960022b9fbb396d46a3c4 /src/test/ui/parser/fn-defined-using-function.rs | |
| parent | 1e47e8a9ee83f2b6e110f225f3738392088aa2a9 (diff) | |
| parent | 1b54ad0585ca25b779be93d1149930664f722dc3 (diff) | |
| download | rust-af89769c82eeae85d5e7ecac94ac97ede0f0f147.tar.gz rust-af89769c82eeae85d5e7ecac94ac97ede0f0f147.zip | |
Rollup merge of #100750 - akabinds:akabinds/improved-invalid-function-qual-error, r=davidtwco
improved diagnostic for function defined with `def`, `fun`, `func`, or `function` instead of `fn` Closes #99751
Diffstat (limited to 'src/test/ui/parser/fn-defined-using-function.rs')
| -rw-r--r-- | src/test/ui/parser/fn-defined-using-function.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/ui/parser/fn-defined-using-function.rs b/src/test/ui/parser/fn-defined-using-function.rs new file mode 100644 index 00000000000..fd8782728e2 --- /dev/null +++ b/src/test/ui/parser/fn-defined-using-function.rs @@ -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() {} |
