]> git.lizzy.rs Git - rust.git/commitdiff
Suggest boxing or borrowing unsized fields
authorEsteban Küber <esteban@kuber.com.ar>
Fri, 10 Jul 2020 22:13:49 +0000 (15:13 -0700)
committerEsteban Küber <esteban@kuber.com.ar>
Tue, 14 Jul 2020 17:50:24 +0000 (10:50 -0700)
30 files changed:
src/librustc_middle/traits/mod.rs
src/librustc_middle/traits/structural_impls.rs
src/librustc_trait_selection/traits/error_reporting/suggestions.rs
src/librustc_typeck/check/wfcheck.rs
src/test/ui/const-generics/array-size-in-generic-struct-param.stderr
src/test/ui/error-codes/E0478.stderr
src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr
src/test/ui/issues/issue-19380.stderr
src/test/ui/issues/issue-22874.stderr
src/test/ui/issues/issue-27060-2.stderr
src/test/ui/issues/issue-35988.stderr
src/test/ui/lazy_normalization_consts/issue-57739.stderr
src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr
src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr
src/test/ui/regions/regions-wf-trait-object.stderr
src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr
src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr
src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr
src/test/ui/union/union-sized-field.stderr
src/test/ui/union/union-unsized.stderr
src/test/ui/unsized/unsized-enum2.stderr
src/test/ui/unsized5.stderr
src/test/ui/wf/wf-array-elem-sized.stderr
src/test/ui/wf/wf-enum-fields-struct-variant.stderr
src/test/ui/wf/wf-in-fn-type-arg.stderr
src/test/ui/wf/wf-in-fn-type-ret.stderr
src/test/ui/wf/wf-in-fn-type-static.stderr
src/test/ui/wf/wf-in-obj-type-static.stderr
src/test/ui/wf/wf-in-obj-type-trait.stderr
src/test/ui/wf/wf-struct-field.stderr

index db81dc19c08f416e6d8cd49b274c84c9afc064ab..c15c31a53f0c9fefafb2f06bdf6d086e95c08488 100644 (file)
@@ -229,6 +229,7 @@ pub enum ObligationCauseCode<'tcx> {
     /// Types of fields (other than the last, except for packed structs) in a struct must be sized.
     FieldSized {
         adt_kind: AdtKind,
+        span: Span,
         last: bool,
     },
 
index e2a0e3dfa30570008153bdb073910bb15f54fddb..334462790edbcc5a2f03c2de543fcdf9148d0065 100644 (file)
@@ -156,7 +156,9 @@ fn lift_to_tcx(&self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
             super::SizedYieldType => Some(super::SizedYieldType),
             super::InlineAsmSized => Some(super::InlineAsmSized),
             super::RepeatVec(suggest_flag) => Some(super::RepeatVec(suggest_flag)),
-            super::FieldSized { adt_kind, last } => Some(super::FieldSized { adt_kind, last }),
+            super::FieldSized { adt_kind, span, last } => {
+                Some(super::FieldSized { adt_kind, span, last })
+            }
             super::ConstSized => Some(super::ConstSized),
             super::ConstPatternStructural => Some(super::ConstPatternStructural),
             super::SharedStatic => Some(super::SharedStatic),
index 3c3b5bdf59ccf746be8064926fec2262a1744512..3daa5b3b1abdc93d901b904bae95deea2f24fe43 100644 (file)
@@ -1856,26 +1856,43 @@ fn note_obligation_cause_code<T>(
             ObligationCauseCode::StructInitializerSized => {
                 err.note("structs must have a statically known size to be initialized");
             }
-            ObligationCauseCode::FieldSized { adt_kind: ref item, last } => match *item {
-                AdtKind::Struct => {
-                    if last {
-                        err.note(
-                            "the last field of a packed struct may only have a \
-                             dynamically sized type if it does not need drop to be run",
-                        );
-                    } else {
-                        err.note(
-                            "only the last field of a struct may have a dynamically sized type",
-                        );
+            ObligationCauseCode::FieldSized { adt_kind: ref item, last, span } => {
+                match *item {
+                    AdtKind::Struct => {
+                        if last {
+                            err.note(
+                                "the last field of a packed struct may only have a \
+                                dynamically sized type if it does not need drop to be run",
+                            );
+                        } else {
+                            err.note(
+                                "only the last field of a struct may have a dynamically sized type",
+                            );
+                        }
+                    }
+                    AdtKind::Union => {
+                        err.note("no field of a union may have a dynamically sized type");
+                    }
+                    AdtKind::Enum => {
+                        err.note("no field of an enum variant may have a dynamically sized type");
                     }
                 }
-                AdtKind::Union => {
-                    err.note("no field of a union may have a dynamically sized type");
-                }
-                AdtKind::Enum => {
-                    err.note("no field of an enum variant may have a dynamically sized type");
-                }
-            },
+                err.help("change the field's type to have a statically known size");
+                err.span_suggestion(
+                    span.shrink_to_lo(),
+                    "borrowed types always have a statically known size",
+                    "&".to_string(),
+                    Applicability::MachineApplicable,
+                );
+                err.multipart_suggestion(
+                    "heap allocated types always have a statically known size",
+                    vec![
+                        (span.shrink_to_lo(), "Box<".to_string()),
+                        (span.shrink_to_hi(), ">".to_string()),
+                    ],
+                    Applicability::MachineApplicable,
+                );
+            }
             ObligationCauseCode::ConstSized => {
                 err.note("constant expressions must have a statically known size");
             }
index a641b881e3186063f5a51b0eaa4d90f439fbab6d..19c556942afc1397462390030fb97b722f879b10 100644 (file)
@@ -394,6 +394,7 @@ fn check_type_defn<'tcx, F>(
                                 Some(i) => i,
                                 None => bug!(),
                             },
+                            span: field.span,
                             last,
                         },
                     ),
@@ -1329,7 +1330,7 @@ fn non_enum_variant(&self, struct_def: &hir::VariantData<'_>) -> AdtVariant<'tcx
                 let field_ty = self.normalize_associated_types_in(field.ty.span, &field_ty);
                 let field_ty = self.resolve_vars_if_possible(&field_ty);
                 debug!("non_enum_variant: type of field {:?} is {:?}", field, field_ty);
-                AdtField { ty: field_ty, span: field.span }
+                AdtField { ty: field_ty, span: field.ty.span }
             })
             .collect();
         AdtVariant { fields, explicit_discr: None }
