mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
Suggest struct pat on incorrect unit or tuple pat
When encountering a unit or tuple pattern for a struct-like item, suggest using the correct pattern. Use `insert_field_names_local` when evaluating variants and store field names even when the list is empty in order to produce accurate structured suggestions.
This commit is contained in:
parent
346aec9b02
commit
04298204ed
@ -300,9 +300,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn insert_field_names(&mut self, def_id: DefId, field_names: Vec<Spanned<Symbol>>) {
|
fn insert_field_names(&mut self, def_id: DefId, field_names: Vec<Spanned<Symbol>>) {
|
||||||
if !field_names.is_empty() {
|
self.r.field_names.insert(def_id, field_names);
|
||||||
self.r.field_names.insert(def_id, field_names);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn block_needs_anonymous_module(&mut self, block: &Block) -> bool {
|
fn block_needs_anonymous_module(&mut self, block: &Block) -> bool {
|
||||||
@ -1428,6 +1426,8 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
|
|||||||
let ctor_kind = CtorKind::from_ast(&variant.data);
|
let ctor_kind = CtorKind::from_ast(&variant.data);
|
||||||
let ctor_res = Res::Def(DefKind::Ctor(CtorOf::Variant, ctor_kind), ctor_def_id);
|
let ctor_res = Res::Def(DefKind::Ctor(CtorOf::Variant, ctor_kind), ctor_def_id);
|
||||||
self.r.define(parent, ident, ValueNS, (ctor_res, ctor_vis, variant.span, expn_id));
|
self.r.define(parent, ident, ValueNS, (ctor_res, ctor_vis, variant.span, expn_id));
|
||||||
|
// Record field names for error reporting.
|
||||||
|
self.insert_field_names_local(ctor_def_id, &variant.data);
|
||||||
|
|
||||||
visit::walk_variant(self, variant);
|
visit::walk_variant(self, variant);
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ crate enum PathSource<'a> {
|
|||||||
// Paths in struct expressions and patterns `Path { .. }`.
|
// Paths in struct expressions and patterns `Path { .. }`.
|
||||||
Struct,
|
Struct,
|
||||||
// Paths in tuple struct patterns `Path(..)`.
|
// Paths in tuple struct patterns `Path(..)`.
|
||||||
TupleStruct,
|
TupleStruct(Span),
|
||||||
// `m::A::B` in `<T as m::A>::B::C`.
|
// `m::A::B` in `<T as m::A>::B::C`.
|
||||||
TraitItem(Namespace),
|
TraitItem(Namespace),
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ impl<'a> PathSource<'a> {
|
|||||||
fn namespace(self) -> Namespace {
|
fn namespace(self) -> Namespace {
|
||||||
match self {
|
match self {
|
||||||
PathSource::Type | PathSource::Trait(_) | PathSource::Struct => TypeNS,
|
PathSource::Type | PathSource::Trait(_) | PathSource::Struct => TypeNS,
|
||||||
PathSource::Expr(..) | PathSource::Pat | PathSource::TupleStruct => ValueNS,
|
PathSource::Expr(..) | PathSource::Pat | PathSource::TupleStruct(_) => ValueNS,
|
||||||
PathSource::TraitItem(ns) => ns,
|
PathSource::TraitItem(ns) => ns,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ impl<'a> PathSource<'a> {
|
|||||||
| PathSource::Expr(..)
|
| PathSource::Expr(..)
|
||||||
| PathSource::Pat
|
| PathSource::Pat
|
||||||
| PathSource::Struct
|
| PathSource::Struct
|
||||||
| PathSource::TupleStruct => true,
|
| PathSource::TupleStruct(_) => true,
|
||||||
PathSource::Trait(_) | PathSource::TraitItem(..) => false,
|
PathSource::Trait(_) | PathSource::TraitItem(..) => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ impl<'a> PathSource<'a> {
|
|||||||
PathSource::Trait(_) => "trait",
|
PathSource::Trait(_) => "trait",
|
||||||
PathSource::Pat => "unit struct, unit variant or constant",
|
PathSource::Pat => "unit struct, unit variant or constant",
|
||||||
PathSource::Struct => "struct, variant or union type",
|
PathSource::Struct => "struct, variant or union type",
|
||||||
PathSource::TupleStruct => "tuple struct or tuple variant",
|
PathSource::TupleStruct(_) => "tuple struct or tuple variant",
|
||||||
PathSource::TraitItem(ns) => match ns {
|
PathSource::TraitItem(ns) => match ns {
|
||||||
TypeNS => "associated type",
|
TypeNS => "associated type",
|
||||||
ValueNS => "method or associated constant",
|
ValueNS => "method or associated constant",
|
||||||
@ -301,7 +301,7 @@ impl<'a> PathSource<'a> {
|
|||||||
| Res::SelfCtor(..) => true,
|
| Res::SelfCtor(..) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
},
|
},
|
||||||
PathSource::TupleStruct => match res {
|
PathSource::TupleStruct(_) => match res {
|
||||||
Res::Def(DefKind::Ctor(_, CtorKind::Fn), _) | Res::SelfCtor(..) => true,
|
Res::Def(DefKind::Ctor(_, CtorKind::Fn), _) | Res::SelfCtor(..) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
},
|
},
|
||||||
@ -336,8 +336,8 @@ impl<'a> PathSource<'a> {
|
|||||||
(PathSource::Struct, false) => error_code!(E0422),
|
(PathSource::Struct, false) => error_code!(E0422),
|
||||||
(PathSource::Expr(..), true) => error_code!(E0423),
|
(PathSource::Expr(..), true) => error_code!(E0423),
|
||||||
(PathSource::Expr(..), false) => error_code!(E0425),
|
(PathSource::Expr(..), false) => error_code!(E0425),
|
||||||
(PathSource::Pat | PathSource::TupleStruct, true) => error_code!(E0532),
|
(PathSource::Pat | PathSource::TupleStruct(_), true) => error_code!(E0532),
|
||||||
(PathSource::Pat | PathSource::TupleStruct, false) => error_code!(E0531),
|
(PathSource::Pat | PathSource::TupleStruct(_), false) => error_code!(E0531),
|
||||||
(PathSource::TraitItem(..), true) => error_code!(E0575),
|
(PathSource::TraitItem(..), true) => error_code!(E0575),
|
||||||
(PathSource::TraitItem(..), false) => error_code!(E0576),
|
(PathSource::TraitItem(..), false) => error_code!(E0576),
|
||||||
}
|
}
|
||||||
@ -1483,7 +1483,7 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
|||||||
self.r.record_partial_res(pat.id, PartialRes::new(res));
|
self.r.record_partial_res(pat.id, PartialRes::new(res));
|
||||||
}
|
}
|
||||||
PatKind::TupleStruct(ref path, ..) => {
|
PatKind::TupleStruct(ref path, ..) => {
|
||||||
self.smart_resolve_path(pat.id, None, path, PathSource::TupleStruct);
|
self.smart_resolve_path(pat.id, None, path, PathSource::TupleStruct(pat.span));
|
||||||
}
|
}
|
||||||
PatKind::Path(ref qself, ref path) => {
|
PatKind::Path(ref qself, ref path) => {
|
||||||
self.smart_resolve_path(pat.id, qself.as_ref(), path, PathSource::Pat);
|
self.smart_resolve_path(pat.id, qself.as_ref(), path, PathSource::Pat);
|
||||||
|
@ -482,10 +482,12 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> {
|
|||||||
|
|
||||||
let mut bad_struct_syntax_suggestion = |def_id: DefId| {
|
let mut bad_struct_syntax_suggestion = |def_id: DefId| {
|
||||||
let (followed_by_brace, closing_brace) = self.followed_by_brace(span);
|
let (followed_by_brace, closing_brace) = self.followed_by_brace(span);
|
||||||
let mut suggested = false;
|
|
||||||
match source {
|
match source {
|
||||||
PathSource::Expr(Some(parent)) => {
|
PathSource::Expr(Some(
|
||||||
suggested = path_sep(err, &parent);
|
parent @ Expr { kind: ExprKind::Field(..) | ExprKind::MethodCall(..), .. },
|
||||||
|
)) => {
|
||||||
|
path_sep(err, &parent);
|
||||||
}
|
}
|
||||||
PathSource::Expr(None) if followed_by_brace => {
|
PathSource::Expr(None) if followed_by_brace => {
|
||||||
if let Some(sp) = closing_brace {
|
if let Some(sp) = closing_brace {
|
||||||
@ -507,16 +509,57 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
suggested = true;
|
}
|
||||||
|
PathSource::Expr(
|
||||||
|
None | Some(Expr { kind: ExprKind::Call(..) | ExprKind::Path(..), .. }),
|
||||||
|
)
|
||||||
|
| PathSource::TupleStruct(_)
|
||||||
|
| PathSource::Pat => {
|
||||||
|
let span = match &source {
|
||||||
|
PathSource::Expr(Some(Expr {
|
||||||
|
span, kind: ExprKind::Call(_, _), ..
|
||||||
|
}))
|
||||||
|
| PathSource::TupleStruct(span) => {
|
||||||
|
// We want the main underline to cover the suggested code as well for
|
||||||
|
// cleaner output.
|
||||||
|
err.set_span(*span);
|
||||||
|
*span
|
||||||
|
}
|
||||||
|
_ => span,
|
||||||
|
};
|
||||||
|
if let Some(span) = self.r.opt_span(def_id) {
|
||||||
|
err.span_label(span, &format!("`{}` defined here", path_str));
|
||||||
|
}
|
||||||
|
let (tail, descr, applicability) = match source {
|
||||||
|
PathSource::Pat | PathSource::TupleStruct(_) => {
|
||||||
|
("", "pattern", Applicability::MachineApplicable)
|
||||||
|
}
|
||||||
|
_ => (": val", "literal", Applicability::HasPlaceholders),
|
||||||
|
};
|
||||||
|
let (fields, applicability) = match self.r.field_names.get(&def_id) {
|
||||||
|
Some(fields) => (
|
||||||
|
fields
|
||||||
|
.iter()
|
||||||
|
.map(|f| format!("{}{}", f.node, tail))
|
||||||
|
.collect::<Vec<String>>()
|
||||||
|
.join(", "),
|
||||||
|
applicability,
|
||||||
|
),
|
||||||
|
None => ("/* fields */".to_string(), Applicability::HasPlaceholders),
|
||||||
|
};
|
||||||
|
let pad = match self.r.field_names.get(&def_id) {
|
||||||
|
Some(fields) if fields.is_empty() => "",
|
||||||
|
_ => " ",
|
||||||
|
};
|
||||||
|
err.span_suggestion(
|
||||||
|
span,
|
||||||
|
&format!("use struct {} syntax instead", descr),
|
||||||
|
format!("{} {{{pad}{}{pad}}}", path_str, fields, pad = pad),
|
||||||
|
applicability,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
if !suggested {
|
|
||||||
if let Some(span) = self.r.opt_span(def_id) {
|
|
||||||
err.span_label(span, &format!("`{}` defined here", path_str));
|
|
||||||
}
|
|
||||||
err.span_label(span, format!("did you mean `{} {{ /* fields */ }}`?", path_str));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
match (res, source) {
|
match (res, source) {
|
||||||
@ -548,7 +591,10 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(Res::Def(DefKind::Enum, def_id), PathSource::TupleStruct | PathSource::Expr(..)) => {
|
(
|
||||||
|
Res::Def(DefKind::Enum, def_id),
|
||||||
|
PathSource::TupleStruct(_) | PathSource::Expr(..),
|
||||||
|
) => {
|
||||||
if let Some(variants) = self.collect_enum_variants(def_id) {
|
if let Some(variants) = self.collect_enum_variants(def_id) {
|
||||||
if !variants.is_empty() {
|
if !variants.is_empty() {
|
||||||
let msg = if variants.len() == 1 {
|
let msg = if variants.len() == 1 {
|
||||||
|
@ -6,14 +6,20 @@ LL | struct Empty1 {}
|
|||||||
...
|
...
|
||||||
LL | let e1 = Empty1;
|
LL | let e1 = Empty1;
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
| |
|
|
||||||
| did you mean `Empty1 { /* fields */ }`?
|
|
||||||
| help: a unit struct with a similar name exists: `XEmpty2`
|
|
||||||
|
|
|
|
||||||
::: $DIR/auxiliary/empty-struct.rs:2:1
|
::: $DIR/auxiliary/empty-struct.rs:2:1
|
||||||
|
|
|
|
||||||
LL | pub struct XEmpty2;
|
LL | pub struct XEmpty2;
|
||||||
| ------------------- similarly named unit struct `XEmpty2` defined here
|
| ------------------- similarly named unit struct `XEmpty2` defined here
|
||||||
|
|
|
||||||
|
help: a unit struct with a similar name exists
|
||||||
|
|
|
||||||
|
LL | let e1 = XEmpty2;
|
||||||
|
| ^^^^^^^
|
||||||
|
help: use struct literal syntax instead
|
||||||
|
|
|
||||||
|
LL | let e1 = Empty1 {};
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error[E0423]: expected function, tuple struct or tuple variant, found struct `Empty1`
|
error[E0423]: expected function, tuple struct or tuple variant, found struct `Empty1`
|
||||||
--> $DIR/empty-struct-braces-expr.rs:16:14
|
--> $DIR/empty-struct-braces-expr.rs:16:14
|
||||||
@ -22,15 +28,16 @@ LL | struct Empty1 {}
|
|||||||
| ---------------- `Empty1` defined here
|
| ---------------- `Empty1` defined here
|
||||||
...
|
...
|
||||||
LL | let e1 = Empty1();
|
LL | let e1 = Empty1();
|
||||||
| ^^^^^^
|
| ^^^^^^^^
|
||||||
| |
|
|
||||||
| did you mean `Empty1 { /* fields */ }`?
|
|
||||||
| help: a unit struct with a similar name exists: `XEmpty2`
|
|
||||||
|
|
|
||||||
::: $DIR/auxiliary/empty-struct.rs:2:1
|
|
||||||
|
|
|
|
||||||
LL | pub struct XEmpty2;
|
help: a unit struct with a similar name exists
|
||||||
| ------------------- similarly named unit struct `XEmpty2` defined here
|
|
|
||||||
|
LL | let e1 = XEmpty2();
|
||||||
|
| ^^^^^^^
|
||||||
|
help: use struct literal syntax instead
|
||||||
|
|
|
||||||
|
LL | let e1 = Empty1 {};
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error[E0423]: expected value, found struct variant `E::Empty3`
|
error[E0423]: expected value, found struct variant `E::Empty3`
|
||||||
--> $DIR/empty-struct-braces-expr.rs:18:14
|
--> $DIR/empty-struct-braces-expr.rs:18:14
|
||||||
@ -39,7 +46,7 @@ LL | Empty3 {}
|
|||||||
| --------- `E::Empty3` defined here
|
| --------- `E::Empty3` defined here
|
||||||
...
|
...
|
||||||
LL | let e3 = E::Empty3;
|
LL | let e3 = E::Empty3;
|
||||||
| ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`?
|
| ^^^^^^^^^ help: use struct literal syntax instead: `E::Empty3 {}`
|
||||||
|
|
||||||
error[E0423]: expected function, tuple struct or tuple variant, found struct variant `E::Empty3`
|
error[E0423]: expected function, tuple struct or tuple variant, found struct variant `E::Empty3`
|
||||||
--> $DIR/empty-struct-braces-expr.rs:19:14
|
--> $DIR/empty-struct-braces-expr.rs:19:14
|
||||||
@ -48,35 +55,42 @@ LL | Empty3 {}
|
|||||||
| --------- `E::Empty3` defined here
|
| --------- `E::Empty3` defined here
|
||||||
...
|
...
|
||||||
LL | let e3 = E::Empty3();
|
LL | let e3 = E::Empty3();
|
||||||
| ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`?
|
| ^^^^^^^^^^^ help: use struct literal syntax instead: `E::Empty3 {}`
|
||||||
|
|
||||||
error[E0423]: expected value, found struct `XEmpty1`
|
error[E0423]: expected value, found struct `XEmpty1`
|
||||||
--> $DIR/empty-struct-braces-expr.rs:22:15
|
--> $DIR/empty-struct-braces-expr.rs:22:15
|
||||||
|
|
|
|
||||||
LL | let xe1 = XEmpty1;
|
LL | let xe1 = XEmpty1;
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
| |
|
|
||||||
| did you mean `XEmpty1 { /* fields */ }`?
|
|
||||||
| help: a unit struct with a similar name exists: `XEmpty2`
|
|
||||||
|
|
|
|
||||||
::: $DIR/auxiliary/empty-struct.rs:2:1
|
::: $DIR/auxiliary/empty-struct.rs:2:1
|
||||||
|
|
|
|
||||||
LL | pub struct XEmpty2;
|
LL | pub struct XEmpty2;
|
||||||
| ------------------- similarly named unit struct `XEmpty2` defined here
|
| ------------------- similarly named unit struct `XEmpty2` defined here
|
||||||
|
|
|
||||||
|
help: a unit struct with a similar name exists
|
||||||
|
|
|
||||||
|
LL | let xe1 = XEmpty2;
|
||||||
|
| ^^^^^^^
|
||||||
|
help: use struct literal syntax instead
|
||||||
|
|
|
||||||
|
LL | let xe1 = XEmpty1 {};
|
||||||
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0423]: expected function, tuple struct or tuple variant, found struct `XEmpty1`
|
error[E0423]: expected function, tuple struct or tuple variant, found struct `XEmpty1`
|
||||||
--> $DIR/empty-struct-braces-expr.rs:23:15
|
--> $DIR/empty-struct-braces-expr.rs:23:15
|
||||||
|
|
|
|
||||||
LL | let xe1 = XEmpty1();
|
LL | let xe1 = XEmpty1();
|
||||||
| ^^^^^^^
|
| ^^^^^^^^^
|
||||||
| |
|
|
||||||
| did you mean `XEmpty1 { /* fields */ }`?
|
|
||||||
| help: a unit struct with a similar name exists: `XEmpty2`
|
|
||||||
|
|
|
||||||
::: $DIR/auxiliary/empty-struct.rs:2:1
|
|
||||||
|
|
|
|
||||||
LL | pub struct XEmpty2;
|
help: a unit struct with a similar name exists
|
||||||
| ------------------- similarly named unit struct `XEmpty2` defined here
|
|
|
||||||
|
LL | let xe1 = XEmpty2();
|
||||||
|
| ^^^^^^^
|
||||||
|
help: use struct literal syntax instead
|
||||||
|
|
|
||||||
|
LL | let xe1 = XEmpty1 {};
|
||||||
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope
|
error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope
|
||||||
--> $DIR/empty-struct-braces-expr.rs:25:19
|
--> $DIR/empty-struct-braces-expr.rs:25:19
|
||||||
|
@ -5,21 +5,27 @@ LL | Empty3 {}
|
|||||||
| --------- `E::Empty3` defined here
|
| --------- `E::Empty3` defined here
|
||||||
...
|
...
|
||||||
LL | E::Empty3 => ()
|
LL | E::Empty3 => ()
|
||||||
| ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`?
|
| ^^^^^^^^^ help: use struct pattern syntax instead: `E::Empty3 {}`
|
||||||
|
|
||||||
error[E0532]: expected unit struct, unit variant or constant, found struct variant `XE::XEmpty3`
|
error[E0532]: expected unit struct, unit variant or constant, found struct variant `XE::XEmpty3`
|
||||||
--> $DIR/empty-struct-braces-pat-1.rs:31:9
|
--> $DIR/empty-struct-braces-pat-1.rs:31:9
|
||||||
|
|
|
|
||||||
LL | XE::XEmpty3 => ()
|
LL | XE::XEmpty3 => ()
|
||||||
| ^^^^-------
|
| ^^^^^^^^^^^
|
||||||
| | |
|
|
||||||
| | help: a unit variant with a similar name exists: `XEmpty4`
|
|
||||||
| did you mean `XE::XEmpty3 { /* fields */ }`?
|
|
||||||
|
|
|
|
||||||
::: $DIR/auxiliary/empty-struct.rs:7:5
|
::: $DIR/auxiliary/empty-struct.rs:7:5
|
||||||
|
|
|
|
||||||
LL | XEmpty4,
|
LL | XEmpty4,
|
||||||
| ------- similarly named unit variant `XEmpty4` defined here
|
| ------- similarly named unit variant `XEmpty4` defined here
|
||||||
|
|
|
||||||
|
help: a unit variant with a similar name exists
|
||||||
|
|
|
||||||
|
LL | XE::XEmpty4 => ()
|
||||||
|
| ^^^^^^^
|
||||||
|
help: use struct pattern syntax instead
|
||||||
|
|
|
||||||
|
LL | XE::XEmpty3 { /* fields */ } => ()
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
@ -5,29 +5,31 @@ LL | struct Empty1 {}
|
|||||||
| ---------------- `Empty1` defined here
|
| ---------------- `Empty1` defined here
|
||||||
...
|
...
|
||||||
LL | Empty1() => ()
|
LL | Empty1() => ()
|
||||||
| ^^^^^^
|
| ^^^^^^^^
|
||||||
| |
|
|
||||||
| did you mean `Empty1 { /* fields */ }`?
|
|
||||||
| help: a tuple struct with a similar name exists: `XEmpty6`
|
|
||||||
|
|
|
||||||
::: $DIR/auxiliary/empty-struct.rs:3:1
|
|
||||||
|
|
|
|
||||||
LL | pub struct XEmpty6();
|
help: a tuple struct with a similar name exists
|
||||||
| --------------------- similarly named tuple struct `XEmpty6` defined here
|
|
|
||||||
|
LL | XEmpty6() => ()
|
||||||
|
| ^^^^^^^
|
||||||
|
help: use struct pattern syntax instead
|
||||||
|
|
|
||||||
|
LL | Empty1 {} => ()
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1`
|
error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1`
|
||||||
--> $DIR/empty-struct-braces-pat-2.rs:18:9
|
--> $DIR/empty-struct-braces-pat-2.rs:18:9
|
||||||
|
|
|
|
||||||
LL | XEmpty1() => ()
|
LL | XEmpty1() => ()
|
||||||
| ^^^^^^^
|
| ^^^^^^^^^
|
||||||
| |
|
|
||||||
| did you mean `XEmpty1 { /* fields */ }`?
|
|
||||||
| help: a tuple struct with a similar name exists: `XEmpty6`
|
|
||||||
|
|
|
||||||
::: $DIR/auxiliary/empty-struct.rs:3:1
|
|
||||||
|
|
|
|
||||||
LL | pub struct XEmpty6();
|
help: a tuple struct with a similar name exists
|
||||||
| --------------------- similarly named tuple struct `XEmpty6` defined here
|
|
|
||||||
|
LL | XEmpty6() => ()
|
||||||
|
| ^^^^^^^
|
||||||
|
help: use struct pattern syntax instead
|
||||||
|
|
|
||||||
|
LL | XEmpty1 {} => ()
|
||||||
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error[E0532]: expected tuple struct or tuple variant, found struct `Empty1`
|
error[E0532]: expected tuple struct or tuple variant, found struct `Empty1`
|
||||||
--> $DIR/empty-struct-braces-pat-2.rs:21:9
|
--> $DIR/empty-struct-braces-pat-2.rs:21:9
|
||||||
@ -36,29 +38,31 @@ LL | struct Empty1 {}
|
|||||||
| ---------------- `Empty1` defined here
|
| ---------------- `Empty1` defined here
|
||||||
...
|
...
|
||||||
LL | Empty1(..) => ()
|
LL | Empty1(..) => ()
|
||||||
| ^^^^^^
|
| ^^^^^^^^^^
|
||||||
| |
|
|
||||||
| did you mean `Empty1 { /* fields */ }`?
|
|
||||||
| help: a tuple struct with a similar name exists: `XEmpty6`
|
|
||||||
|
|
|
||||||
::: $DIR/auxiliary/empty-struct.rs:3:1
|
|
||||||
|
|
|
|
||||||
LL | pub struct XEmpty6();
|
help: a tuple struct with a similar name exists
|
||||||
| --------------------- similarly named tuple struct `XEmpty6` defined here
|
|
|
||||||
|
LL | XEmpty6(..) => ()
|
||||||
|
| ^^^^^^^
|
||||||
|
help: use struct pattern syntax instead
|
||||||
|
|
|
||||||
|
LL | Empty1 {} => ()
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1`
|
error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1`
|
||||||
--> $DIR/empty-struct-braces-pat-2.rs:24:9
|
--> $DIR/empty-struct-braces-pat-2.rs:24:9
|
||||||
|
|
|
|
||||||
LL | XEmpty1(..) => ()
|
LL | XEmpty1(..) => ()
|
||||||
| ^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
| |
|
|
||||||
| did you mean `XEmpty1 { /* fields */ }`?
|
|
||||||
| help: a tuple struct with a similar name exists: `XEmpty6`
|
|
||||||
|
|
|
||||||
::: $DIR/auxiliary/empty-struct.rs:3:1
|
|
||||||
|
|
|
|
||||||
LL | pub struct XEmpty6();
|
help: a tuple struct with a similar name exists
|
||||||
| --------------------- similarly named tuple struct `XEmpty6` defined here
|
|
|
||||||
|
LL | XEmpty6(..) => ()
|
||||||
|
| ^^^^^^^
|
||||||
|
help: use struct pattern syntax instead
|
||||||
|
|
|
||||||
|
LL | XEmpty1 {} => ()
|
||||||
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
@ -5,21 +5,22 @@ LL | Empty3 {}
|
|||||||
| --------- `E::Empty3` defined here
|
| --------- `E::Empty3` defined here
|
||||||
...
|
...
|
||||||
LL | E::Empty3() => ()
|
LL | E::Empty3() => ()
|
||||||
| ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`?
|
| ^^^^^^^^^^^ help: use struct pattern syntax instead: `E::Empty3 {}`
|
||||||
|
|
||||||
error[E0532]: expected tuple struct or tuple variant, found struct variant `XE::XEmpty3`
|
error[E0532]: expected tuple struct or tuple variant, found struct variant `XE::XEmpty3`
|
||||||
--> $DIR/empty-struct-braces-pat-3.rs:21:9
|
--> $DIR/empty-struct-braces-pat-3.rs:21:9
|
||||||
|
|
|
|
||||||
LL | XE::XEmpty3() => ()
|
LL | XE::XEmpty3() => ()
|
||||||
| ^^^^-------
|
| ^^^^^^^^^^^^^
|
||||||
| | |
|
|
||||||
| | help: a tuple variant with a similar name exists: `XEmpty5`
|
|
||||||
| did you mean `XE::XEmpty3 { /* fields */ }`?
|
|
||||||
|
|
|
||||||
::: $DIR/auxiliary/empty-struct.rs:8:5
|
|
||||||
|
|
|
|
||||||
LL | XEmpty5(),
|
help: a tuple variant with a similar name exists
|
||||||
| --------- similarly named tuple variant `XEmpty5` defined here
|
|
|
||||||
|
LL | XE::XEmpty5() => ()
|
||||||
|
| ^^^^^^^
|
||||||
|
help: use struct pattern syntax instead
|
||||||
|
|
|
||||||
|
LL | XE::XEmpty3 { /* fields */ } => ()
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0532]: expected tuple struct or tuple variant, found struct variant `E::Empty3`
|
error[E0532]: expected tuple struct or tuple variant, found struct variant `E::Empty3`
|
||||||
--> $DIR/empty-struct-braces-pat-3.rs:25:9
|
--> $DIR/empty-struct-braces-pat-3.rs:25:9
|
||||||
@ -28,21 +29,22 @@ LL | Empty3 {}
|
|||||||
| --------- `E::Empty3` defined here
|
| --------- `E::Empty3` defined here
|
||||||
...
|
...
|
||||||
LL | E::Empty3(..) => ()
|
LL | E::Empty3(..) => ()
|
||||||
| ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`?
|
| ^^^^^^^^^^^^^ help: use struct pattern syntax instead: `E::Empty3 {}`
|
||||||
|
|
||||||
error[E0532]: expected tuple struct or tuple variant, found struct variant `XE::XEmpty3`
|
error[E0532]: expected tuple struct or tuple variant, found struct variant `XE::XEmpty3`
|
||||||
--> $DIR/empty-struct-braces-pat-3.rs:29:9
|
--> $DIR/empty-struct-braces-pat-3.rs:29:9
|
||||||
|
|
|
|
||||||
LL | XE::XEmpty3(..) => ()
|
LL | XE::XEmpty3(..) => ()
|
||||||
| ^^^^-------
|
| ^^^^^^^^^^^^^^^
|
||||||
| | |
|
|
||||||
| | help: a tuple variant with a similar name exists: `XEmpty5`
|
|
||||||
| did you mean `XE::XEmpty3 { /* fields */ }`?
|
|
||||||
|
|
|
||||||
::: $DIR/auxiliary/empty-struct.rs:8:5
|
|
||||||
|
|
|
|
||||||
LL | XEmpty5(),
|
help: a tuple variant with a similar name exists
|
||||||
| --------- similarly named tuple variant `XEmpty5` defined here
|
|
|
||||||
|
LL | XE::XEmpty5(..) => ()
|
||||||
|
| ^^^^^^^
|
||||||
|
help: use struct pattern syntax instead
|
||||||
|
|
|
||||||
|
LL | XE::XEmpty3 { /* fields */ } => ()
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
@ -33,13 +33,16 @@ LL | struct Foo { a: bool };
|
|||||||
| ---------------------- `Foo` defined here
|
| ---------------------- `Foo` defined here
|
||||||
LL |
|
LL |
|
||||||
LL | let f = Foo();
|
LL | let f = Foo();
|
||||||
|
| ^^^^^
|
||||||
|
|
|
||||||
|
help: a function with a similar name exists
|
||||||
|
|
|
||||||
|
LL | let f = foo();
|
||||||
| ^^^
|
| ^^^
|
||||||
| |
|
help: use struct literal syntax instead
|
||||||
| did you mean `Foo { /* fields */ }`?
|
|
|
||||||
| help: a function with a similar name exists (notice the capitalization): `foo`
|
LL | let f = Foo { a: val };
|
||||||
...
|
| ^^^^^^^^^^^^^^
|
||||||
LL | fn foo() {
|
|
||||||
| -------- similarly named function `foo` defined here
|
|
||||||
|
|
||||||
error[E0423]: expected value, found struct `T`
|
error[E0423]: expected value, found struct `T`
|
||||||
--> $DIR/E0423.rs:14:8
|
--> $DIR/E0423.rs:14:8
|
||||||
|
@ -5,7 +5,7 @@ LL | FooB { x: i32, y: i32 }
|
|||||||
| ----------------------- `FooB` defined here
|
| ----------------------- `FooB` defined here
|
||||||
...
|
...
|
||||||
LL | FooB(a, b) => println!("{} {}", a, b),
|
LL | FooB(a, b) => println!("{} {}", a, b),
|
||||||
| ^^^^ did you mean `FooB { /* fields */ }`?
|
| ^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x, y }`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ error[E0423]: expected value, found struct `Vec`
|
|||||||
--> $DIR/issue-34334.rs:2:13
|
--> $DIR/issue-34334.rs:2:13
|
||||||
|
|
|
|
||||||
LL | let sr: Vec<(u32, _, _) = vec![];
|
LL | let sr: Vec<(u32, _, _) = vec![];
|
||||||
| ^^^ did you mean `Vec { /* fields */ }`?
|
| ^^^ help: use struct literal syntax instead: `Vec { buf: val, len: val }`
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/issue-34334.rs:2:31
|
--> $DIR/issue-34334.rs:2:31
|
||||||
|
@ -14,7 +14,7 @@ LL | Struct{ s: i32 },
|
|||||||
| ---------------- `MyEnum::Struct` defined here
|
| ---------------- `MyEnum::Struct` defined here
|
||||||
...
|
...
|
||||||
LL | MyEnum::Struct => "",
|
LL | MyEnum::Struct => "",
|
||||||
| ^^^^^^^^^^^^^^ did you mean `MyEnum::Struct { /* fields */ }`?
|
| ^^^^^^^^^^^^^^ help: use struct pattern syntax instead: `MyEnum::Struct { s }`
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
@ -5,11 +5,16 @@ LL | struct X {}
|
|||||||
| ----------- `X` defined here
|
| ----------- `X` defined here
|
||||||
LL |
|
LL |
|
||||||
LL | const Y: X = X("ö");
|
LL | const Y: X = X("ö");
|
||||||
| -------------^------
|
| ^^^^^^
|
||||||
| | |
|
|
|
||||||
| | did you mean `X { /* fields */ }`?
|
help: a constant with a similar name exists
|
||||||
| | help: a constant with a similar name exists: `Y`
|
|
|
||||||
| similarly named constant `Y` defined here
|
LL | const Y: X = Y("ö");
|
||||||
|
| ^
|
||||||
|
help: use struct literal syntax instead
|
||||||
|
|
|
||||||
|
LL | const Y: X = X {};
|
||||||
|
| ^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -51,12 +51,16 @@ LL | TV(),
|
|||||||
| ---- similarly named tuple variant `TV` defined here
|
| ---- similarly named tuple variant `TV` defined here
|
||||||
...
|
...
|
||||||
LL | check(m7::V);
|
LL | check(m7::V);
|
||||||
| ^^^^^ did you mean `m7::V { /* fields */ }`?
|
| ^^^^^
|
||||||
|
|
|
|
||||||
help: a tuple variant with a similar name exists
|
help: a tuple variant with a similar name exists
|
||||||
|
|
|
|
||||||
LL | check(m7::TV);
|
LL | check(m7::TV);
|
||||||
| ^^
|
| ^^
|
||||||
|
help: use struct literal syntax instead
|
||||||
|
|
|
||||||
|
LL | check(m7::V {});
|
||||||
|
| ^^^^^^^^
|
||||||
help: consider importing one of these items instead
|
help: consider importing one of these items instead
|
||||||
|
|
|
|
||||||
LL | use m8::V;
|
LL | use m8::V;
|
||||||
@ -68,7 +72,7 @@ error[E0423]: expected value, found struct variant `xm7::V`
|
|||||||
--> $DIR/namespace-mix.rs:106:11
|
--> $DIR/namespace-mix.rs:106:11
|
||||||
|
|
|
|
||||||
LL | check(xm7::V);
|
LL | check(xm7::V);
|
||||||
| ^^^^^^ did you mean `xm7::V { /* fields */ }`?
|
| ^^^^^^
|
||||||
|
|
|
|
||||||
::: $DIR/auxiliary/namespace-mix.rs:7:9
|
::: $DIR/auxiliary/namespace-mix.rs:7:9
|
||||||
|
|
|
|
||||||
@ -79,6 +83,10 @@ help: a tuple variant with a similar name exists
|
|||||||
|
|
|
|
||||||
LL | check(xm7::TV);
|
LL | check(xm7::TV);
|
||||||
| ^^
|
| ^^
|
||||||
|
help: use struct literal syntax instead
|
||||||
|
|
|
||||||
|
LL | check(xm7::V { /* fields */ });
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
help: consider importing one of these items instead
|
help: consider importing one of these items instead
|
||||||
|
|
|
|
||||||
LL | use m8::V;
|
LL | use m8::V;
|
||||||
|
@ -16,7 +16,7 @@ LL | Foo { a: usize, b: usize },
|
|||||||
| -------------------------- `Enum::Foo` defined here
|
| -------------------------- `Enum::Foo` defined here
|
||||||
...
|
...
|
||||||
LL | Enum::Foo(a, b) => {}
|
LL | Enum::Foo(a, b) => {}
|
||||||
| ^^^^^^^^^ did you mean `Enum::Foo { /* fields */ }`?
|
| ^^^^^^^^^^^^^^^ help: use struct pattern syntax instead: `Enum::Foo { a, b }`
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ LL | Variant { x: usize }
|
|||||||
| -------------------- `Foo::Variant` defined here
|
| -------------------- `Foo::Variant` defined here
|
||||||
...
|
...
|
||||||
LL | let f = Foo::Variant(42);
|
LL | let f = Foo::Variant(42);
|
||||||
| ^^^^^^^^^^^^ did you mean `Foo::Variant { /* fields */ }`?
|
| ^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `Foo::Variant { x: val }`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -5,13 +5,13 @@ LL | Madoka { age: u32 }
|
|||||||
| ------------------- `Homura::Madoka` defined here
|
| ------------------- `Homura::Madoka` defined here
|
||||||
...
|
...
|
||||||
LL | let homura = Homura::Madoka;
|
LL | let homura = Homura::Madoka;
|
||||||
| ^^^^^^^^^^^^^^ did you mean `Homura::Madoka { /* fields */ }`?
|
| ^^^^^^^^^^^^^^ help: use struct literal syntax instead: `Homura::Madoka { age: val }`
|
||||||
|
|
||||||
error[E0423]: expected value, found struct variant `issue_19452_aux::Homura::Madoka`
|
error[E0423]: expected value, found struct variant `issue_19452_aux::Homura::Madoka`
|
||||||
--> $DIR/issue-19452.rs:13:18
|
--> $DIR/issue-19452.rs:13:18
|
||||||
|
|
|
|
||||||
LL | let homura = issue_19452_aux::Homura::Madoka;
|
LL | let homura = issue_19452_aux::Homura::Madoka;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `issue_19452_aux::Homura::Madoka { /* fields */ }`?
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `issue_19452_aux::Homura::Madoka { /* fields */ }`
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
@ -6,9 +6,15 @@ LL | struct Handle {}
|
|||||||
...
|
...
|
||||||
LL | handle: Handle
|
LL | handle: Handle
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
| |
|
|
|
||||||
| did you mean `Handle { /* fields */ }`?
|
help: a local variable with a similar name exists
|
||||||
| help: a local variable with a similar name exists: `handle`
|
|
|
||||||
|
LL | handle: handle
|
||||||
|
| ^^^^^^
|
||||||
|
help: use struct literal syntax instead
|
||||||
|
|
|
||||||
|
LL | handle: Handle {}
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ LL | | }
|
|||||||
| |_- `Monster` defined here
|
| |_- `Monster` defined here
|
||||||
...
|
...
|
||||||
LL | let _m = Monster();
|
LL | let _m = Monster();
|
||||||
| ^^^^^^^ did you mean `Monster { /* fields */ }`?
|
| ^^^^^^^^^ help: use struct literal syntax instead: `Monster { damage: val }`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ LL | | },
|
|||||||
| |_____________- `Z::Struct` defined here
|
| |_____________- `Z::Struct` defined here
|
||||||
...
|
...
|
||||||
LL | let _: Z = Z::Struct;
|
LL | let _: Z = Z::Struct;
|
||||||
| ^^^^^^^^^ did you mean `Z::Struct { /* fields */ }`?
|
| ^^^^^^^^^ help: use struct literal syntax instead: `Z::Struct { s: val }`
|
||||||
|
|
||||||
error[E0423]: expected value, found enum `m::E`
|
error[E0423]: expected value, found enum `m::E`
|
||||||
--> $DIR/privacy-enum-ctor.rs:41:16
|
--> $DIR/privacy-enum-ctor.rs:41:16
|
||||||
@ -83,7 +83,7 @@ LL | | },
|
|||||||
| |_________- `m::E::Struct` defined here
|
| |_________- `m::E::Struct` defined here
|
||||||
...
|
...
|
||||||
LL | let _: E = m::E::Struct;
|
LL | let _: E = m::E::Struct;
|
||||||
| ^^^^^^^^^^^^ did you mean `m::E::Struct { /* fields */ }`?
|
| ^^^^^^^^^^^^ help: use struct literal syntax instead: `m::E::Struct { s: val }`
|
||||||
|
|
||||||
error[E0423]: expected value, found enum `E`
|
error[E0423]: expected value, found enum `E`
|
||||||
--> $DIR/privacy-enum-ctor.rs:49:16
|
--> $DIR/privacy-enum-ctor.rs:49:16
|
||||||
@ -115,7 +115,7 @@ LL | | },
|
|||||||
| |_________- `E::Struct` defined here
|
| |_________- `E::Struct` defined here
|
||||||
...
|
...
|
||||||
LL | let _: E = E::Struct;
|
LL | let _: E = E::Struct;
|
||||||
| ^^^^^^^^^ did you mean `E::Struct { /* fields */ }`?
|
| ^^^^^^^^^ help: use struct literal syntax instead: `E::Struct { s: val }`
|
||||||
|
|
||||||
error[E0412]: cannot find type `Z` in this scope
|
error[E0412]: cannot find type `Z` in this scope
|
||||||
--> $DIR/privacy-enum-ctor.rs:57:12
|
--> $DIR/privacy-enum-ctor.rs:57:12
|
||||||
@ -195,7 +195,7 @@ LL | | },
|
|||||||
| |_____________- `m::n::Z::Struct` defined here
|
| |_____________- `m::n::Z::Struct` defined here
|
||||||
...
|
...
|
||||||
LL | let _: Z = m::n::Z::Struct;
|
LL | let _: Z = m::n::Z::Struct;
|
||||||
| ^^^^^^^^^^^^^^^ did you mean `m::n::Z::Struct { /* fields */ }`?
|
| ^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `m::n::Z::Struct { s: val }`
|
||||||
|
|
||||||
error[E0412]: cannot find type `Z` in this scope
|
error[E0412]: cannot find type `Z` in this scope
|
||||||
--> $DIR/privacy-enum-ctor.rs:68:12
|
--> $DIR/privacy-enum-ctor.rs:68:12
|
||||||
|
@ -25,7 +25,7 @@ LL | | }
|
|||||||
| |_____- `S2` defined here
|
| |_____- `S2` defined here
|
||||||
...
|
...
|
||||||
LL | S2;
|
LL | S2;
|
||||||
| ^^ did you mean `S2 { /* fields */ }`?
|
| ^^ help: use struct literal syntax instead: `S2 { s: val }`
|
||||||
|
|
||||||
error[E0423]: expected value, found struct `xcrate::S`
|
error[E0423]: expected value, found struct `xcrate::S`
|
||||||
--> $DIR/privacy-struct-ctor.rs:43:5
|
--> $DIR/privacy-struct-ctor.rs:43:5
|
||||||
|
@ -7,10 +7,16 @@ LL | B { a: usize },
|
|||||||
| -------------- `E::B` defined here
|
| -------------- `E::B` defined here
|
||||||
...
|
...
|
||||||
LL | let _: E = E::B;
|
LL | let _: E = E::B;
|
||||||
| ^^^-
|
| ^^^^
|
||||||
| | |
|
|
|
||||||
| | help: a tuple variant with a similar name exists: `A`
|
help: a tuple variant with a similar name exists
|
||||||
| did you mean `E::B { /* fields */ }`?
|
|
|
||||||
|
LL | let _: E = E::A;
|
||||||
|
| ^
|
||||||
|
help: use struct literal syntax instead
|
||||||
|
|
|
||||||
|
LL | let _: E = E::B { a: val };
|
||||||
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/fn-or-tuple-struct-without-args.rs:29:20
|
--> $DIR/fn-or-tuple-struct-without-args.rs:29:20
|
||||||
|
@ -5,7 +5,7 @@ LL | struct X {}
|
|||||||
| ----------- `X` defined here
|
| ----------- `X` defined here
|
||||||
LL | fn main() {
|
LL | fn main() {
|
||||||
LL | vec![X]; //…
|
LL | vec![X]; //…
|
||||||
| ^ did you mean `X { /* fields */ }`?
|
| ^ help: use struct literal syntax instead: `X {}`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ error[E0423]: expected value, found struct `xcrate_unit_struct::StructWithFields
|
|||||||
--> $DIR/xcrate-unit-struct.rs:9:13
|
--> $DIR/xcrate-unit-struct.rs:9:13
|
||||||
|
|
|
|
||||||
LL | let _ = xcrate_unit_struct::StructWithFields;
|
LL | let _ = xcrate_unit_struct::StructWithFields;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `xcrate_unit_struct::StructWithFields { /* fields */ }`?
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `xcrate_unit_struct::StructWithFields { foo: val }`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user