From: bors Date: Sat, 8 Apr 2017 09:23:28 +0000 (+0000) Subject: Auto merge of #40775 - estebank:variant-as-type, r=petrochenkov X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=4cadff61ef395f3937d950e35304969ced2ea0b0;p=rust.git Auto merge of #40775 - estebank:variant-as-type, r=petrochenkov Suggest using enum when a variant is used as a type Given a file: ```rust enum Fruit { Apple(i64), Orange(i64), } fn should_return_fruit() -> Apple { Apple(5) } ``` Provide the following output: ```rust error[E0412]: cannot find type `Apple` in this scope --> file.rs:16:29 | 16 | fn should_return_fruit() -> Apple { | ^^^^^ not found in this scope | help: there is an enum variant `Fruit::Apple`, did you mean to use `Fruit`? --> file.rs:12:5 | 12 | Apple(i64), | ^^^^^^^^^^ error[E0425]: cannot find function `Apple` in this scope --> file.rs:17:5 | 17 | Apple(5) | ^^^^^ not found in this scope | = help: possible candidate is found in another module, you can import it into scope: `use Fruit::Apple;` ``` Fix #35675. --- 4cadff61ef395f3937d950e35304969ced2ea0b0