index 14cf64eeb7ac69841461972e8e033910824b6869..ad67a87265bd3f0e66959bf691864ee8625610e1 100644 (file)
@@ -16,10 +16,10 @@ LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
    = note: this may fail depending on what value the parameter takes
 
 error: constant expression depends on a generic parameter
-  --> $DIR/array-size-in-generic-struct-param.rs:14:5
+  --> $DIR/array-size-in-generic-struct-param.rs:14:10
    |
 LL |     arr: [u8; CFG.arr_size],
-   |     ^^^^^^^^^^^^^^^^^^^^^^^
+   |          ^^^^^^^^^^^^^^^^^^
    |
    = note: this may fail depending on what value the parameter takes
 
index 1380840e0db2d7da12c2d32565823c10118acd79..38736de8d9ac72d7c22b392c85ab1b025ef49445 100644 (file)
@@ -1,8 +1,8 @@
 error[E0478]: lifetime bound not satisfied
-  --> $DIR/E0478.rs:4:5
+  --> $DIR/E0478.rs:4:12
    |
 LL |     child: Box<dyn Wedding<'kiss> + 'SnowWhite>,
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: lifetime parameter instantiated with the lifetime `'SnowWhite` as defined on the struct at 3:22
   --> $DIR/E0478.rs:3:22
index 2beeba8184a7dfb0b3a7891fa222f6c2819c0ef2..987cde191cbb98431dc46b85f41800f15ecb026d 100644 (file)
@@ -1,10 +1,10 @@
 error[E0310]: the parameter type `U` may not live long enough
