diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-09-30 10:22:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-30 10:22:37 +0200 |
| commit | 6906e64c30ca464c1bafed5b806283665d9e8f58 (patch) | |
| tree | 98bfdfd7189ad56f8d50b6c9e5e888c101418050 /compiler/rustc_llvm/llvm-wrapper/Linker.cpp | |
| parent | 25017f8bcece0f57cc1acd3b64394f30cbda11f4 (diff) | |
| parent | e665d20c020724fa356fef0214e14b4066563a29 (diff) | |
| download | rust-6906e64c30ca464c1bafed5b806283665d9e8f58.tar.gz rust-6906e64c30ca464c1bafed5b806283665d9e8f58.zip | |
Rollup merge of #102350 - TaKO8Ki:incomplete-fn-in-struct-definition, r=fee1-dead
Improve errors for incomplete functions in struct definitions
Given the following code:
```rust
fn main() {}
struct Foo {
fn
}
```
[playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=29139f870511f6918324be5ddc26c345)
The current output is:
```
Compiling playground v0.0.1 (/playground)
error: functions are not allowed in struct definitions
--> src/main.rs:4:5
|
4 | fn
| ^^
|
= help: unlike in C++, Java, and C#, functions are declared in `impl` blocks
= help: see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information
error: could not compile `playground` due to previous error
```
In this case, rustc should suggest escaping `fn` to use it as an identifier.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/Linker.cpp')
0 files changed, 0 insertions, 0 deletions
