diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2021-02-25 14:34:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-25 14:34:00 +0100 |
| commit | 6bf486711b38c1b794f2545b40fc489fc174c5ef (patch) | |
| tree | b1bc162327d2bb217a9a372c4c4982f1fe31dcd8 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 00aa3e68806e50431d51fc7f6ce66f2a4548f4cd (diff) | |
| parent | d7cb66d389c3ef542891a26ee3c12308b407fcd6 (diff) | |
| download | rust-6bf486711b38c1b794f2545b40fc489fc174c5ef.tar.gz rust-6bf486711b38c1b794f2545b40fc489fc174c5ef.zip | |
Rollup merge of #82220 - henryboisdequin:fixes-80853, r=varkor
fix the false 'defined here' messages
Closes #80853.
Take this code:
```rust
struct S;
fn repro_ref(thing: S) {
thing();
}
```
Previously, the error message would be this:
```
error[E0618]: expected function, found `S`
--> src/lib.rs:4:5
|
3 | fn repro_ref(thing: S) {
| ----- `S` defined here
4 | thing();
| ^^^^^--
| |
| call expression requires function
error: aborting due to previous error
```
This is incorrect as `S` is not defined in the function arguments, `thing` is defined there. With this change, the following is emitted:
```
error[E0618]: expected function, found `S`
--> $DIR/80853.rs:4:5
|
LL | fn repro_ref(thing: S) {
| ----- is of type `S`
LL | thing();
| ^^^^^--
| |
| call expression requires function
|
= note: local variable `S` is not a function
error: aborting due to previous error
```
As you can see, this error message points out that `thing` is of type `S` and later in a note, that `S` is not a function. This change does seem like a downside for some error messages. Take this example:
```
LL | struct Empty2;
| -------------- is of type `Empty2`
```
As you can see, the error message shows that the definition of `Empty2` is of type `Empty2`. Although this isn't wrong, it would be more helpful if it would say something like this (which was there previously):
```
LL | struct Empty2;
| -------------- `Empty2` defined here
```
If there is a better way of doing this, where the `Empty2` example would stay the same as without this change, please inform me.
**Update: This is now fixed**
CC `@camelid`
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