-  --> $DIR/feature-gate-infer_static_outlives_requirements.rs:5:5
+  --> $DIR/feature-gate-infer_static_outlives_requirements.rs:5:10
    |
 LL | struct Foo<U> {
    |            - help: consider adding an explicit lifetime bound...: `U: 'static`
 LL |     bar: Bar<U>
-   |     ^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
+   |          ^^^^^^ ...so that the type `U` will meet its required lifetime bounds
 
 error: aborting due to previous error
 
index 0a080171a795158e949f8f6e90dc8d18fe6380a5..63f0701974b8b1efe1b37028d63ad523c3f976c0 100644 (file)
@@ -1,5 +1,5 @@
 error[E0038]: the trait `Qiz` cannot be made into an object
-  --> $DIR/issue-19380.rs:11:3
+  --> $DIR/issue-19380.rs:11:9
    |
 LL | trait Qiz {
    |       --- this trait cannot be made into an object...
@@ -7,7 +7,7 @@ LL |   fn qiz();
    |      --- ...because associated function `qiz` has no `self` parameter
 ...
 LL |   foos: &'static [&'static (dyn Qiz + 'static)]
-   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Qiz` cannot be made into an object
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Qiz` cannot be made into an object
    |
 help: consider turning `qiz` into a method by giving it a `&self` argument or constraining it so it does not apply to trait objects
    |
index 229f99f90640ba01d8f1c25a88abe732affd77bb..9a74bc03131692bc8974b618627143f0c64823cd 100644 (file)
@@ -1,8 +1,8 @@
 error[E0277]: the size for values of type `[std::string::String]` cannot be known at compilation time
-  --> $DIR/issue-22874.rs:2:5
+  --> $DIR/issue-22874.rs:2:11
    |
 LL |     rows: [[String]],
-   |     ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+   |           ^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `[std::string::String]`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
index 1ddea73e00ae0ee214bec8bea40b715e919eded0..8b64128fb01dad7c8046d24e3edf257a416f9311 100644 (file)
@@ -1,14 +1,23 @@
 error[E0277]: the size for values of type `T` cannot be known at compilation time
-  --> $DIR/issue-27060-2.rs:3:5
+  --> $DIR/issue-27060-2.rs:3:11
    |
 LL | pub struct Bad<T: ?Sized> {
    |                - this type parameter needs to be `std::marker::Sized`
 LL |     data: T,
-   |     ^^^^^^^ doesn't have a size known at compile-time
+   |           ^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `T`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = note: the last field of a packed struct may only have a dynamically sized type if it does not need drop to be run
+   = help: change the field's type to have a statically known size
+help: borrowed types always have a statically known size
+   |
+LL |     data: &T,
+   |           ^
+help: heap allocated types always have a statically known size
+   |
+LL |     data: Box<T>,
+   |           ^^^^ ^
 
 error: aborting due to previous error
 
index 825c0de5e53ea945971674066b764463d26ae691..52660eb7cdac982163b9313d694278bd914ba468 100644 (file)
@@ -7,6 +7,15 @@ LL |     V([Box<E>]),
    = help: the trait `std::marker::Sized` is not implemented for `[std::boxed::Box<E>]`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     V(&[Box<E>]),
+   |       ^
+help: heap allocated types always have a statically known size
+   |
+LL |     V(Box<[Box<E>]>),
+   |       ^^^^        ^
 
 error: aborting due to previous error
 
index 1987f5890c0411a700faf4bd8ff4921887e9bca0..ce0495dd8b0cbaa3a0b137715e6d7f03122530f2 100644 (file)
@@ -8,10 +8,10 @@ LL | #![feature(lazy_normalization_consts)]
    = note: see issue #72219 <https://github.com/rust-lang/rust/issues/72219> for more information
 
 error: constant expression depends on a generic parameter
-  --> $DIR/issue-57739.rs:12:5
+  --> $DIR/issue-57739.rs:12:12
    |
 LL |     array: [u8; T::SIZE],
-   |     ^^^^^^^^^^^^^^^^^^^^
+   |            ^^^^^^^^^^^^^
    |
    = note: this may fail depending on what value the parameter takes
 
index d682478db0eeff8b302d2e0f9e54e44ffb3f3193..e5083e3a088b6b53be9e6b1f8d8976d8c47d31b2 100644 (file)
@@ -1,10 +1,10 @@
 error[E0310]: the parameter type `T` may not live long enough
-  --> $DIR/lifetime-doesnt-live-long-enough.rs:19:5
+  --> $DIR/lifetime-doesnt-live-long-enough.rs:19:10
    |
 LL | struct Foo<T> {
    |            - help: consider adding an explicit lifetime bound...: `T: 'static`
 LL |     foo: &'static T
-   |     ^^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
+   |          ^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
 
 error[E0309]: the parameter type `K` may not live long enough
   --> $DIR/lifetime-doesnt-live-long-enough.rs:24:19
index ea9be77a3e8b5bb85a54ad9b715d467c0d5e261f..22586b5de91ff9e2158c52df337f083e74fedeac 100644 (file)
@@ -5,10 +5,10 @@ LL |     z: Box<dyn Is<'a>+'b+'c>,
    |                          ^^
 
 error[E0478]: lifetime bound not satisfied
-  --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:5
+  --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:8
    |
 LL |     z: Box<dyn Is<'a>+'b+'c>,
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+   |        ^^^^^^^^^^^^^^^^^^^^^
    |
 note: lifetime parameter instantiated with the lifetime `'b` as defined on the struct at 11:15
   --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:15
index 9f39508604110df3c48abb2becb2a3a1208a8828..1ddbf73a46372dc13dbc2c54a9f20a4fc6d8ca23 100644 (file)
@@ -1,8 +1,8 @@
 error[E0478]: lifetime bound not satisfied
-  --> $DIR/regions-wf-trait-object.rs:7:5
+  --> $DIR/regions-wf-trait-object.rs:7:8
    |
 LL |     x: Box<dyn TheTrait<'a>+'b>
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |        ^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: lifetime parameter instantiated with the lifetime `'b` as defined on the struct at 6:15
   --> $DIR/regions-wf-trait-object.rs:6:15
index 2bb51731583a6ffded7c220c0c825f69638b1999..a449fac11930d8ce0571b2bace6738863aa20da3 100644 (file)
@@ -1,10 +1,10 @@
 error[E0310]: the parameter type `U` may not live long enough
-  --> $DIR/dont-infer-static.rs:8:5
+  --> $DIR/dont-infer-static.rs:8:10
    |
 LL | struct Foo<U> {
    |            - help: consider adding an explicit lifetime bound...: `U: 'static`
 LL |     bar: Bar<U>
-   |     ^^^^^^^^^^^ ...so that the type `U` will meet its required lifetime bounds
+   |          ^^^^^^ ...so that the type `U` will meet its required lifetime bounds
 
 error: aborting due to previous error
 
index ee08f51f802703dc509c8f40536cf943db0d4be2..03877e60e2b7200282bd3dab9f622feb5dd53c53 100644 (file)
@@ -1,5 +1,5 @@
 error[E0277]: the size for values of type `T` cannot be known at compilation time
-  --> $DIR/adt-param-with-implicit-sized-bound.rs:25:5
+  --> $DIR/adt-param-with-implicit-sized-bound.rs:25:9
    |
 LL | struct X<T>(T);
    |          - required by this bound in `X`
@@ -7,7 +7,7 @@ LL | struct X<T>(T);
 LL | struct Struct5<T: ?Sized>{
    |                - this type parameter needs to be `std::marker::Sized`
 LL |     _t: X<T>,
-   |     ^^^^^^^^ doesn't have a size known at compile-time
+   |         ^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `T`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
index 271ed07ce42ab1455d2f75cd5bf46d98c875ec2b..d7549835a09051c5e433291322160acc13ef62eb 100644 (file)
@@ -13,13 +13,13 @@ LL | impl<T: Trait> Foo<T> {
    |       ^^^^^^^
 
 error[E0277]: the trait bound `isize: Trait` is not satisfied
-  --> $DIR/trait-bounds-on-structs-and-enums.rs:19:5
+  --> $DIR/trait-bounds-on-structs-and-enums.rs:19:8
    |
 LL | struct Foo<T:Trait> {
    |              ----- required by this bound in `Foo`
 ...
 LL |     a: Foo<isize>,
-   |     ^^^^^^^^^^^^^ the trait `Trait` is not implemented for `isize`
+   |        ^^^^^^^^^^ the trait `Trait` is not implemented for `isize`
 
 error[E0277]: the trait bound `usize: Trait` is not satisfied
   --> $DIR/trait-bounds-on-structs-and-enums.rs:23:10
@@ -31,13 +31,13 @@ LL |     Quux(Bar<usize>),
    |          ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
 
 error[E0277]: the trait bound `U: Trait` is not satisfied
-  --> $DIR/trait-bounds-on-structs-and-enums.rs:27:5
+  --> $DIR/trait-bounds-on-structs-and-enums.rs:27:8
    |
 LL | struct Foo<T:Trait> {
    |              ----- required by this bound in `Foo`
 ...
 LL |     b: Foo<U>,
-   |     ^^^^^^^^^ the trait `Trait` is not implemented for `U`
+   |        ^^^^^^ the trait `Trait` is not implemented for `U`
    |
 help: consider restricting type parameter `U`
    |
@@ -68,13 +68,13 @@ LL |     Foo<i32>,
    |     ^^^^^^^^ the trait `Trait` is not implemented for `i32`
 
 error[E0277]: the trait bound `u8: Trait` is not satisfied
-  --> $DIR/trait-bounds-on-structs-and-enums.rs:39:22
+  --> $DIR/trait-bounds-on-structs-and-enums.rs:39:29
    |
 LL | enum Bar<T:Trait> {
    |            ----- required by this bound in `Bar`
 ...
 LL |     DictionaryLike { field: Bar<u8> },
-   |                      ^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u8`
+   |                             ^^^^^^^ the trait `Trait` is not implemented for `u8`
 
 error: aborting due to 7 previous errors
 
index 62dacd064bed0b63ee047bdc105bbc4faeaa1d3b..1bfc44e3eec62f22151ba294be326de436dce529 100644 (file)
@@ -1,26 +1,44 @@
 error[E0277]: the size for values of type `T` cannot be known at compilation time
-  --> $DIR/union-sized-field.rs:4:5
+  --> $DIR/union-sized-field.rs:4:12
    |
 LL | union Foo<T: ?Sized> {
    |           - this type parameter needs to be `std::marker::Sized`
 LL |     value: T,
-   |     ^^^^^^^^ doesn't have a size known at compile-time
+   |            ^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `T`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     value: &T,
+   |            ^
+help: heap allocated types always have a statically known size
+   |
+LL |     value: Box<T>,
+   |            ^^^^ ^
 
 error[E0277]: the size for values of type `T` cannot be known at compilation time
-  --> $DIR/union-sized-field.rs:9:5
+  --> $DIR/union-sized-field.rs:9:12
    |
 LL | struct Foo2<T: ?Sized> {
    |             - this type parameter needs to be `std::marker::Sized`
 LL |     value: T,
-   |     ^^^^^^^^ doesn't have a size known at compile-time
+   |            ^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `T`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = note: only the last field of a struct 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 |     value: &T,
+   |            ^
+help: heap allocated types always have a statically known size
+   |
+LL |     value: Box<T>,
+   |            ^^^^ ^
 
 error[E0277]: the size for values of type `T` cannot be known at compilation time
   --> $DIR/union-sized-field.rs:15:11
@@ -33,6 +51,15 @@ LL |     Value(T),
    = help: the trait `std::marker::Sized` is not implemented for `T`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     Value(&T),
+   |           ^
+help: heap allocated types always have a statically known size
+   |
+LL |     Value(Box<T>),
+   |           ^^^^ ^
 
 error: aborting due to 3 previous errors
 
index e702f2c61bee3ff543755b0f549ad5158210a30a..442ea83f80168d1d14ab852c5f5d634e68a1680d 100644 (file)
@@ -1,22 +1,40 @@
 error[E0277]: the size for values of type `str` cannot be known at compilation time
-  --> $DIR/union-unsized.rs:4:5
+  --> $DIR/union-unsized.rs:4:8
    |
 LL |     a: str,
-   |     ^^^^^^ doesn't have a size known at compile-time
+   |        ^^^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `str`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     a: &str,
+   |        ^
+help: heap allocated types always have a statically known size
+   |
+LL |     a: Box<str>,
+   |        ^^^^   ^
 
 error[E0277]: the size for values of type `str` cannot be known at compilation time
-  --> $DIR/union-unsized.rs:12:5
+  --> $DIR/union-unsized.rs:12:8
    |
 LL |     b: str,
-   |     ^^^^^^ doesn't have a size known at compile-time
+   |        ^^^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `str`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     b: &str,
+   |        ^
+help: heap allocated types always have a statically known size
+   |
+LL |     b: Box<str>,
+   |        ^^^^   ^
 
 error: aborting due to 2 previous errors
 
index bc3b3831f32699ed06c2fe6699b99150a2805ede..fb89a6f45d234dc018efd65e0ed2d253f846c22f 100644 (file)
@@ -10,19 +10,37 @@ LL |     VA(W),
    = help: the trait `std::marker::Sized` is not implemented for `W`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VA(&W),
+   |        ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VA(Box<W>),
+   |        ^^^^ ^
 
 error[E0277]: the size for values of type `X` cannot be known at compilation time
-  --> $DIR/unsized-enum2.rs:25:8
+  --> $DIR/unsized-enum2.rs:25:11
    |
 LL | enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized> {
    |                   - this type parameter needs to be `std::marker::Sized`
 ...
 LL |     VB{x: X},
-   |        ^^^^ doesn't have a size known at compile-time
+   |           ^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `X`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VB{x: &X},
+   |           ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VB{x: Box<X>},
+   |           ^^^^ ^
 
 error[E0277]: the size for values of type `Y` cannot be known at compilation time
   --> $DIR/unsized-enum2.rs:27:15
@@ -36,19 +54,37 @@ LL |     VC(isize, Y),
    = help: the trait `std::marker::Sized` is not implemented for `Y`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VC(isize, &Y),
+   |               ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VC(isize, Box<Y>),
+   |               ^^^^ ^
 
 error[E0277]: the size for values of type `Z` cannot be known at compilation time
-  --> $DIR/unsized-enum2.rs:29:18
+  --> $DIR/unsized-enum2.rs:29:21
    |
 LL | enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized> {
    |                                         - this type parameter needs to be `std::marker::Sized`
 ...
 LL |     VD{u: isize, x: Z},
-   |                  ^^^^ doesn't have a size known at compile-time
+   |                     ^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `Z`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VD{u: isize, x: &Z},
+   |                     ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VD{u: isize, x: Box<Z>},
+   |                     ^^^^ ^
 
 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
   --> $DIR/unsized-enum2.rs:33:8
@@ -59,16 +95,34 @@ LL |     VE([u8]),
    = help: the trait `std::marker::Sized` is not implemented for `[u8]`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VE(&[u8]),
+   |        ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VE(Box<[u8]>),
+   |        ^^^^    ^
 
 error[E0277]: the size for values of type `str` cannot be known at compilation time
-  --> $DIR/unsized-enum2.rs:35:8
+  --> $DIR/unsized-enum2.rs:35:11
    |
 LL |     VF{x: str},
-   |        ^^^^^^ doesn't have a size known at compile-time
+   |           ^^^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `str`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VF{x: &str},
+   |           ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VF{x: Box<str>},
+   |           ^^^^   ^
 
 error[E0277]: the size for values of type `[f32]` cannot be known at compilation time
   --> $DIR/unsized-enum2.rs:37:15
@@ -79,16 +133,34 @@ LL |     VG(isize, [f32]),
    = help: the trait `std::marker::Sized` is not implemented for `[f32]`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VG(isize, &[f32]),
+   |               ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VG(isize, Box<[f32]>),
+   |               ^^^^     ^
 
 error[E0277]: the size for values of type `[u32]` cannot be known at compilation time
-  --> $DIR/unsized-enum2.rs:39:18
+  --> $DIR/unsized-enum2.rs:39:21
    |
 LL |     VH{u: isize, x: [u32]},
-   |                  ^^^^^^^^ doesn't have a size known at compile-time
+   |                     ^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `[u32]`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VH{u: isize, x: &[u32]},
+   |                     ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VH{u: isize, x: Box<[u32]>},
+   |                     ^^^^     ^
 
 error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known at compilation time
   --> $DIR/unsized-enum2.rs:53:8
@@ -99,16 +171,34 @@ LL |     VM(dyn Foo),
    = help: the trait `std::marker::Sized` is not implemented for `(dyn Foo + 'static)`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VM(&dyn Foo),
+   |        ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VM(Box<dyn Foo>),
+   |        ^^^^       ^
 
 error[E0277]: the size for values of type `(dyn Bar + 'static)` cannot be known at compilation time
-  --> $DIR/unsized-enum2.rs:55:8
+  --> $DIR/unsized-enum2.rs:55:11
    |
 LL |     VN{x: dyn Bar},
-   |        ^^^^^^^^^^ doesn't have a size known at compile-time
+   |           ^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `(dyn Bar + 'static)`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VN{x: &dyn Bar},
+   |           ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VN{x: Box<dyn Bar>},
+   |           ^^^^       ^
 
 error[E0277]: the size for values of type `(dyn FooBar + 'static)` cannot be known at compilation time
   --> $DIR/unsized-enum2.rs:57:15
@@ -119,16 +209,34 @@ LL |     VO(isize, dyn FooBar),
    = help: the trait `std::marker::Sized` is not implemented for `(dyn FooBar + 'static)`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VO(isize, &dyn FooBar),
+   |               ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VO(isize, Box<dyn FooBar>),
+   |               ^^^^          ^
 
 error[E0277]: the size for values of type `(dyn BarFoo + 'static)` cannot be known at compilation time
-  --> $DIR/unsized-enum2.rs:59:18
+  --> $DIR/unsized-enum2.rs:59:21
    |
 LL |     VP{u: isize, x: dyn BarFoo},
-   |                  ^^^^^^^^^^^^^ doesn't have a size known at compile-time
+   |                     ^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `(dyn BarFoo + 'static)`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VP{u: isize, x: &dyn BarFoo},
+   |                     ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VP{u: isize, x: Box<dyn BarFoo>},
+   |                     ^^^^          ^
 
 error[E0277]: the size for values of type `[i8]` cannot be known at compilation time
   --> $DIR/unsized-enum2.rs:63:8
@@ -139,16 +247,34 @@ LL |     VQ(<&'static [i8] as Deref>::Target),
    = help: the trait `std::marker::Sized` is not implemented for `[i8]`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VQ(&<&'static [i8] as Deref>::Target),
+   |        ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VQ(Box<<&'static [i8] as Deref>::Target>),
+   |        ^^^^                                ^
 
 error[E0277]: the size for values of type `[char]` cannot be known at compilation time
-  --> $DIR/unsized-enum2.rs:65:8
+  --> $DIR/unsized-enum2.rs:65:11
    |
 LL |     VR{x: <&'static [char] as Deref>::Target},
-   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `[char]`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VR{x: &<&'static [char] as Deref>::Target},
+   |           ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VR{x: Box<<&'static [char] as Deref>::Target>},
+   |           ^^^^                                  ^
 
 error[E0277]: the size for values of type `[f64]` cannot be known at compilation time
   --> $DIR/unsized-enum2.rs:67:15
@@ -159,16 +285,34 @@ LL |     VS(isize, <&'static [f64] as Deref>::Target),
    = help: the trait `std::marker::Sized` is not implemented for `[f64]`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VS(isize, &<&'static [f64] as Deref>::Target),
+   |               ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VS(isize, Box<<&'static [f64] as Deref>::Target>),
+   |               ^^^^                                 ^
 
 error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
-  --> $DIR/unsized-enum2.rs:69:18
+  --> $DIR/unsized-enum2.rs:69:21
    |
 LL |     VT{u: isize, x: <&'static [i32] as Deref>::Target},
-   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `[i32]`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     VT{u: isize, x: &<&'static [i32] as Deref>::Target},
+   |                     ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VT{u: isize, x: Box<<&'static [i32] as Deref>::Target>},
+   |                     ^^^^                                 ^
 
 error[E0277]: the size for values of type `(dyn PathHelper1 + 'static)` cannot be known at compilation time
   --> $DIR/unsized-enum2.rs:43:8
@@ -180,17 +324,35 @@ LL |     VI(Path1),
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = note: required because it appears within the type `Path1`
    = 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 |     VI(&Path1),
+   |        ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VI(Box<Path1>),
+   |        ^^^^     ^
 
 error[E0277]: the size for values of type `(dyn PathHelper2 + 'static)` cannot be known at compilation time
-  --> $DIR/unsized-enum2.rs:45:8
+  --> $DIR/unsized-enum2.rs:45:11
    |
 LL |     VJ{x: Path2},
-   |        ^^^^^^^^ doesn't have a size known at compile-time
+   |           ^^^^^ doesn't have a size known at compile-time
    |
    = help: within `Path2`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper2 + 'static)`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = note: required because it appears within the type `Path2`
    = 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 |     VJ{x: &Path2},
+   |           ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VJ{x: Box<Path2>},
+   |           ^^^^     ^
 
 error[E0277]: the size for values of type `(dyn PathHelper3 + 'static)` cannot be known at compilation time
   --> $DIR/unsized-enum2.rs:47:15
@@ -202,17 +364,35 @@ LL |     VK(isize, Path3),
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = note: required because it appears within the type `Path3`
    = 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 |     VK(isize, &Path3),
+   |               ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VK(isize, Box<Path3>),
+   |               ^^^^     ^
 
 error[E0277]: the size for values of type `(dyn PathHelper4 + 'static)` cannot be known at compilation time
-  --> $DIR/unsized-enum2.rs:49:18
+  --> $DIR/unsized-enum2.rs:49:21
    |
 LL |     VL{u: isize, x: Path4},
-   |                  ^^^^^^^^ doesn't have a size known at compile-time
+   |                     ^^^^^ doesn't have a size known at compile-time
    |
    = help: within `Path4`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper4 + 'static)`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = note: required because it appears within the type `Path4`
    = 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 |     VL{u: isize, x: &Path4},
+   |                     ^
+help: heap allocated types always have a statically known size
+   |
+LL |     VL{u: isize, x: Box<Path4>},
+   |                     ^^^^     ^
 
 error: aborting due to 20 previous errors
 
index de4da309791c0d5a928e510f27c52292476c571f..3eef1f4f6771ebd2ef821a12ec87a1d0aa27e8ff 100644 (file)
@@ -1,47 +1,83 @@
 error[E0277]: the size for values of type `X` cannot be known at compilation time
-  --> $DIR/unsized5.rs:4:5
+  --> $DIR/unsized5.rs:4:9
    |
 LL | struct S1<X: ?Sized> {
    |           - this type parameter needs to be `std::marker::Sized`
 LL |     f1: X,
-   |     ^^^^^ doesn't have a size known at compile-time
+   |         ^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `X`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = note: only the last field of a struct 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 |     f1: &X,
+   |         ^
+help: heap allocated types always have a statically known size
+   |
+LL |     f1: Box<X>,
+   |         ^^^^ ^
 
 error[E0277]: the size for values of type `X` cannot be known at compilation time
-  --> $DIR/unsized5.rs:10:5
+  --> $DIR/unsized5.rs:10:8
    |
 LL | struct S2<X: ?Sized> {
    |           - this type parameter needs to be `std::marker::Sized`
 LL |     f: isize,
 LL |     g: X,
-   |     ^^^^ doesn't have a size known at compile-time
+   |        ^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `X`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = note: only the last field of a struct 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 |     g: &X,
+   |        ^
+help: heap allocated types always have a statically known size
+   |
+LL |     g: Box<X>,
+   |        ^^^^ ^
 
 error[E0277]: the size for values of type `str` cannot be known at compilation time
-  --> $DIR/unsized5.rs:15:5
+  --> $DIR/unsized5.rs:15:8
    |
 LL |     f: str,
-   |     ^^^^^^ doesn't have a size known at compile-time
+   |        ^^^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `str`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = note: only the last field of a struct 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 |     f: &str,
+   |        ^
+help: heap allocated types always have a statically known size
+   |
+LL |     f: Box<str>,
+   |        ^^^^   ^
 
 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
-  --> $DIR/unsized5.rs:20:5
+  --> $DIR/unsized5.rs:20:8
    |
 LL |     f: [u8],
-   |     ^^^^^^^ doesn't have a size known at compile-time
+   |        ^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `[u8]`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = note: only the last field of a struct 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 |     f: &[u8],
+   |        ^
+help: heap allocated types always have a statically known size
+   |
+LL |     f: Box<[u8]>,
+   |        ^^^^    ^
 
 error[E0277]: the size for values of type `X` cannot be known at compilation time
   --> $DIR/unsized5.rs:25:8
@@ -54,18 +90,36 @@ LL |     V1(X, isize),
    = help: the trait `std::marker::Sized` is not implemented for `X`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     V1(&X, isize),
+   |        ^
+help: heap allocated types always have a statically known size
+   |
+LL |     V1(Box<X>, isize),
+   |        ^^^^ ^
 
 error[E0277]: the size for values of type `X` cannot be known at compilation time
-  --> $DIR/unsized5.rs:29:8
+  --> $DIR/unsized5.rs:29:12
    |
 LL | enum F<X: ?Sized> {
    |        - this type parameter needs to be `std::marker::Sized`
 LL |     V2{f1: X, f: isize},
-   |        ^^^^^ doesn't have a size known at compile-time
+   |            ^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `X`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
    = 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 |     V2{f1: &X, f: isize},
+   |            ^
+help: heap allocated types always have a statically known size
+   |
+LL |     V2{f1: Box<X>, f: isize},
+   |            ^^^^ ^
 
 error: aborting due to 6 previous errors
 
index b222d07580eaf167c04f7d85f34f5357a493f548..b424c9f3ac981d578d365c88b2665c8c82e41630 100644 (file)
@@ -1,8 +1,8 @@
 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
-  --> $DIR/wf-array-elem-sized.rs:7:5
+  --> $DIR/wf-array-elem-sized.rs:7:10
    |
 LL |     foo: [[u8]],
-   |     ^^^^^^^^^^^ doesn't have a size known at compile-time
+   |          ^^^^^^ doesn't have a size known at compile-time
    |
    = help: the trait `std::marker::Sized` is not implemented for `[u8]`
    = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
index 0a3665fcf0436b191cff8afab827dbbb2868c1a8..1eb7010c77a79988e88589ad0f93444f90ec3eb4 100644 (file)
@@ -1,11 +1,11 @@
 error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied
-  --> $DIR/wf-enum-fields-struct-variant.rs:13:9
+  --> $DIR/wf-enum-fields-struct-variant.rs:13:12
    |
 LL | struct IsCopy<T:Copy> {
    |                 ---- required by this bound in `IsCopy`
 ...
 LL |         f: IsCopy<A>
-   |         ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A`
+   |            ^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A`
    |
 help: consider restricting type parameter `A`
    |
index c0bb3a50b1f1eb7a09e2f8246e4271703a3aff1e..212c61e1e5e07336f10cd5dac645d4c0923aac78 100644 (file)
@@ -1,11 +1,11 @@
 error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
-  --> $DIR/wf-in-fn-type-arg.rs:9:5
+  --> $DIR/wf-in-fn-type-arg.rs:9:8
    |
 LL | struct MustBeCopy<T:Copy> {
    |                     ---- required by this bound in `MustBeCopy`
 ...
 LL |     x: fn(MustBeCopy<T>)
-   |     ^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
+   |        ^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
    |
 help: consider restricting type parameter `T`
    |
index e203058250790776ea76103ab6bb71afdaaec627..3fb05fe81763bd4f5da0ec4516bd5e1036d7a231 100644 (file)
@@ -1,11 +1,11 @@
 error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
-  --> $DIR/wf-in-fn-type-ret.rs:9:5
+  --> $DIR/wf-in-fn-type-ret.rs:9:8
    |
 LL | struct MustBeCopy<T:Copy> {
    |                     ---- required by this bound in `MustBeCopy`
 ...
 LL |     x: fn() -> MustBeCopy<T>
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
+   |        ^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
    |
 help: consider restricting type parameter `T`
    |
index a79c446247794ad59a1fdbc56bfd1922059da488..44cacf4ef4dfe5d75fadd5041c0f93ed50af7178 100644 (file)
@@ -1,20 +1,20 @@
 error[E0310]: the parameter type `T` may not live long enough
-  --> $DIR/wf-in-fn-type-static.rs:13:5
+  --> $DIR/wf-in-fn-type-static.rs:13:8
    |
 LL | struct Foo<T> {
    |            - help: consider adding an explicit lifetime bound...: `T: 'static`
 LL |     // needs T: 'static
 LL |     x: fn() -> &'static T
-   |     ^^^^^^^^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
+   |        ^^^^^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
 
 error[E0310]: the parameter type `T` may not live long enough
-  --> $DIR/wf-in-fn-type-static.rs:18:5
+  --> $DIR/wf-in-fn-type-static.rs:18:8
    |
 LL | struct Bar<T> {
    |            - help: consider adding an explicit lifetime bound...: `T: 'static`
 LL |     // needs T: Copy
 LL |     x: fn(&'static T)
-   |     ^^^^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
+   |        ^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
 
 error: aborting due to 2 previous errors
 
index c0057f3c82977fd990fc09b3251108ec65239106..c50a6bb6e4d878939e0c963e3a3306dcf5d556c6 100644 (file)
@@ -1,11 +1,11 @@
 error[E0310]: the parameter type `T` may not live long enough
-  --> $DIR/wf-in-obj-type-static.rs:14:5
+  --> $DIR/wf-in-obj-type-static.rs:14:8
    |
 LL | struct Foo<T> {
    |            - help: consider adding an explicit lifetime bound...: `T: 'static`
 LL |     // needs T: 'static
 LL |     x: dyn Object<&'static T>
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
+   |        ^^^^^^^^^^^^^^^^^^^^^^ ...so that the reference type `&'static T` does not outlive the data it points at
 
 error: aborting due to previous error
 
index 6d85cdde7f99191552029c12d7d32a9671e9d29b..129f9484df29bef1993cfcec02bf9311fed5f650 100644 (file)
@@ -1,11 +1,11 @@
 error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
-  --> $DIR/wf-in-obj-type-trait.rs:11:5
+  --> $DIR/wf-in-obj-type-trait.rs:11:8
    |
 LL | struct MustBeCopy<T:Copy> {
    |                     ---- required by this bound in `MustBeCopy`
 ...
 LL |     x: dyn Object<MustBeCopy<T>>
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
+   |        ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
    |
 help: consider restricting type parameter `T`
    |
index cda3b8fe4fddb2a0b701afe67452b83490febb56..d7d0b7a0820a8739a344e97e126c8971e972bcea 100644 (file)
@@ -1,11 +1,11 @@
 error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied
-  --> $DIR/wf-struct-field.rs:12:5
+  --> $DIR/wf-struct-field.rs:12:11
    |
 LL | struct IsCopy<T:Copy> {
    |                 ---- required by this bound in `IsCopy`
 ...
 LL |     data: IsCopy<A>
-   |     ^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A`
+   |           ^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A`
    |
 help: consider restricting type parameter `A`
    |