parent
9ad1e7c46c
commit
e001c5f9d8
@ -445,6 +445,12 @@ fn smart_resolve_context_dependent_help(
|
|||||||
(Res::Def(DefKind::Ctor(_, CtorKind::Fictive), _), _) if ns == ValueNS => {
|
(Res::Def(DefKind::Ctor(_, CtorKind::Fictive), _), _) if ns == ValueNS => {
|
||||||
bad_struct_syntax_suggestion();
|
bad_struct_syntax_suggestion();
|
||||||
}
|
}
|
||||||
|
(Res::Def(DefKind::Ctor(_, CtorKind::Fn), _), _) if ns == ValueNS => {
|
||||||
|
err.span_label(
|
||||||
|
span,
|
||||||
|
format!("did you mean `{} ( /* fields */ )`?", path_str),
|
||||||
|
);
|
||||||
|
}
|
||||||
(Res::SelfTy(..), _) if ns == ValueNS => {
|
(Res::SelfTy(..), _) if ns == ValueNS => {
|
||||||
err.span_label(span, fallback_label);
|
err.span_label(span, fallback_label);
|
||||||
err.note("can't use `Self` as a constructor, you must use the implemented struct");
|
err.note("can't use `Self` as a constructor, you must use the implemented struct");
|
||||||
|
@ -20,15 +20,16 @@ error[E0532]: expected unit struct/variant or constant, found tuple variant `E::
|
|||||||
--> $DIR/empty-struct-tuple-pat.rs:29:9
|
--> $DIR/empty-struct-tuple-pat.rs:29:9
|
||||||
|
|
|
|
||||||
LL | E::Empty4 => ()
|
LL | E::Empty4 => ()
|
||||||
| ^^^^^^^^^ not a unit struct/variant or constant
|
| ^^^^^^^^^ did you mean `E::Empty4 ( /* fields */ )`?
|
||||||
|
|
||||||
error[E0532]: expected unit struct/variant or constant, found tuple variant `XE::XEmpty5`
|
error[E0532]: expected unit struct/variant or constant, found tuple variant `XE::XEmpty5`
|
||||||
--> $DIR/empty-struct-tuple-pat.rs:33:9
|
--> $DIR/empty-struct-tuple-pat.rs:33:9
|
||||||
|
|
|
|
||||||
LL | XE::XEmpty5 => (),
|
LL | XE::XEmpty5 => (),
|
||||||
| ^^^^-------
|
| ^^^^-------
|
||||||
| |
|
| | |
|
||||||
| help: a unit variant with a similar name exists: `XEmpty4`
|
| | help: a unit variant with a similar name exists: `XEmpty4`
|
||||||
|
| did you mean `XE::XEmpty5 ( /* fields */ )`?
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
@ -3,8 +3,9 @@ error[E0532]: expected unit struct/variant or constant, found tuple variant `Foo
|
|||||||
|
|
|
|
||||||
LL | Foo::Bar => {}
|
LL | Foo::Bar => {}
|
||||||
| ^^^^^---
|
| ^^^^^---
|
||||||
| |
|
| | |
|
||||||
| help: a unit variant with a similar name exists: `Baz`
|
| | help: a unit variant with a similar name exists: `Baz`
|
||||||
|
| did you mean `Foo::Bar ( /* fields */ )`?
|
||||||
|
|
||||||
error[E0532]: expected tuple struct/variant, found unit struct `S`
|
error[E0532]: expected tuple struct/variant, found unit struct `S`
|
||||||
--> $DIR/issue-32004.rs:16:9
|
--> $DIR/issue-32004.rs:16:9
|
||||||
|
15
src/test/ui/issues/issue-63983.rs
Normal file
15
src/test/ui/issues/issue-63983.rs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
enum MyEnum {
|
||||||
|
Tuple(i32),
|
||||||
|
Struct{ s: i32 },
|
||||||
|
}
|
||||||
|
|
||||||
|
fn foo(en: MyEnum) {
|
||||||
|
match en {
|
||||||
|
MyEnum::Tuple => "",
|
||||||
|
//~^ ERROR expected unit struct/variant or constant, found tuple variant `MyEnum::Tuple`
|
||||||
|
MyEnum::Struct => "",
|
||||||
|
//~^ ERROR expected unit struct/variant or constant, found struct variant `MyEnum::Struct`
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
15
src/test/ui/issues/issue-63983.stderr
Normal file
15
src/test/ui/issues/issue-63983.stderr
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
error[E0532]: expected unit struct/variant or constant, found tuple variant `MyEnum::Tuple`
|
||||||
|
--> $DIR/issue-63983.rs:8:9
|
||||||
|
|
|
||||||
|
LL | MyEnum::Tuple => "",
|
||||||
|
| ^^^^^^^^^^^^^ did you mean `MyEnum::Tuple ( /* fields */ )`?
|
||||||
|
|
||||||
|
error[E0532]: expected unit struct/variant or constant, found struct variant `MyEnum::Struct`
|
||||||
|
--> $DIR/issue-63983.rs:10:9
|
||||||
|
|
|
||||||
|
LL | MyEnum::Struct => "",
|
||||||
|
| ^^^^^^^^^^^^^^ did you mean `MyEnum::Struct { /* fields */ }`?
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0532`.
|
Loading…
Reference in New Issue
Block a user