rust/tests/ui/resolve/enum-expected-value-suggest...

235 lines
5.7 KiB
Plaintext

error[E0423]: expected value, found enum `Foo`
--> $DIR/enum-expected-value-suggest-variants.rs:19:18
|
LL | let _: Foo = Foo.A(0);
| ^^^
|
note: the enum is defined here
--> $DIR/enum-expected-value-suggest-variants.rs:1:1
|
LL | / enum Foo {
LL | |
LL | | A(u32),
LL | | B(u32),
LL | | }
| |_^
help: use the path separator to refer to a variant
|
LL - let _: Foo = Foo.A(0);
LL + let _: Foo = Foo::A(0);
|
error[E0423]: expected value, found enum `Foo`
--> $DIR/enum-expected-value-suggest-variants.rs:23:18
|
LL | let _: Foo = Foo.Bad(0);
| ^^^
|
note: the enum is defined here
--> $DIR/enum-expected-value-suggest-variants.rs:1:1
|
LL | / enum Foo {
LL | |
LL | | A(u32),
LL | | B(u32),
LL | | }
| |_^
help: the following enum variants are available
|
LL - let _: Foo = Foo.Bad(0);
LL + let _: Foo = (Foo::A(/* fields */)).Bad(0);
|
LL - let _: Foo = Foo.Bad(0);
LL + let _: Foo = (Foo::B(/* fields */)).Bad(0);
|
error[E0423]: expected value, found enum `Bar`
--> $DIR/enum-expected-value-suggest-variants.rs:32:18
|
LL | let _: Bar = Bar.C(0);
| ^^^
|
note: the enum is defined here
--> $DIR/enum-expected-value-suggest-variants.rs:7:1
|
LL | / enum Bar {
LL | | C(u32),
LL | | D(u32),
LL | | E,
LL | | F,
LL | | }
| |_^
help: use the path separator to refer to a variant
|
LL - let _: Bar = Bar.C(0);
LL + let _: Bar = Bar::C(0);
|
error[E0423]: expected value, found enum `Bar`
--> $DIR/enum-expected-value-suggest-variants.rs:36:18
|
LL | let _: Bar = Bar.E;
| ^^^
|
note: the enum is defined here
--> $DIR/enum-expected-value-suggest-variants.rs:7:1
|
LL | / enum Bar {
LL | | C(u32),
LL | | D(u32),
LL | | E,
LL | | F,
LL | | }
| |_^
help: use the path separator to refer to a variant
|
LL - let _: Bar = Bar.E;
LL + let _: Bar = Bar::E;
|
error[E0423]: expected value, found enum `Bar`
--> $DIR/enum-expected-value-suggest-variants.rs:40:18
|
LL | let _: Bar = Bar.Bad(0);
| ^^^
|
note: the enum is defined here
--> $DIR/enum-expected-value-suggest-variants.rs:7:1
|
LL | / enum Bar {
LL | | C(u32),
LL | | D(u32),
LL | | E,
LL | | F,
LL | | }
| |_^
help: you might have meant to use one of the following enum variants
|
LL | let _: Bar = Bar::E.Bad(0);
| +++
LL | let _: Bar = Bar::F.Bad(0);
| +++
help: alternatively, the following enum variants are also available
|
LL - let _: Bar = Bar.Bad(0);
LL + let _: Bar = (Bar::C(/* fields */)).Bad(0);
|
LL - let _: Bar = Bar.Bad(0);
LL + let _: Bar = (Bar::D(/* fields */)).Bad(0);
|
error[E0423]: expected value, found enum `Bar`
--> $DIR/enum-expected-value-suggest-variants.rs:45:18
|
LL | let _: Bar = Bar.Bad;
| ^^^
|
note: the enum is defined here
--> $DIR/enum-expected-value-suggest-variants.rs:7:1
|
LL | / enum Bar {
LL | | C(u32),
LL | | D(u32),
LL | | E,
LL | | F,
LL | | }
| |_^
help: you might have meant to use one of the following enum variants
|
LL | let _: Bar = Bar::E.Bad;
| +++
LL | let _: Bar = Bar::F.Bad;
| +++
help: alternatively, the following enum variants are also available
|
LL - let _: Bar = Bar.Bad;
LL + let _: Bar = (Bar::C(/* fields */)).Bad;
|
LL - let _: Bar = Bar.Bad;
LL + let _: Bar = (Bar::D(/* fields */)).Bad;
|
error[E0531]: cannot find tuple struct or tuple variant `A` in this scope
--> $DIR/enum-expected-value-suggest-variants.rs:51:9
|
LL | A(..) => {}
| ^ not found in this scope
|
help: consider importing this tuple variant
|
LL + use Foo::A;
|
error[E0532]: expected tuple struct or tuple variant, found enum `Foo`
--> $DIR/enum-expected-value-suggest-variants.rs:53:9
|
LL | Foo(..) => {}
| ^^^
|
note: the enum is defined here
--> $DIR/enum-expected-value-suggest-variants.rs:1:1
|
LL | / enum Foo {
LL | |
LL | | A(u32),
LL | | B(u32),
LL | | }
| |_^
help: try to match against one of the enum's variants
|
LL | Foo::A(..) => {}
| +++
LL | Foo::B(..) => {}
| +++
error[E0423]: expected function, tuple struct or tuple variant, found enum `Foo`
--> $DIR/enum-expected-value-suggest-variants.rs:15:18
|
LL | let _: Foo = Foo(0);
| ^^^
|
note: the enum is defined here
--> $DIR/enum-expected-value-suggest-variants.rs:1:1
|
LL | / enum Foo {
LL | |
LL | | A(u32),
LL | | B(u32),
LL | | }
| |_^
help: try to construct one of the enum's variants
|
LL | let _: Foo = Foo::A(0);
| +++
LL | let _: Foo = Foo::B(0);
| +++
error[E0423]: expected function, tuple struct or tuple variant, found enum `Bar`
--> $DIR/enum-expected-value-suggest-variants.rs:27:18
|
LL | let _: Bar = Bar(0);
| ^^^
|
= help: you might have meant to construct one of the enum's non-tuple variants
note: the enum is defined here
--> $DIR/enum-expected-value-suggest-variants.rs:7:1
|
LL | / enum Bar {
LL | | C(u32),
LL | | D(u32),
LL | | E,
LL | | F,
LL | | }
| |_^
help: try to construct one of the enum's variants
|
LL | let _: Bar = Bar::C(0);
| +++
LL | let _: Bar = Bar::D(0);
| +++
error: aborting due to 10 previous errors
Some errors have detailed explanations: E0423, E0531, E0532.
For more information about an error, try `rustc --explain E0423`.