From d1fcf611175e695c35c6cc0537d710277c1a5c6f Mon Sep 17 00:00:00 2001 From: David Wood Date: Thu, 13 Oct 2022 10:13:02 +0100 Subject: errors: generate typed identifiers in each crate Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood --- compiler/rustc_ast_lowering/src/errors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/rustc_ast_lowering/src/errors.rs') diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/errors.rs index 21c6a2d26f4..8b302ac2142 100644 --- a/compiler/rustc_ast_lowering/src/errors.rs +++ b/compiler/rustc_ast_lowering/src/errors.rs @@ -339,7 +339,7 @@ pub struct InclusiveRangeWithNoEnd { #[derive(Diagnostic, Clone, Copy)] #[diag(ast_lowering_trait_fn_async, code = "E0706")] #[note] -#[note(note2)] +#[note(ast_lowering_note2)] pub struct TraitFnAsync { #[primary_span] pub fn_span: Span, -- cgit 1.4.1-3-g733a5 From e7c490892f440afb1e34b3c2315aca04f51cd070 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Tue, 14 Feb 2023 19:15:43 +0000 Subject: Move associated type bounds check to ast lowering This makes the check for when associated type bounds more accurate --- compiler/rustc_ast_lowering/locales/en-US.ftl | 3 + compiler/rustc_ast_lowering/src/errors.rs | 8 ++ compiler/rustc_ast_lowering/src/lib.rs | 10 +- compiler/rustc_ast_passes/locales/en-US.ftl | 3 - compiler/rustc_ast_passes/src/ast_validation.rs | 33 +---- compiler/rustc_ast_passes/src/errors.rs | 7 - .../bad-universal-in-dyn-in-where-clause.rs | 15 ++ .../bad-universal-in-dyn-in-where-clause.stderr | 18 +++ .../bad-universal-in-impl-sig.rs | 14 ++ .../bad-universal-in-impl-sig.stderr | 8 ++ tests/ui/associated-type-bounds/inside-adt.rs | 31 +++-- tests/ui/associated-type-bounds/inside-adt.stderr | 154 ++++++++++----------- 12 files changed, 168 insertions(+), 136 deletions(-) create mode 100644 tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.rs create mode 100644 tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.stderr create mode 100644 tests/ui/associated-type-bounds/bad-universal-in-impl-sig.rs create mode 100644 tests/ui/associated-type-bounds/bad-universal-in-impl-sig.stderr (limited to 'compiler/rustc_ast_lowering/src/errors.rs') diff --git a/compiler/rustc_ast_lowering/locales/en-US.ftl b/compiler/rustc_ast_lowering/locales/en-US.ftl index 03c88c6c0eb..a2837deafde 100644 --- a/compiler/rustc_ast_lowering/locales/en-US.ftl +++ b/compiler/rustc_ast_lowering/locales/en-US.ftl @@ -19,6 +19,9 @@ ast_lowering_remove_parentheses = remove these parentheses ast_lowering_misplaced_impl_trait = `impl Trait` only allowed in function and inherent method return types, not in {$position} +ast_lowering_misplaced_assoc_ty_binding = + associated type bounds are only allowed in where clauses and function signatures, not in {$position} + ast_lowering_rustc_box_attribute_error = #[rustc_box] requires precisely one argument and no other attributes are allowed diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/errors.rs index 8b302ac2142..def74c2adee 100644 --- a/compiler/rustc_ast_lowering/src/errors.rs +++ b/compiler/rustc_ast_lowering/src/errors.rs @@ -79,6 +79,14 @@ pub struct MisplacedImplTrait<'a> { pub position: DiagnosticArgFromDisplay<'a>, } +#[derive(Diagnostic)] +#[diag(ast_lowering_misplaced_assoc_ty_binding)] +pub struct MisplacedAssocTyBinding<'a> { + #[primary_span] + pub span: Span, + pub position: DiagnosticArgFromDisplay<'a>, +} + #[derive(Diagnostic, Clone, Copy)] #[diag(ast_lowering_rustc_box_attribute_error)] pub struct RustcBoxAttributeError { diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index a726fbb72e9..60391f77449 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1002,8 +1002,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { } else { self.arena.alloc(hir::GenericArgs::none()) }; - let itctx_tait = &ImplTraitContext::TypeAliasesOpaqueTy; - let kind = match &constraint.kind { AssocConstraintKind::Equality { term } => { let term = match term { @@ -1040,7 +1038,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // then to an opaque type). // // FIXME: this is only needed until `impl Trait` is allowed in type aliases. - ImplTraitContext::Disallowed(_) if self.is_in_dyn_type => (true, itctx_tait), + ImplTraitContext::Disallowed(position) if self.is_in_dyn_type => { + self.tcx.sess.emit_err(errors::MisplacedAssocTyBinding { + span: constraint.span, + position: DiagnosticArgFromDisplay(position), + }); + (false, itctx) + } // We are in the parameter position, but not within a dyn type: // diff --git a/compiler/rustc_ast_passes/locales/en-US.ftl b/compiler/rustc_ast_passes/locales/en-US.ftl index 5f28839f136..128e7255c61 100644 --- a/compiler/rustc_ast_passes/locales/en-US.ftl +++ b/compiler/rustc_ast_passes/locales/en-US.ftl @@ -11,9 +11,6 @@ ast_passes_forbidden_let_stable = ast_passes_deprecated_where_clause_location = where clause not allowed here -ast_passes_forbidden_assoc_constraint = - associated type bounds are not allowed within structs, enums, or unions - ast_passes_keyword_lifetime = lifetimes cannot use keyword names diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index 56977e45a1a..ee861e87355 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -71,10 +71,6 @@ struct AstValidator<'a> { /// or `Foo::Bar` is_impl_trait_banned: bool, - /// Used to ban associated type bounds (i.e., `Type`) in - /// certain positions. - is_assoc_ty_bound_banned: bool, - /// See [ForbiddenLetReason] forbidden_let_reason: Option, @@ -180,30 +176,12 @@ impl<'a> AstValidator<'a> { } } - fn with_banned_assoc_ty_bound(&mut self, f: impl FnOnce(&mut Self)) { - let old = mem::replace(&mut self.is_assoc_ty_bound_banned, true); - f(self); - self.is_assoc_ty_bound_banned = old; - } - fn with_impl_trait(&mut self, outer: Option, f: impl FnOnce(&mut Self)) { let old = mem::replace(&mut self.outer_impl_trait, outer); f(self); self.outer_impl_trait = old; } - fn visit_assoc_constraint_from_generic_args(&mut self, constraint: &'a AssocConstraint) { - match constraint.kind { - AssocConstraintKind::Equality { .. } => {} - AssocConstraintKind::Bound { .. } => { - if self.is_assoc_ty_bound_banned { - self.session.emit_err(ForbiddenAssocConstraint { span: constraint.span }); - } - } - } - self.visit_assoc_constraint(constraint); - } - // Mirrors `visit::walk_ty`, but tracks relevant state. fn walk_ty(&mut self, t: &'a Ty) { match &t.kind { @@ -1248,7 +1226,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { // are allowed to contain nested `impl Trait`. AngleBracketedArg::Constraint(constraint) => { self.with_impl_trait(None, |this| { - this.visit_assoc_constraint_from_generic_args(constraint); + this.visit_assoc_constraint(constraint); }); } } @@ -1373,14 +1351,6 @@ impl<'a> Visitor<'a> for AstValidator<'a> { visit::walk_param_bound(self, bound) } - fn visit_variant_data(&mut self, s: &'a VariantData) { - self.with_banned_assoc_ty_bound(|this| visit::walk_struct_def(this, s)) - } - - fn visit_enum_def(&mut self, enum_definition: &'a EnumDef) { - self.with_banned_assoc_ty_bound(|this| visit::walk_enum_def(this, enum_definition)) - } - fn visit_fn(&mut self, fk: FnKind<'a>, span: Span, id: NodeId) { // Only associated `fn`s can have `self` parameters. let self_semantic = match fk.ctxt() { @@ -1709,7 +1679,6 @@ pub fn check_crate(session: &Session, krate: &Crate, lints: &mut LintBuffer) -> outer_impl_trait: None, disallow_tilde_const: None, is_impl_trait_banned: false, - is_assoc_ty_bound_banned: false, forbidden_let_reason: Some(ForbiddenLetReason::GenericForbidden), lint_buffer: lints, }; diff --git a/compiler/rustc_ast_passes/src/errors.rs b/compiler/rustc_ast_passes/src/errors.rs index 69ce8daa455..f304f5a1956 100644 --- a/compiler/rustc_ast_passes/src/errors.rs +++ b/compiler/rustc_ast_passes/src/errors.rs @@ -23,13 +23,6 @@ pub struct ForbiddenLetStable { pub span: Span, } -#[derive(Diagnostic)] -#[diag(ast_passes_forbidden_assoc_constraint)] -pub struct ForbiddenAssocConstraint { - #[primary_span] - pub span: Span, -} - #[derive(Diagnostic)] #[diag(ast_passes_keyword_lifetime)] pub struct KeywordLifetime { diff --git a/tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.rs b/tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.rs new file mode 100644 index 00000000000..2d04f6fc452 --- /dev/null +++ b/tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.rs @@ -0,0 +1,15 @@ +#![feature(associated_type_bounds)] + +trait B { + type AssocType; +} + +fn f() +where + dyn for<'j> B:, + //~^ ERROR associated type bounds are only allowed in where clauses and function signatures + //~| ERROR the value of the associated type `AssocType` (from trait `B`) must be specified +{ +} + +fn main() {} diff --git a/tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.stderr b/tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.stderr new file mode 100644 index 00000000000..ffba044e7e7 --- /dev/null +++ b/tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.stderr @@ -0,0 +1,18 @@ +error: associated type bounds are only allowed in where clauses and function signatures, not in bound + --> $DIR/bad-universal-in-dyn-in-where-clause.rs:9:19 + | +LL | dyn for<'j> B:, + | ^^^^^^^^^^^^^ + +error[E0191]: the value of the associated type `AssocType` (from trait `B`) must be specified + --> $DIR/bad-universal-in-dyn-in-where-clause.rs:9:9 + | +LL | type AssocType; + | -------------- `AssocType` defined here +... +LL | dyn for<'j> B:, + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: specify the associated type: `for<'j> B` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0191`. diff --git a/tests/ui/associated-type-bounds/bad-universal-in-impl-sig.rs b/tests/ui/associated-type-bounds/bad-universal-in-impl-sig.rs new file mode 100644 index 00000000000..dd59dbd243e --- /dev/null +++ b/tests/ui/associated-type-bounds/bad-universal-in-impl-sig.rs @@ -0,0 +1,14 @@ +#![feature(associated_type_bounds)] + +trait Trait { + type Item; +} + +trait Trait2 {} + +// It's not possible to insert a universal `impl Trait` here! +impl dyn Trait {} +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures +//~| ERROR the value of the associated type `Item` (from trait `Trait`) must be specified + +fn main() {} diff --git a/tests/ui/associated-type-bounds/bad-universal-in-impl-sig.stderr b/tests/ui/associated-type-bounds/bad-universal-in-impl-sig.stderr new file mode 100644 index 00000000000..df4b6328c52 --- /dev/null +++ b/tests/ui/associated-type-bounds/bad-universal-in-impl-sig.stderr @@ -0,0 +1,8 @@ +error: associated type bounds are only allowed in where clauses and function signatures, not in impl header + --> $DIR/bad-universal-in-impl-sig.rs:10:16 + | +LL | impl dyn Trait {} + | ^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/associated-type-bounds/inside-adt.rs b/tests/ui/associated-type-bounds/inside-adt.rs index 8eb8c44bb42..70a30287092 100644 --- a/tests/ui/associated-type-bounds/inside-adt.rs +++ b/tests/ui/associated-type-bounds/inside-adt.rs @@ -3,28 +3,33 @@ use std::mem::ManuallyDrop; struct S1 { f: dyn Iterator } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures +//~| ERROR the value of the associated type `Item` (from trait `Iterator`) must be specified struct S2 { f: Box> } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures +//~| ERROR the value of the associated type `Item` (from trait `Iterator`) must be specified struct S3 { f: dyn Iterator } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures +//~| ERROR the value of the associated type `Item` (from trait `Iterator`) must be specified enum E1 { V(dyn Iterator) } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions -//~| ERROR the size for values of type `(dyn Iterator + 'static)` +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures +//~| ERROR the value of the associated type `Item` (from trait `Iterator`) must be specified enum E2 { V(Box>) } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures +//~| ERROR the value of the associated type `Item` (from trait `Iterator`) must be specified enum E3 { V(dyn Iterator) } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions -//~| ERROR the size for values of type `(dyn Iterator + 'static)` +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures +//~| ERROR the value of the associated type `Item` (from trait `Iterator`) must be specified union U1 { f: ManuallyDrop> } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions -//~| ERROR the size for values of type `(dyn Iterator + 'static)` +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures +//~| ERROR the value of the associated type `Item` (from trait `Iterator`) must be specified union U2 { f: ManuallyDrop>> } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures +//~| ERROR the value of the associated type `Item` (from trait `Iterator`) must be specified union U3 { f: ManuallyDrop> } -//~^ ERROR associated type bounds are not allowed within structs, enums, or unions -//~| ERROR the size for values of type `(dyn Iterator + 'static)` +//~^ ERROR associated type bounds are only allowed in where clauses and function signatures +//~| ERROR the value of the associated type `Item` (from trait `Iterator`) must be specified fn main() {} diff --git a/tests/ui/associated-type-bounds/inside-adt.stderr b/tests/ui/associated-type-bounds/inside-adt.stderr index 1668b613b25..e1d35bd9c32 100644 --- a/tests/ui/associated-type-bounds/inside-adt.stderr +++ b/tests/ui/associated-type-bounds/inside-adt.stderr @@ -1,131 +1,129 @@ -error: associated type bounds are not allowed within structs, enums, or unions +error: associated type bounds are only allowed in where clauses and function signatures, not in field type --> $DIR/inside-adt.rs:5:29 | LL | struct S1 { f: dyn Iterator } | ^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions - --> $DIR/inside-adt.rs:7:33 +error: associated type bounds are only allowed in where clauses and function signatures, not in field type + --> $DIR/inside-adt.rs:8:33 | LL | struct S2 { f: Box> } | ^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions - --> $DIR/inside-adt.rs:9:29 +error: associated type bounds are only allowed in where clauses and function signatures, not in field type + --> $DIR/inside-adt.rs:11:29 | LL | struct S3 { f: dyn Iterator } | ^^^^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions - --> $DIR/inside-adt.rs:12:26 +error: associated type bounds are only allowed in where clauses and function signatures, not in field type + --> $DIR/inside-adt.rs:15:26 | LL | enum E1 { V(dyn Iterator) } | ^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions - --> $DIR/inside-adt.rs:15:30 +error: associated type bounds are only allowed in where clauses and function signatures, not in field type + --> $DIR/inside-adt.rs:18:30 | LL | enum E2 { V(Box>) } | ^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions - --> $DIR/inside-adt.rs:17:26 +error: associated type bounds are only allowed in where clauses and function signatures, not in field type + --> $DIR/inside-adt.rs:21:26 | LL | enum E3 { V(dyn Iterator) } | ^^^^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions - --> $DIR/inside-adt.rs:21:41 +error: associated type bounds are only allowed in where clauses and function signatures, not in field type + --> $DIR/inside-adt.rs:25:41 | LL | union U1 { f: ManuallyDrop> } | ^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions - --> $DIR/inside-adt.rs:24:45 +error: associated type bounds are only allowed in where clauses and function signatures, not in field type + --> $DIR/inside-adt.rs:28:45 | LL | union U2 { f: ManuallyDrop>> } | ^^^^^^^^^^ -error: associated type bounds are not allowed within structs, enums, or unions - --> $DIR/inside-adt.rs:26:41 +error: associated type bounds are only allowed in where clauses and function signatures, not in field type + --> $DIR/inside-adt.rs:31:41 | LL | union U3 { f: ManuallyDrop> } | ^^^^^^^^^^^^^ -error[E0277]: the size for values of type `(dyn Iterator + 'static)` cannot be known at compilation time - --> $DIR/inside-adt.rs:12:13 +error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified + --> $DIR/inside-adt.rs:5:20 | -LL | enum E1 { V(dyn Iterator) } - | ^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `(dyn Iterator + 'static)` - = note: no field of an enum variant may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size - | -LL | enum E1 { V(&dyn Iterator) } - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap +LL | struct S1 { f: dyn Iterator } + | ^^^^^^^^^^^^^^^^^^^^ + | | + | associated type `Item` must be specified + | help: specify the associated types: `Iterator` + +error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified + --> $DIR/inside-adt.rs:8:24 | -LL | enum E1 { V(Box>) } - | ++++ + +LL | struct S2 { f: Box> } + | ^^^^^^^^^^^^^^^^^^^^ + | | + | associated type `Item` must be specified + | help: specify the associated types: `Iterator` -error[E0277]: the size for values of type `(dyn Iterator + 'static)` cannot be known at compilation time - --> $DIR/inside-adt.rs:17:13 +error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified + --> $DIR/inside-adt.rs:11:20 | -LL | enum E3 { V(dyn Iterator) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time +LL | struct S3 { f: dyn Iterator } + | ^^^^^^^^^^^^^^^^^^^^^^^ help: specify the associated type: `Iterator` + +error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified + --> $DIR/inside-adt.rs:15:17 | - = help: the trait `Sized` is not implemented for `(dyn Iterator + 'static)` - = note: no field of an enum variant may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size +LL | enum E1 { V(dyn Iterator) } + | ^^^^^^^^^^^^^^^^^^^^ + | | + | associated type `Item` must be specified + | help: specify the associated types: `Iterator` + +error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified + --> $DIR/inside-adt.rs:18:21 | -LL | enum E3 { V(&dyn Iterator) } - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap +LL | enum E2 { V(Box>) } + | ^^^^^^^^^^^^^^^^^^^^ + | | + | associated type `Item` must be specified + | help: specify the associated types: `Iterator` + +error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified + --> $DIR/inside-adt.rs:21:17 | -LL | enum E3 { V(Box>) } - | ++++ + +LL | enum E3 { V(dyn Iterator) } + | ^^^^^^^^^^^^^^^^^^^^^^^ help: specify the associated type: `Iterator` -error[E0277]: the size for values of type `(dyn Iterator + 'static)` cannot be known at compilation time - --> $DIR/inside-adt.rs:21:15 +error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified + --> $DIR/inside-adt.rs:25:32 | LL | union U1 { f: ManuallyDrop> } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: within `ManuallyDrop<(dyn Iterator + 'static)>`, the trait `Sized` is not implemented for `(dyn Iterator + 'static)` - = note: required because it appears within the type `ManuallyDrop>` - = note: no field of a union may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size - | -LL | union U1 { f: &ManuallyDrop> } - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap + | ^^^^^^^^^^^^^^^^^^^^ + | | + | associated type `Item` must be specified + | help: specify the associated types: `Iterator` + +error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified + --> $DIR/inside-adt.rs:28:36 | -LL | union U1 { f: Box>> } - | ++++ + +LL | union U2 { f: ManuallyDrop>> } + | ^^^^^^^^^^^^^^^^^^^^ + | | + | associated type `Item` must be specified + | help: specify the associated types: `Iterator` -error[E0277]: the size for values of type `(dyn Iterator + 'static)` cannot be known at compilation time - --> $DIR/inside-adt.rs:26:15 +error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified + --> $DIR/inside-adt.rs:31:32 | LL | union U3 { f: ManuallyDrop> } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: within `ManuallyDrop<(dyn Iterator + 'static)>`, the trait `Sized` is not implemented for `(dyn Iterator + 'static)` - = note: required because it appears within the type `ManuallyDrop>` - = note: no field of a union may have a dynamically sized type - = help: change the field's type to have a statically known size -help: borrowed types always have a statically known size - | -LL | union U3 { f: &ManuallyDrop> } - | + -help: the `Box` type always has a statically known size and allocates its contents in the heap - | -LL | union U3 { f: Box>> } - | ++++ + + | ^^^^^^^^^^^^^^^^^^^^^^^ help: specify the associated type: `Iterator` -error: aborting due to 13 previous errors +error: aborting due to 18 previous errors -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0191`. -- cgit 1.4.1-3-g733a5