Improve some codes according to the reviews

- improve diagnostics of field uniqueness check and representation check
- simplify the implementation of field uniqueness check
- remove some useless codes and improvement neatness
This commit is contained in:
Frank King 2024-01-29 15:08:11 +08:00
parent 2b04ca94bb
commit 0dbd6e9572
9 changed files with 658 additions and 124 deletions

View File

@ -136,6 +136,9 @@ hir_analysis_field_already_declared_current_nested =
.nested_field_decl_note = field `{$field_name}` declared here
.previous_decl_label = `{$field_name}` first declared here
hir_analysis_field_already_declared_nested_help =
fields from the type of this unnamed field are considered fields of the outer type
hir_analysis_field_already_declared_previous_nested =
field `{$field_name}` is already declared
.label = field already declared
@ -445,10 +448,12 @@ hir_analysis_unnamed_fields_repr_field_missing_repr_c =
named type of unnamed field must have `#[repr(C)]` representation
.label = unnamed field defined here
.field_ty_label = `{$field_ty}` defined here
.suggestion = add `#[repr(C)]` to this {$field_adt_kind}
hir_analysis_unnamed_fields_repr_missing_repr_c =
{$adt_kind} with unnamed fields must have `#[repr(C)]` representation
.label = {$adt_kind} `{$adt_name}` defined here
.suggestion = add `#[repr(C)]` to this {$adt_kind}
hir_analysis_unrecognized_atomic_operation =
unrecognized atomic operation function: `{$op}`

View File

@ -122,6 +122,7 @@ fn check_unnamed_fields(tcx: TyCtxt<'_>, def: ty::AdtDef<'_>) {
adt_kind,
adt_name,
unnamed_fields,
sugg_span: span.shrink_to_lo(),
});
}
}
@ -131,10 +132,13 @@ fn check_unnamed_fields(tcx: TyCtxt<'_>, def: ty::AdtDef<'_>) {
&& !adt.is_anonymous()
&& !adt.repr().c()
{
let field_ty_span = tcx.def_span(adt.did());
tcx.dcx().emit_err(errors::UnnamedFieldsRepr::FieldMissingReprC {
span: tcx.def_span(field.did),
field_ty_span: tcx.def_span(adt.did()),
field_ty_span,
field_ty,
field_adt_kind: adt.descr(),
sugg_span: field_ty_span.shrink_to_lo(),
});
}
}

View File

