about summary refs log tree commit diff
path: root/src/test/run-pass/thinlto
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2016-09-12 22:11:05 -0700
committerEsteban Küber <esteban@kuber.com.ar>2016-10-22 11:37:22 -0700
commita449bdb20e5fd691f6d2445a6a58f5a089d60dc1 (patch)
tree39e023afe955138473b3882b5ff4143f52c6dbd1 /src/test/run-pass/thinlto
parentb5f6d7ec2d4e231b9ef0c8a9e8e7ec8a7f67d2ae (diff)
downloadrust-a449bdb20e5fd691f6d2445a6a58f5a089d60dc1.tar.gz
rust-a449bdb20e5fd691f6d2445a6a58f5a089d60dc1.zip
Reword error when data-less enum variant called as function
Given a file like:

```rust
enum Test {
    Variant,
    Variant2 {a: u32},
}

fn main(){
    let x = Test::Variant("Hello");
    let y = Test::Variant2("World");
}
```

The errors now look this way:

```bash
error[E0423]: `Test::Variant2` is the name of a struct or struct variant, but this expression uses it like a function name
  --> file3.rs:10:13
   |
10 |     let y = Test::Variant2("Hello");
   |             ^^^^^^^^^^^^^^ struct called like a function
   |
   = help: did you mean to write: `Test::Variant2 { /* fields */ }`?

error: `Test::Variant` is being called, but it is not a function
 --> file3.rs:9:13
  |
9 |     let x = Test::Variant("World");
  |             ^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: did you mean to write: `Test::Variant`?
note: defined here
 --> file3.rs:2:5
  |
2 |     Variant,
  |     ^^^^^^^

error: aborting due to previous error
```
Diffstat (limited to 'src/test/run-pass/thinlto')
0 files changed, 0 insertions, 0 deletions