@ -791,12 +791,30 @@ fn convert_enum_variant_types(tcx: TyCtxt<'_>, def_id: DefId) {
}
}
fn find_field(tcx: TyCtxt<'_>, (def_id, ident): (DefId, Ident)) -> Option<FieldIdx> {
tcx.adt_def(def_id).non_enum_variant().fields.iter_enumerated().find_map(|(idx, field)| {
if field.is_unnamed() {
let field_ty = tcx.type_of(field.did).instantiate_identity();
let adt_def = field_ty.ty_adt_def().expect("expect Adt for unnamed field");
tcx.find_field((adt_def.did(), ident)).map(|_| idx)
} else {
(field.ident(tcx).normalize_to_macros_2_0() == ident).then_some(idx)
}
})
}
#[derive(Clone, Copy)]
struct NestedSpan {
span: Span,
nested_field_span: Span,
}
impl NestedSpan {
fn to_field_already_declared_nested_help(&self) -> errors::FieldAlreadyDeclaredNestedHelp {
errors::FieldAlreadyDeclaredNestedHelp { span: self.span }
}
}
#[derive(Clone, Copy)]
enum FieldDeclSpan {
NotNested(Span),
@ -815,87 +833,131 @@ impl From<NestedSpan> for FieldDeclSpan {
}
}
/// Check the uniqueness of fields across adt where there are
/// nested fields imported from an unnamed field.
fn check_field_uniqueness_in_nested_adt(
tcx: TyCtxt<'_>,
adt_def: ty::AdtDef<'_>,
check: &mut impl FnMut(Ident, /* nested_field_span */ Span),
) {
for field in adt_def.all_fields() {
if field.is_unnamed() {
// Here we don't care about the generic parameters, so `instantiate_identity` is enough.
match tcx.type_of(field.did).instantiate_identity().kind() {
ty::Adt(adt_def, _) => {
check_field_uniqueness_in_nested_adt(tcx, *adt_def, &mut *check);
}
ty_kind => bug!(
"Unexpected ty kind in check_field_uniqueness_in_nested_adt(): {ty_kind:?}"
),
}
} else {
check(field.ident(tcx), tcx.def_span(field.did));
}
}
struct FieldUniquenessCheckContext<'tcx> {
tcx: TyCtxt<'tcx>,
seen_fields: FxHashMap<Ident, FieldDeclSpan>,
}
/// Check the uniqueness of fields in a struct variant, and recursively
/// check the nested fields if it is an unnamed field with type of an
/// annoymous adt.
fn check_field_uniqueness(
tcx: TyCtxt<'_>,
field: &hir::FieldDef<'_>,
check: &mut impl FnMut(Ident, FieldDeclSpan),
) {
if field.ident.name == kw::Underscore {
let ty_span = field.ty.span;
impl<'tcx> FieldUniquenessCheckContext<'tcx> {
fn new(tcx: TyCtxt<'tcx>) -> Self {
Self { tcx, seen_fields: FxHashMap::default() }
}
/// Check if a given field `ident` declared at `field_decl` has been declared elsewhere before.
fn check_field_decl(&mut self, ident: Ident, field_decl: FieldDeclSpan) {
use FieldDeclSpan::*;
let field_name = ident.name;
let ident = ident.normalize_to_macros_2_0();
match (field_decl, self.seen_fields.get(&ident).copied()) {
(NotNested(span), Some(NotNested(prev_span))) => {
self.tcx.dcx().emit_err(errors::FieldAlreadyDeclared::NotNested {
field_name,
span,
prev_span,
});
}
(NotNested(span), Some(Nested(prev))) => {
self.tcx.dcx().emit_err(errors::FieldAlreadyDeclared::PreviousNested {
field_name,
span,
prev_span: prev.span,
prev_nested_field_span: prev.nested_field_span,
prev_help: prev.to_field_already_declared_nested_help(),
});
}
(
Nested(current @ NestedSpan { span, nested_field_span, .. }),
Some(NotNested(prev_span)),
) => {
self.tcx.dcx().emit_err(errors::FieldAlreadyDeclared::CurrentNested {
field_name,
span,
nested_field_span,
help: current.to_field_already_declared_nested_help(),
prev_span,
});
}
(Nested(current @ NestedSpan { span, nested_field_span }), Some(Nested(prev))) => {
self.tcx.dcx().emit_err(errors::FieldAlreadyDeclared::BothNested {
field_name,
span,
nested_field_span,
help: current.to_field_already_declared_nested_help(),
prev_span: prev.span,
prev_nested_field_span: prev.nested_field_span,
prev_help: prev.to_field_already_declared_nested_help(),
});
}
(field_decl, None) => {
self.seen_fields.insert(ident, field_decl);
}
}
}
/// Check the uniqueness of fields across adt where there are
/// nested fields imported from an unnamed field.
fn check_field_in_nested_adt(&mut self, adt_def: ty::AdtDef<'_>, unnamed_field_span: Span) {
for field in adt_def.all_fields() {
if field.is_unnamed() {
// Here we don't care about the generic parameters, so `instantiate_identity` is enough.
match self.tcx.type_of(field.did).instantiate_identity().kind() {
ty::Adt(adt_def, _) => {
self.check_field_in_nested_adt(*adt_def, unnamed_field_span);
}
ty_kind => span_bug!(
self.tcx.def_span(field.did),
"Unexpected TyKind in FieldUniquenessCheckContext::check_field_in_nested_adt(): {ty_kind:?}"
),
}
} else {
self.check_field_decl(
field.ident(self.tcx),
NestedSpan {
span: unnamed_field_span,
nested_field_span: self.tcx.def_span(field.did),
}
.into(),
);
}
}
}
/// Check the uniqueness of fields in a struct variant, and recursively
/// check the nested fields if it is an unnamed field with type of an
/// annoymous adt.
fn check_field(&mut self, field: &hir::FieldDef<'_>) {
if field.ident.name != kw::Underscore {
self.check_field_decl(field.ident, field.span.into());
return;
}
match &field.ty.kind {
hir::TyKind::AnonAdt(item_id) => {
match &tcx.hir_node(item_id.hir_id()).expect_item().kind {
match &self.tcx.hir_node(item_id.hir_id()).expect_item().kind {
hir::ItemKind::Struct(variant_data, ..)
| hir::ItemKind::Union(variant_data, ..) => {
variant_data
.fields()
.iter()
.for_each(|f| check_field_uniqueness(tcx, f, &mut *check));
variant_data.fields().iter().for_each(|f| self.check_field(f));
}
item_kind => span_bug!(
ty_span,
"Unexpected item kind in check_field_uniqueness(): {item_kind:?}"
field.ty.span,
"Unexpected ItemKind in FieldUniquenessCheckContext::check_field(): {item_kind:?}"
),
}
}
hir::TyKind::Path(hir::QPath::Resolved(_, hir::Path { res, .. })) => {
check_field_uniqueness_in_nested_adt(
tcx,
tcx.adt_def(res.def_id()),
&mut |ident, nested_field_span| {
check(ident, NestedSpan { span: field.span, nested_field_span }.into())
},
);
self.check_field_in_nested_adt(self.tcx.adt_def(res.def_id()), field.span);
}
// Abort due to errors (there must be an error if an unnamed field
// has any type kind other than an anonymous adt or a named adt)
_ => {
debug_assert!(tcx.dcx().has_errors().is_some());
tcx.dcx().abort_if_errors()
ty_kind => {
self.tcx.dcx().span_delayed_bug(
field.ty.span,
format!("Unexpected TyKind in FieldUniquenessCheckContext::check_field(): {ty_kind:?}"),
);
// FIXME: errors during AST validation should abort the compilation before reaching here.
self.tcx.dcx().abort_if_errors();
}
}
return;
}
check(field.ident, field.span.into());
}
fn find_field(tcx: TyCtxt<'_>, (def_id, ident): (DefId, Ident)) -> Option<FieldIdx> {
tcx.adt_def(def_id).non_enum_variant().fields.iter_enumerated().find_map(|(idx, field)| {
if field.is_unnamed() {
let field_ty = tcx.type_of(field.did).instantiate_identity();
let adt_def = field_ty.ty_adt_def().expect("expect Adt for unnamed field");
tcx.find_field((adt_def.did(), ident)).map(|_| idx)
} else {
(field.ident(tcx).normalize_to_macros_2_0() == ident).then_some(idx)
}
})
}
fn convert_variant(
@ -909,58 +971,16 @@ fn convert_variant(
is_anonymous: bool,
) -> ty::VariantDef {
let mut has_unnamed_fields = false;
let mut seen_fields: FxHashMap<Ident, FieldDeclSpan> = Default::default();
let mut field_uniqueness_check_ctx = FieldUniquenessCheckContext::new(tcx);
let fields = def
.fields()
.iter()
.inspect(|f| {
has_unnamed_fields |= f.ident.name == kw::Underscore;
// We only check named ADT here because anonymous ADTs are checked inside
// the nammed ADT in which they are defined.
if !is_anonymous {
check_field_uniqueness(tcx, f, &mut |ident, field_decl| {
use FieldDeclSpan::*;
let field_name = ident.name;
let ident = ident.normalize_to_macros_2_0();
match (field_decl, seen_fields.get(&ident).copied()) {
(NotNested(span), Some(NotNested(prev_span))) => {
tcx.dcx().emit_err(errors::FieldAlreadyDeclared::NotNested {
field_name,
span,
prev_span,
});
}
(NotNested(span), Some(Nested(prev))) => {
tcx.dcx().emit_err(errors::FieldAlreadyDeclared::PreviousNested {
field_name,
span,
prev_span: prev.span,
prev_nested_field_span: prev.nested_field_span,
});
}
(
Nested(NestedSpan { span, nested_field_span }),
Some(NotNested(prev_span)),
) => {
tcx.dcx().emit_err(errors::FieldAlreadyDeclared::CurrentNested {
field_name,
span,
nested_field_span,
prev_span,
});
}
(Nested(NestedSpan { span, nested_field_span }), Some(Nested(prev))) => {
tcx.dcx().emit_err(errors::FieldAlreadyDeclared::BothNested {
field_name,
span,
nested_field_span,
prev_span: prev.span,
prev_nested_field_span: prev.nested_field_span,
});
}
(field_decl, None) => {
seen_fields.insert(ident, field_decl);
}
}
});
field_uniqueness_check_ctx.check_field(f);
}
})
.map(|f| ty::FieldDef {

View File

@ -193,6 +193,8 @@ pub enum FieldAlreadyDeclared {
span: Span,
#[note(hir_analysis_nested_field_decl_note)]
nested_field_span: Span,
#[subdiagnostic]
help: FieldAlreadyDeclaredNestedHelp,
#[label(hir_analysis_previous_decl_label)]
prev_span: Span,
},
@ -206,6 +208,8 @@ pub enum FieldAlreadyDeclared {
prev_span: Span,
#[note(hir_analysis_previous_nested_field_decl_note)]
prev_nested_field_span: Span,
#[subdiagnostic]
prev_help: FieldAlreadyDeclaredNestedHelp,
},
#[diag(hir_analysis_field_already_declared_both_nested)]
BothNested {
@ -215,13 +219,24 @@ pub enum FieldAlreadyDeclared {
span: Span,
#[note(hir_analysis_nested_field_decl_note)]
nested_field_span: Span,
#[subdiagnostic]
help: FieldAlreadyDeclaredNestedHelp,
#[label(hir_analysis_previous_decl_label)]
prev_span: Span,
#[note(hir_analysis_previous_nested_field_decl_note)]
prev_nested_field_span: Span,
#[subdiagnostic]
prev_help: FieldAlreadyDeclaredNestedHelp,
},
}
#[derive(Subdiagnostic)]
#[help(hir_analysis_field_already_declared_nested_help)]
pub struct FieldAlreadyDeclaredNestedHelp {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(hir_analysis_copy_impl_on_type_with_dtor, code = E0184)]
pub struct CopyImplOnTypeWithDtor {
@ -1583,6 +1598,8 @@ pub enum UnnamedFieldsRepr<'a> {
adt_name: Symbol,
#[subdiagnostic]
unnamed_fields: Vec<UnnamedFieldsReprFieldDefined>,
#[suggestion(code = "#[repr(C)]\n")]
sugg_span: Span,
},
#[diag(hir_analysis_unnamed_fields_repr_field_missing_repr_c)]
FieldMissingReprC {
@ -1592,6 +1609,9 @@ pub enum UnnamedFieldsRepr<'a> {
#[label(hir_analysis_field_ty_label)]
field_ty_span: Span,
field_ty: Ty<'a>,
field_adt_kind: &'static str,
#[suggestion(code = "#[repr(C)]\n")]
sugg_span: Span,
},
}

View File

@ -628,7 +628,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
}
}
fn build_reduced_graph_for_fields(
fn build_reduced_graph_for_struct_variant(
&mut self,
fields: &[ast::FieldDef],
ident: Ident,
@ -657,14 +657,14 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
let def_id = local_def_id.to_def_id();
let def_kind = self.r.tcx.def_kind(local_def_id);
let res = Res::Def(def_kind, def_id);
self.build_reduced_graph_for_fields(
self.build_reduced_graph_for_struct_variant(
&nested_fields,
Ident::empty(),
local_def_id,
res,
// Anonymous adts inherit visibility from their parent adts.
adt_vis,
field.span,
field.ty.span,
);
}
_ => {}
@ -759,7 +759,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
// These items live in both the type and value namespaces.
ItemKind::Struct(ref vdata, _) => {
self.build_reduced_graph_for_fields(
self.build_reduced_graph_for_struct_variant(
vdata.fields(),
ident,
local_def_id,
@ -809,7 +809,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
}
ItemKind::Union(ref vdata, _) => {
self.build_reduced_graph_for_fields(
self.build_reduced_graph_for_struct_variant(
vdata.fields(),
ident,
local_def_id,

View File

@ -181,11 +181,6 @@ pub(in crate::solve) fn instantiate_constituent_tys_for_copy_clone_trait<'tcx>(
| ty::Ref(_, _, Mutability::Not)
| ty::Array(..) => Err(NoSolution),
// Check for anonymous adts.
ty::Adt(adt, generics) if adt.is_anonymous() => {
Ok(adt.non_enum_variant().fields.iter().map(|f| f.ty(ecx.tcx(), generics)).collect())
}
ty::Dynamic(..)
| ty::Str
| ty::Slice(_)

View File

@ -1511,10 +1511,6 @@ pub(crate) enum Type {
/// An `impl Trait`: `impl TraitA + TraitB + ...`
ImplTrait(Vec<GenericBound>),
// /// An anonymous struct type i.e. `struct { foo: Type }`
// AnonStruct(VariantStruct),
// /// An anonymous union type i.e. `union { bar: Type }`
// AnonUnion(VariantStruct),
}
impl Type {

View File

@ -48,6 +48,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:40:5
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:41:5
@ -63,6 +68,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:41:5
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:44:9
@ -78,6 +88,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:44:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:45:9
@ -93,6 +108,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:45:9
|
LL | _: Bar,
| ^^^^^^
error[E0124]: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:58:9
@ -135,6 +155,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:70:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:71:9
@ -150,6 +175,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:71:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:74:13
@ -165,6 +195,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:74:13
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:75:13
@ -180,6 +215,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:75:13
|
LL | _: Bar,
| ^^^^^^
error[E0124]: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:80:5
@ -222,6 +262,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:92:5
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:93:5
@ -237,6 +282,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:93:5
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:96:9
@ -252,6 +302,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:96:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:97:9
@ -267,6 +322,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:97:9
|
LL | _: Bar,
| ^^^^^^
error[E0124]: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:111:13
@ -309,6 +369,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:123:13
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:124:13
@ -324,6 +389,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:124:13
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:127:17
@ -339,6 +409,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:127:17
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:128:17
@ -354,6 +429,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:128:17
|
LL | _: Bar,
| ^^^^^^
error[E0124]: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:133:9
@ -396,6 +476,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:145:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:146:9
@ -411,6 +496,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:146:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:149:13
@ -426,6 +516,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:149:13
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:150:13
@ -441,6 +536,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:150:13
|
LL | _: Bar,
| ^^^^^^
error[E0124]: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:154:5
@ -483,6 +583,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:166:5
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:167:5
@ -498,6 +603,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:167:5
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:170:9
@ -513,6 +623,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:170:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:171:9
@ -528,6 +643,11 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:171:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:183:5
@ -543,6 +663,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:180:5
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:186:9
@ -558,6 +683,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:180:5
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:191:13
@ -573,6 +703,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:180:5
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:195:5
@ -588,11 +723,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:195:5
|
LL | _: Foo,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:7:5
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:180:5
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:196:5
@ -608,11 +753,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:196:5
|
LL | _: Bar,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:7:5
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:180:5
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:199:9
@ -628,11 +783,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:199:9
|
LL | _: Foo,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:7:5
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:180:5
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:200:9
@ -648,11 +813,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:200:9
|
LL | _: Bar,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:7:5
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:180:5
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:212:5
@ -668,6 +843,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:209:5
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:215:9
@ -683,6 +863,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:209:5
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:220:13
@ -698,6 +883,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:209:5
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:224:5
@ -713,11 +903,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:224:5
|
LL | _: Foo,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:14:9
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:209:5
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:225:5
@ -733,11 +933,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:225:5
|
LL | _: Bar,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:14:9
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:209:5
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:228:9
@ -753,11 +963,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:228:9
|
LL | _: Foo,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:14:9
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:209:5
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:229:9
@ -773,11 +993,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:229:9
|
LL | _: Bar,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:14:9
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:209:5
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:242:9
@ -793,6 +1023,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:239:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:245:13
@ -808,6 +1043,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:239:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:250:17
@ -823,6 +1063,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:239:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:254:9
@ -838,11 +1083,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:254:9
|
LL | _: Foo,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:7:5
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:239:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:255:9
@ -858,11 +1113,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:255:9
|
LL | _: Bar,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:7:5
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:239:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:258:13
@ -878,11 +1143,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:258:13
|
LL | _: Foo,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:7:5
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:239:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:259:13
@ -898,11 +1173,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:259:13
|
LL | _: Bar,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:7:5
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:239:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:264:5
@ -918,6 +1203,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:239:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:267:9
@ -933,6 +1223,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:239:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:272:13
@ -948,6 +1243,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:239:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:276:5
@ -963,11 +1263,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:276:5
|
LL | _: Foo,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:7:5
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:239:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:277:5
@ -983,11 +1293,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:277:5
|
LL | _: Bar,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:7:5
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:239:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:280:9
@ -1003,11 +1323,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:280:9
|
LL | _: Foo,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:7:5
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:239:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:281:9
@ -1023,11 +1353,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:281:9
|
LL | _: Bar,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:7:5
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:239:9
|
LL | _: Foo,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:294:9
@ -1043,6 +1383,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:291:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:297:13
@ -1058,6 +1403,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:291:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:302:17
@ -1073,6 +1423,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:291:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:306:9
@ -1088,11 +1443,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:306:9
|
LL | _: Foo,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:14:9
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:291:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:307:9
@ -1108,11 +1473,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:307:9
|
LL | _: Bar,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:14:9
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:291:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:310:13
@ -1128,11 +1503,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:310:13
|
LL | _: Foo,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:14:9
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:291:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:311:13
@ -1148,11 +1533,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:311:13
|
LL | _: Bar,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:14:9
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:291:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:316:5
@ -1168,6 +1563,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:291:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:319:9
@ -1183,6 +1583,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:291:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:324:13
@ -1198,6 +1603,11 @@ note: field `a` first declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:291:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:328:5
@ -1213,11 +1623,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:328:5
|
LL | _: Foo,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:14:9
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:291:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:329:5
@ -1233,11 +1653,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:329:5
|
LL | _: Bar,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:14:9
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:291:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:332:9
@ -1253,11 +1683,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:332:9
|
LL | _: Foo,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:14:9
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:291:9
|
LL | _: Bar,
| ^^^^^^
error: field `a` is already declared
--> $DIR/field_uniqueness_check.rs:333:9
@ -1273,11 +1713,21 @@ note: field `a` declared here
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:333:9
|
LL | _: Bar,
| ^^^^^^
note: field `a` first declared here
--> $DIR/field_uniqueness_check.rs:14:9
|
LL | a: u8,
| ^^^^^
help: fields from the type of this unnamed field are considered fields of the outer type
--> $DIR/field_uniqueness_check.rs:291:9
|
LL | _: Bar,
| ^^^^^^
error: aborting due to 85 previous errors

View File

@ -20,6 +20,11 @@ LL | | b: i32,
LL | | },
LL | | },
| |_____^
help: add `#[repr(C)]` to this struct
|
LL + #[repr(C)]
LL | struct A {
|
error: union with unnamed fields must have `#[repr(C)]` representation
--> $DIR/repr_check.rs:16:1
@ -43,6 +48,11 @@ LL | | b: i32,
LL | | },
LL | | },
| |_____^
help: add `#[repr(C)]` to this union
|
LL + #[repr(C)]
LL | union B {
|
error: struct with unnamed fields must have `#[repr(C)]` representation
--> $DIR/repr_check.rs:39:1
@ -55,6 +65,11 @@ note: unnamed field defined here
|
LL | _: Foo,
| ^^^^^^
help: add `#[repr(C)]` to this struct
|
LL + #[repr(C)]
LL | struct C {
|
error: union with unnamed fields must have `#[repr(C)]` representation
--> $DIR/repr_check.rs:44:1
@ -67,6 +82,11 @@ note: unnamed field defined here
|
LL | _: Foo,
| ^^^^^^
help: add `#[repr(C)]` to this union
|
LL + #[repr(C)]
LL | union D {
|
error: named type of unnamed field must have `#[repr(C)]` representation
--> $DIR/repr_check.rs:51:5
@ -76,6 +96,12 @@ LL | struct Bar {}
...
LL | _: Bar,
| ^^^^^^ unnamed field defined here
|
help: add `#[repr(C)]` to this struct
|
LL + #[repr(C)]
LL | struct Bar {}
|
error: named type of unnamed field must have `#[repr(C)]` representation
--> $DIR/repr_check.rs:54:9
@ -85,6 +111,12 @@ LL | struct Bar {}
...
LL | _: Bar,
| ^^^^^^ unnamed field defined here
|
help: add `#[repr(C)]` to this struct
|
LL + #[repr(C)]
LL | struct Bar {}
|
error: named type of unnamed field must have `#[repr(C)]` representation
--> $DIR/repr_check.rs:61:5
@ -94,6 +126,12 @@ LL | struct Bar {}
...
LL | _: Bar,
| ^^^^^^ unnamed field defined here
|
help: add `#[repr(C)]` to this struct
|
LL + #[repr(C)]
LL | struct Bar {}
|
error: named type of unnamed field must have `#[repr(C)]` representation
--> $DIR/repr_check.rs:64:9
@ -103,6 +141,12 @@ LL | struct Bar {}
...
LL | _: Bar,
| ^^^^^^ unnamed field defined here
|
help: add `#[repr(C)]` to this struct
|
LL + #[repr(C)]
LL | struct Bar {}
|
error: aborting due to 8 previous errors