From c88409de131f3a83f8343e4fa3a51ad78cc76e1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 10 Jul 2020 14:53:48 -0700 Subject: [PATCH 1/7] Suggest borrowing unsized argument types --- src/librustc_middle/traits/mod.rs | 2 +- src/librustc_middle/traits/structural_impls.rs | 2 +- .../traits/error_reporting/suggestions.rs | 18 +++++++++++++++--- src/librustc_typeck/check/expr.rs | 2 +- src/librustc_typeck/check/mod.rs | 5 +++-- src/test/ui/issues/issue-38954.stderr | 5 ++++- src/test/ui/issues/issue-41229-ref-str.stderr | 5 ++++- src/test/ui/issues/issue-42312.stderr | 10 ++++++++-- 8 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/librustc_middle/traits/mod.rs b/src/librustc_middle/traits/mod.rs index fc37cb2504daa..db81dc19c08f4 100644 --- a/src/librustc_middle/traits/mod.rs +++ b/src/librustc_middle/traits/mod.rs @@ -215,7 +215,7 @@ pub enum ObligationCauseCode<'tcx> { /// Type of each variable must be `Sized`. VariableType(hir::HirId), /// Argument type must be `Sized`. - SizedArgumentType, + SizedArgumentType(Option), /// Return type must be `Sized`. SizedReturnType, /// Yield type must be `Sized`. diff --git a/src/librustc_middle/traits/structural_impls.rs b/src/librustc_middle/traits/structural_impls.rs index faaa576f17903..e2a0e3dfa3057 100644 --- a/src/librustc_middle/traits/structural_impls.rs +++ b/src/librustc_middle/traits/structural_impls.rs @@ -151,7 +151,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> { super::VariableType(id) => Some(super::VariableType(id)), super::ReturnValue(id) => Some(super::ReturnValue(id)), super::ReturnType => Some(super::ReturnType), - super::SizedArgumentType => Some(super::SizedArgumentType), + super::SizedArgumentType(sp) => Some(super::SizedArgumentType(sp)), super::SizedReturnType => Some(super::SizedReturnType), super::SizedYieldType => Some(super::SizedYieldType), super::InlineAsmSized => Some(super::InlineAsmSized), diff --git a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs index d677d84b2ba13..3c3b5bdf59ccf 100644 --- a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs +++ b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs @@ -1823,9 +1823,21 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { err.help("unsized locals are gated as an unstable feature"); } } - ObligationCauseCode::SizedArgumentType => { - err.note("all function arguments must have a statically known size"); - if !self.tcx.features().unsized_locals { + ObligationCauseCode::SizedArgumentType(sp) => { + if let Some(span) = sp { + err.span_suggestion_verbose( + span.shrink_to_lo(), + "function arguments must have a statically known size, borrowed types \ + always have a known size", + "&".to_string(), + Applicability::MachineApplicable, + ); + } else { + err.note("all function arguments must have a statically known size"); + } + if tcx.sess.opts.unstable_features.is_nightly_build() + && !self.tcx.features().unsized_locals + { err.help("unsized locals are gated as an unstable feature"); } } diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index e6b51f4c2cd2a..3956e91a16734 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -487,7 +487,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.require_type_is_sized_deferred( input, expr.span, - traits::SizedArgumentType, + traits::SizedArgumentType(None), ); } } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index fa7360ce90051..aa768f1d251b5 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1342,14 +1342,15 @@ fn check_fn<'a, 'tcx>( let inputs_fn = fn_sig.inputs().iter().copied(); for (idx, (param_ty, param)) in inputs_fn.chain(maybe_va_list).zip(body.params).enumerate() { // Check the pattern. - fcx.check_pat_top(¶m.pat, param_ty, try { inputs_hir?.get(idx)?.span }, false); + let ty_span = try { inputs_hir?.get(idx)?.span }; + fcx.check_pat_top(¶m.pat, param_ty, ty_span, false); // Check that argument is Sized. // The check for a non-trivial pattern is a hack to avoid duplicate warnings // for simple cases like `fn foo(x: Trait)`, // where we would error once on the parameter as a whole, and once on the binding `x`. if param.pat.simple_ident().is_none() && !tcx.features().unsized_locals { - fcx.require_type_is_sized(param_ty, param.pat.span, traits::SizedArgumentType); + fcx.require_type_is_sized(param_ty, param.pat.span, traits::SizedArgumentType(ty_span)); } fcx.write_ty(param.hir_id, param_ty); diff --git a/src/test/ui/issues/issue-38954.stderr b/src/test/ui/issues/issue-38954.stderr index d3168ef9e4aaf..93133bc94bbcf 100644 --- a/src/test/ui/issues/issue-38954.stderr +++ b/src/test/ui/issues/issue-38954.stderr @@ -6,8 +6,11 @@ LL | fn _test(ref _p: str) {} | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit - = note: all function arguments must have a statically known size = help: unsized locals are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn _test(ref _p: &str) {} + | ^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-41229-ref-str.stderr b/src/test/ui/issues/issue-41229-ref-str.stderr index 9d854e4be9ead..1b908ca49de43 100644 --- a/src/test/ui/issues/issue-41229-ref-str.stderr +++ b/src/test/ui/issues/issue-41229-ref-str.stderr @@ -6,8 +6,11 @@ LL | pub fn example(ref s: str) {} | = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit - = note: all function arguments must have a statically known size = help: unsized locals are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | pub fn example(ref s: &str) {} + | ^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-42312.stderr b/src/test/ui/issues/issue-42312.stderr index 0d4797a7a0673..58eb3afee81de 100644 --- a/src/test/ui/issues/issue-42312.stderr +++ b/src/test/ui/issues/issue-42312.stderr @@ -6,12 +6,15 @@ LL | fn baz(_: Self::Target) where Self: Deref {} | = help: the trait `std::marker::Sized` is not implemented for `::Target` = note: to learn more, visit - = note: all function arguments must have a statically known size = help: unsized locals are gated as an unstable feature help: consider further restricting the associated type | LL | fn baz(_: Self::Target) where Self: Deref, ::Target: std::marker::Sized {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn baz(_: &Self::Target) where Self: Deref {} + | ^ error[E0277]: the size for values of type `(dyn std::string::ToString + 'static)` cannot be known at compilation time --> $DIR/issue-42312.rs:8:10 @@ -21,8 +24,11 @@ LL | pub fn f(_: dyn ToString) {} | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::string::ToString + 'static)` = note: to learn more, visit - = note: all function arguments must have a statically known size = help: unsized locals are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | pub fn f(_: &dyn ToString) {} + | ^ error: aborting due to 2 previous errors From a15bda4036b194a36a91a4011220c10547b13628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 10 Jul 2020 14:54:48 -0700 Subject: [PATCH 2/7] Point at type on E0275 instead of whole field --- src/librustc_typeck/check/wfcheck.rs | 2 +- src/test/ui/traits/cycle-cache-err-60010.stderr | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index d1a86a7ee89a8..a641b881e3186 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -1326,7 +1326,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .iter() .map(|field| { let field_ty = self.tcx.type_of(self.tcx.hir().local_def_id(field.hir_id)); - let field_ty = self.normalize_associated_types_in(field.span, &field_ty); + 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 } diff --git a/src/test/ui/traits/cycle-cache-err-60010.stderr b/src/test/ui/traits/cycle-cache-err-60010.stderr index 3188ee83e7d39..324316ceaf6ba 100644 --- a/src/test/ui/traits/cycle-cache-err-60010.stderr +++ b/src/test/ui/traits/cycle-cache-err-60010.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow evaluating the requirement `RootDatabase: SourceDatabase` - --> $DIR/cycle-cache-err-60010.rs:27:5 + --> $DIR/cycle-cache-err-60010.rs:27:13 | LL | _parse: >::Data, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: required because of the requirements on the impl of `Query` for `ParseQuery` From 28e6f1f5b9370334271042638e7e368319152d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 10 Jul 2020 15:13:49 -0700 Subject: [PATCH 3/7] Suggest boxing or borrowing unsized fields --- src/librustc_middle/traits/mod.rs | 1 + .../traits/structural_impls.rs | 4 +- .../traits/error_reporting/suggestions.rs | 53 +++-- src/librustc_typeck/check/wfcheck.rs | 3 +- .../array-size-in-generic-struct-param.stderr | 4 +- src/test/ui/error-codes/E0478.stderr | 4 +- ...-infer_static_outlives_requirements.stderr | 4 +- src/test/ui/issues/issue-19380.stderr | 4 +- src/test/ui/issues/issue-22874.stderr | 4 +- src/test/ui/issues/issue-27060-2.stderr | 13 +- src/test/ui/issues/issue-35988.stderr | 9 + .../issue-57739.stderr | 4 +- .../lifetime-doesnt-live-long-enough.stderr | 4 +- ...unds-on-objects-and-type-parameters.stderr | 4 +- .../ui/regions/regions-wf-trait-object.stderr | 4 +- .../dont-infer-static.stderr | 4 +- ...adt-param-with-implicit-sized-bound.stderr | 4 +- .../trait-bounds-on-structs-and-enums.stderr | 12 +- src/test/ui/union/union-sized-field.stderr | 35 ++- src/test/ui/union/union-unsized.stderr | 26 ++- src/test/ui/unsized/unsized-enum2.stderr | 220 ++++++++++++++++-- src/test/ui/unsized5.stderr | 74 +++++- src/test/ui/wf/wf-array-elem-sized.stderr | 4 +- .../wf/wf-enum-fields-struct-variant.stderr | 4 +- src/test/ui/wf/wf-in-fn-type-arg.stderr | 4 +- src/test/ui/wf/wf-in-fn-type-ret.stderr | 4 +- src/test/ui/wf/wf-in-fn-type-static.stderr | 8 +- src/test/ui/wf/wf-in-obj-type-static.stderr | 4 +- src/test/ui/wf/wf-in-obj-type-trait.stderr | 4 +- src/test/ui/wf/wf-struct-field.stderr | 4 +- 30 files changed, 424 insertions(+), 106 deletions(-) diff --git a/src/librustc_middle/traits/mod.rs b/src/librustc_middle/traits/mod.rs index db81dc19c08f4..c15c31a53f0c9 100644 --- a/src/librustc_middle/traits/mod.rs +++ b/src/librustc_middle/traits/mod.rs @@ -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, }, diff --git a/src/librustc_middle/traits/structural_impls.rs b/src/librustc_middle/traits/structural_impls.rs index e2a0e3dfa3057..334462790edbc 100644 --- a/src/librustc_middle/traits/structural_impls.rs +++ b/src/librustc_middle/traits/structural_impls.rs @@ -156,7 +156,9 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> { 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), diff --git a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs index 3c3b5bdf59ccf..3daa5b3b1abdc 100644 --- a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs +++ b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs @@ -1856,26 +1856,43 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { 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"); } diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index a641b881e3186..19c556942afc1 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -394,6 +394,7 @@ fn check_type_defn<'tcx, F>( Some(i) => i, None => bug!(), }, + span: field.span, last, }, ), @@ -1329,7 +1330,7 @@ impl<'a, 'tcx> FnCtxt<'a, '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 } diff --git a/src/test/ui/const-generics/array-size-in-generic-struct-param.stderr b/src/test/ui/const-generics/array-size-in-generic-struct-param.stderr index 14cf64eeb7ac6..ad67a87265bd3 100644 --- a/src/test/ui/const-generics/array-size-in-generic-struct-param.stderr +++ b/src/test/ui/const-generics/array-size-in-generic-struct-param.stderr @@ -16,10 +16,10 @@ LL | struct ArithArrayLen([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 diff --git a/src/test/ui/error-codes/E0478.stderr b/src/test/ui/error-codes/E0478.stderr index 1380840e0db2d..38736de8d9ac7 100644 --- a/src/test/ui/error-codes/E0478.stderr +++ b/src/test/ui/error-codes/E0478.stderr @@ -1,8 +1,8 @@ error[E0478]: lifetime bound not satisfied - --> $DIR/E0478.rs:4:5 + --> $DIR/E0478.rs:4:12 | LL | child: Box + 'SnowWhite>, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime `'SnowWhite` as defined on the struct at 3:22 --> $DIR/E0478.rs:3:22 diff --git a/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr b/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr index 2beeba8184a7d..987cde191cbb9 100644 --- a/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr +++ b/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr @@ -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 { | - help: consider adding an explicit lifetime bound...: `U: 'static` LL | bar: Bar - | ^^^^^^^^^^^ ...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 diff --git a/src/test/ui/issues/issue-19380.stderr b/src/test/ui/issues/issue-19380.stderr index 0a080171a7951..63f0701974b8b 100644 --- a/src/test/ui/issues/issue-19380.stderr +++ b/src/test/ui/issues/issue-19380.stderr @@ -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 | diff --git a/src/test/ui/issues/issue-22874.stderr b/src/test/ui/issues/issue-22874.stderr index 229f99f90640b..9a74bc0313169 100644 --- a/src/test/ui/issues/issue-22874.stderr +++ b/src/test/ui/issues/issue-22874.stderr @@ -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 diff --git a/src/test/ui/issues/issue-27060-2.stderr b/src/test/ui/issues/issue-27060-2.stderr index 1ddea73e00ae0..8b64128fb01da 100644 --- a/src/test/ui/issues/issue-27060-2.stderr +++ b/src/test/ui/issues/issue-27060-2.stderr @@ -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 { | - 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 = 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, + | ^^^^ ^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-35988.stderr b/src/test/ui/issues/issue-35988.stderr index 825c0de5e53ea..52660eb7cdac9 100644 --- a/src/test/ui/issues/issue-35988.stderr +++ b/src/test/ui/issues/issue-35988.stderr @@ -7,6 +7,15 @@ LL | V([Box]), = help: the trait `std::marker::Sized` is not implemented for `[std::boxed::Box]` = note: to learn more, visit = 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]), + | ^ +help: heap allocated types always have a statically known size + | +LL | V(Box<[Box]>), + | ^^^^ ^ error: aborting due to previous error diff --git a/src/test/ui/lazy_normalization_consts/issue-57739.stderr b/src/test/ui/lazy_normalization_consts/issue-57739.stderr index 1987f5890c041..ce0495dd8b0cb 100644 --- a/src/test/ui/lazy_normalization_consts/issue-57739.stderr +++ b/src/test/ui/lazy_normalization_consts/issue-57739.stderr @@ -8,10 +8,10 @@ LL | #![feature(lazy_normalization_consts)] = note: see issue #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 diff --git a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr index d682478db0eef..e5083e3a088b6 100644 --- a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr +++ b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr @@ -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 { | - 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 diff --git a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr index ea9be77a3e8b5..22586b5de91ff 100644 --- a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr +++ b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr @@ -5,10 +5,10 @@ LL | z: Box+'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+'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 diff --git a/src/test/ui/regions/regions-wf-trait-object.stderr b/src/test/ui/regions/regions-wf-trait-object.stderr index 9f39508604110..1ddbf73a46372 100644 --- a/src/test/ui/regions/regions-wf-trait-object.stderr +++ b/src/test/ui/regions/regions-wf-trait-object.stderr @@ -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+'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 diff --git a/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr b/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr index 2bb51731583a6..a449fac11930d 100644 --- a/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr @@ -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 { | - help: consider adding an explicit lifetime bound...: `U: 'static` LL | bar: Bar - | ^^^^^^^^^^^ ...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 diff --git a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr index ee08f51f80270..03877e60e2b72 100644 --- a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr +++ b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr @@ -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); | - required by this bound in `X` @@ -7,7 +7,7 @@ LL | struct X(T); LL | struct Struct5{ | - this type parameter needs to be `std::marker::Sized` LL | _t: 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 `T` = note: to learn more, visit diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr index 271ed07ce42ab..d7549835a0905 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr @@ -13,13 +13,13 @@ LL | impl Foo { | ^^^^^^^ 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 { | ----- required by this bound in `Foo` ... LL | a: Foo, - | ^^^^^^^^^^^^^ 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), | ^^^^^^^^^^ 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 { | ----- required by this bound in `Foo` ... LL | b: Foo, - | ^^^^^^^^^ 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, | ^^^^^^^^ 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 { | ----- required by this bound in `Bar` ... LL | DictionaryLike { field: Bar }, - | ^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u8` + | ^^^^^^^ the trait `Trait` is not implemented for `u8` error: aborting due to 7 previous errors diff --git a/src/test/ui/union/union-sized-field.stderr b/src/test/ui/union/union-sized-field.stderr index 62dacd064bed0..1bfc44e3eec62 100644 --- a/src/test/ui/union/union-sized-field.stderr +++ b/src/test/ui/union/union-sized-field.stderr @@ -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 { | - 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 = 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, + | ^^^^ ^ 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 { | - 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 = 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, + | ^^^^ ^ 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 = 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), + | ^^^^ ^ error: aborting due to 3 previous errors diff --git a/src/test/ui/union/union-unsized.stderr b/src/test/ui/union/union-unsized.stderr index e702f2c61bee3..442ea83f80168 100644 --- a/src/test/ui/union/union-unsized.stderr +++ b/src/test/ui/union/union-unsized.stderr @@ -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 = 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, + | ^^^^ ^ 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 = 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, + | ^^^^ ^ error: aborting due to 2 previous errors diff --git a/src/test/ui/unsized/unsized-enum2.stderr b/src/test/ui/unsized/unsized-enum2.stderr index bc3b3831f3269..fb89a6f45d234 100644 --- a/src/test/ui/unsized/unsized-enum2.stderr +++ b/src/test/ui/unsized/unsized-enum2.stderr @@ -10,19 +10,37 @@ LL | VA(W), = help: the trait `std::marker::Sized` is not implemented for `W` = note: to learn more, visit = 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), + | ^^^^ ^ 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 { | - 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 = 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}, + | ^^^^ ^ 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 = 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), + | ^^^^ ^ 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 { | - 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 = 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}, + | ^^^^ ^ 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 = 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 = 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}, + | ^^^^ ^ 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 = 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 = 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 = 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), + | ^^^^ ^ 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 = 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}, + | ^^^^ ^ 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 = 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), + | ^^^^ ^ 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 = 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}, + | ^^^^ ^ 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 = 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 = 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 = 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 = 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 = 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), + | ^^^^ ^ 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 = 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}, + | ^^^^ ^ 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 = 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), + | ^^^^ ^ 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 = 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}, + | ^^^^ ^ error: aborting due to 20 previous errors diff --git a/src/test/ui/unsized5.stderr b/src/test/ui/unsized5.stderr index de4da309791c0..3eef1f4f6771e 100644 --- a/src/test/ui/unsized5.stderr +++ b/src/test/ui/unsized5.stderr @@ -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 { | - 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 = 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, + | ^^^^ ^ 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 { | - 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 = 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, + | ^^^^ ^ 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 = 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, + | ^^^^ ^ 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 = 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 = 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, 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 { | - 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 = 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, f: isize}, + | ^^^^ ^ error: aborting due to 6 previous errors diff --git a/src/test/ui/wf/wf-array-elem-sized.stderr b/src/test/ui/wf/wf-array-elem-sized.stderr index b222d07580eaf..b424c9f3ac981 100644 --- a/src/test/ui/wf/wf-array-elem-sized.stderr +++ b/src/test/ui/wf/wf-array-elem-sized.stderr @@ -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 diff --git a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr index 0a3665fcf0436..1eb7010c77a79 100644 --- a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr +++ b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr @@ -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 { | ---- required by this bound in `IsCopy` ... LL | f: IsCopy - | ^^^^^^^^^^^^ 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` | diff --git a/src/test/ui/wf/wf-in-fn-type-arg.stderr b/src/test/ui/wf/wf-in-fn-type-arg.stderr index c0bb3a50b1f1e..212c61e1e5e07 100644 --- a/src/test/ui/wf/wf-in-fn-type-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-type-arg.stderr @@ -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 { | ---- required by this bound in `MustBeCopy` ... LL | x: fn(MustBeCopy) - | ^^^^^^^^^^^^^^^^^^^^ 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` | diff --git a/src/test/ui/wf/wf-in-fn-type-ret.stderr b/src/test/ui/wf/wf-in-fn-type-ret.stderr index e203058250790..3fb05fe81763b 100644 --- a/src/test/ui/wf/wf-in-fn-type-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-type-ret.stderr @@ -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 { | ---- required by this bound in `MustBeCopy` ... LL | x: fn() -> MustBeCopy - | ^^^^^^^^^^^^^^^^^^^^^^^^ 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` | diff --git a/src/test/ui/wf/wf-in-fn-type-static.stderr b/src/test/ui/wf/wf-in-fn-type-static.stderr index a79c446247794..44cacf4ef4dfe 100644 --- a/src/test/ui/wf/wf-in-fn-type-static.stderr +++ b/src/test/ui/wf/wf-in-fn-type-static.stderr @@ -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 { | - 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 { | - 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 diff --git a/src/test/ui/wf/wf-in-obj-type-static.stderr b/src/test/ui/wf/wf-in-obj-type-static.stderr index c0057f3c82977..c50a6bb6e4d87 100644 --- a/src/test/ui/wf/wf-in-obj-type-static.stderr +++ b/src/test/ui/wf/wf-in-obj-type-static.stderr @@ -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 { | - 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 diff --git a/src/test/ui/wf/wf-in-obj-type-trait.stderr b/src/test/ui/wf/wf-in-obj-type-trait.stderr index 6d85cdde7f991..129f9484df29b 100644 --- a/src/test/ui/wf/wf-in-obj-type-trait.stderr +++ b/src/test/ui/wf/wf-in-obj-type-trait.stderr @@ -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 { | ---- required by this bound in `MustBeCopy` ... LL | x: dyn Object> - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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` | diff --git a/src/test/ui/wf/wf-struct-field.stderr b/src/test/ui/wf/wf-struct-field.stderr index cda3b8fe4fddb..d7d0b7a0820a8 100644 --- a/src/test/ui/wf/wf-struct-field.stderr +++ b/src/test/ui/wf/wf-struct-field.stderr @@ -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 { | ---- required by this bound in `IsCopy` ... LL | data: IsCopy - | ^^^^^^^^^^^^^^^ 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` | From b7db6bb5af8187ccb9be1076dd99d3cbb7fd8fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 10 Jul 2020 16:05:35 -0700 Subject: [PATCH 4/7] Remove `Sized` `on_unimplemented` note --- src/libcore/marker.rs | 5 +---- src/test/ui/asm/type-check-1.stderr | 3 --- .../associated-types-unsized.stderr | 1 - .../defaults-suitability.stderr | 1 - .../ui/associated-types/issue-63593.stderr | 1 - ...with-supertraits-needing-sized-self.stderr | 1 - .../issue-72590-type-error-sized.stderr | 1 - src/test/ui/bad/bad-sized.stderr | 2 -- src/test/ui/box-into-boxed-slice-fail.stderr | 4 ---- src/test/ui/chalkify/impl_wf.stderr | 1 - src/test/ui/consts/const-unsized.stderr | 4 ---- src/test/ui/dst/dst-bad-assign-2.stderr | 1 - src/test/ui/dst/dst-bad-assign-3.stderr | 1 - src/test/ui/dst/dst-bad-assign.stderr | 1 - src/test/ui/dst/dst-bad-deep-2.stderr | 1 - src/test/ui/dst/dst-bad-deep.stderr | 1 - .../dst/dst-object-from-unsized-type.stderr | 4 ---- src/test/ui/dst/dst-sized-trait-param.stderr | 2 -- src/test/ui/error-codes/E0277.stderr | 3 +-- .../ui/extern/extern-types-unsized.stderr | 4 ---- .../issue-36122-accessing-externed-dst.stderr | 1 - .../feature-gate-trivial_bounds.stderr | 3 --- .../feature-gate-unsized_locals.stderr | 1 - src/test/ui/generator/sized-yield.stderr | 2 -- ...e-param-can-reference-self-in-trait.stderr | 1 - ...n-trait-return-should-be-impl-trait.stderr | 2 -- src/test/ui/issues/issue-10412.stderr | 1 - src/test/ui/issues/issue-14366.stderr | 1 - src/test/ui/issues/issue-15756.stderr | 1 - src/test/ui/issues/issue-17651.stderr | 2 -- src/test/ui/issues/issue-18919.stderr | 1 - src/test/ui/issues/issue-20005.stderr | 1 - src/test/ui/issues/issue-20433.stderr | 1 - src/test/ui/issues/issue-20605.stderr | 1 - src/test/ui/issues/issue-22874.stderr | 1 - src/test/ui/issues/issue-23281.stderr | 1 - src/test/ui/issues/issue-24446.stderr | 1 - src/test/ui/issues/issue-27060-2.stderr | 1 - src/test/ui/issues/issue-27078.stderr | 1 - src/test/ui/issues/issue-30355.stderr | 1 - src/test/ui/issues/issue-35988.stderr | 1 - src/test/ui/issues/issue-38954.stderr | 1 - src/test/ui/issues/issue-41229-ref-str.stderr | 1 - src/test/ui/issues/issue-42312.stderr | 2 -- src/test/ui/issues/issue-54410.stderr | 1 - src/test/ui/issues/issue-5883.stderr | 2 -- src/test/ui/issues/issue-65673.stderr | 1 - ...ture-gate-lazy_normalization_consts.stderr | 1 - .../ui/mismatched_types/cast-rfc0401.stderr | 2 -- src/test/ui/range/range-1.stderr | 1 - src/test/ui/resolve/issue-5035-2.stderr | 1 - src/test/ui/str/str-array-assignment.stderr | 1 - src/test/ui/str/str-mut-idx.stderr | 2 -- src/test/ui/substs-ppaux.normal.stderr | 1 - src/test/ui/substs-ppaux.verbose.stderr | 1 - ...adt-param-with-implicit-sized-bound.stderr | 5 ----- src/test/ui/suggestions/path-by-value.stderr | 3 +-- .../trait-bounds-not-on-bare-trait.stderr | 1 - .../traits/trait-suggest-where-clause.stderr | 4 ---- .../trivial-bounds/trivial-bounds-leak.stderr | 1 - src/test/ui/union/union-sized-field.stderr | 3 --- src/test/ui/union/union-unsized.stderr | 2 -- .../issue-30276-feature-flagged.stderr | 1 - src/test/ui/unsized-locals/issue-30276.stderr | 1 - .../issue-50940-with-feature.stderr | 1 - src/test/ui/unsized-locals/issue-50940.stderr | 1 - .../ui/unsized-locals/unsized-exprs.stderr | 3 --- .../ui/unsized-locals/unsized-exprs3.stderr | 1 - .../ui/unsized/unsized-bare-typaram.stderr | 1 - src/test/ui/unsized/unsized-enum.stderr | 1 - src/test/ui/unsized/unsized-enum2.stderr | 20 ------------------- src/test/ui/unsized/unsized-fn-param.stderr | 4 ---- .../unsized-inherent-impl-self-type.stderr | 1 - src/test/ui/unsized/unsized-struct.stderr | 2 -- .../unsized-trait-impl-self-type.stderr | 1 - .../unsized-trait-impl-trait-arg.stderr | 1 - src/test/ui/unsized3.stderr | 6 ------ src/test/ui/unsized5.stderr | 6 ------ src/test/ui/unsized6.stderr | 13 ------------ src/test/ui/unsized7.stderr | 1 - src/test/ui/wf/wf-array-elem-sized.stderr | 1 - src/test/ui/wf/wf-fn-where-clause.stderr | 1 - 82 files changed, 3 insertions(+), 169 deletions(-) diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index fdcfae8530a3b..6ddd41a26f122 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -84,11 +84,8 @@ impl !Send for *mut T {} #[stable(feature = "rust1", since = "1.0.0")] #[lang = "sized"] #[rustc_on_unimplemented( - on(parent_trait = "std::path::Path", label = "borrow the `Path` instead"), message = "the size for values of type `{Self}` cannot be known at compilation time", - label = "doesn't have a size known at compile-time", - note = "to learn more, visit " + label = "doesn't have a size known at compile-time" )] #[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable #[rustc_specialization_trait] diff --git a/src/test/ui/asm/type-check-1.stderr b/src/test/ui/asm/type-check-1.stderr index 7c9c041f45784..1f11d19c70ea2 100644 --- a/src/test/ui/asm/type-check-1.stderr +++ b/src/test/ui/asm/type-check-1.stderr @@ -17,7 +17,6 @@ LL | asm!("{}", in(reg) v[..]); | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u64]` - = note: to learn more, visit = note: all inline asm arguments must have a statically known size error[E0277]: the size for values of type `[u64]` cannot be known at compilation time @@ -27,7 +26,6 @@ LL | asm!("{}", out(reg) v[..]); | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u64]` - = note: to learn more, visit = note: all inline asm arguments must have a statically known size error[E0277]: the size for values of type `[u64]` cannot be known at compilation time @@ -37,7 +35,6 @@ LL | asm!("{}", inout(reg) v[..]); | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u64]` - = note: to learn more, visit = note: all inline asm arguments must have a statically known size error: aborting due to 5 previous errors diff --git a/src/test/ui/associated-types/associated-types-unsized.stderr b/src/test/ui/associated-types/associated-types-unsized.stderr index 6daba54ac6969..e96d0e0eff719 100644 --- a/src/test/ui/associated-types/associated-types-unsized.stderr +++ b/src/test/ui/associated-types/associated-types-unsized.stderr @@ -5,7 +5,6 @@ LL | let x = t.get(); | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `::Value` - = note: to learn more, visit = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature help: consider further restricting the associated type diff --git a/src/test/ui/associated-types/defaults-suitability.stderr b/src/test/ui/associated-types/defaults-suitability.stderr index 8676c1fa22319..de0acc88324a5 100644 --- a/src/test/ui/associated-types/defaults-suitability.stderr +++ b/src/test/ui/associated-types/defaults-suitability.stderr @@ -139,7 +139,6 @@ LL | pub struct Vec { | - required by this bound in `std::vec::Vec` | = help: the trait `std::marker::Sized` is not implemented for `[u8]` - = note: to learn more, visit error: aborting due to 11 previous errors diff --git a/src/test/ui/associated-types/issue-63593.stderr b/src/test/ui/associated-types/issue-63593.stderr index 82e76ff0b7cb5..c3db950c75844 100644 --- a/src/test/ui/associated-types/issue-63593.stderr +++ b/src/test/ui/associated-types/issue-63593.stderr @@ -7,7 +7,6 @@ LL | type This = Self; | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Self` - = note: to learn more, visit help: consider further restricting `Self` | LL | trait MyTrait: std::marker::Sized { diff --git a/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr b/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr index a37573dffff44..f2ed2d32bd1e0 100644 --- a/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr +++ b/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr @@ -10,7 +10,6 @@ LL | pub trait Add { | --- required by this bound in `std::ops::Add` | = help: the trait `std::marker::Sized` is not implemented for `Self` - = note: to learn more, visit help: consider further restricting `Self` | LL | trait ArithmeticOps: Add + Sub + Mul + Div + std::marker::Sized {} diff --git a/src/test/ui/async-await/issue-72590-type-error-sized.stderr b/src/test/ui/async-await/issue-72590-type-error-sized.stderr index 603895b598c16..95ed9513f357b 100644 --- a/src/test/ui/async-await/issue-72590-type-error-sized.stderr +++ b/src/test/ui/async-await/issue-72590-type-error-sized.stderr @@ -17,7 +17,6 @@ LL | async fn frob(self) {} | ^^^^ doesn't have a size known at compile-time | = help: within `Foo`, the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit = note: required because it appears within the type `Foo` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/bad/bad-sized.stderr b/src/test/ui/bad/bad-sized.stderr index 5c169af4eb8ae..47d8cc1f06fd1 100644 --- a/src/test/ui/bad/bad-sized.stderr +++ b/src/test/ui/bad/bad-sized.stderr @@ -21,7 +21,6 @@ LL | pub struct Vec { | - required by this bound in `std::vec::Vec` | = help: the trait `std::marker::Sized` is not implemented for `dyn Trait` - = note: to learn more, visit error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time --> $DIR/bad-sized.rs:4:37 @@ -30,7 +29,6 @@ LL | let x: Vec = Vec::new(); | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn Trait` - = note: to learn more, visit = note: required by `std::vec::Vec::::new` error: aborting due to 3 previous errors diff --git a/src/test/ui/box-into-boxed-slice-fail.stderr b/src/test/ui/box-into-boxed-slice-fail.stderr index dfc4999958a57..b3e7b5b4feea4 100644 --- a/src/test/ui/box-into-boxed-slice-fail.stderr +++ b/src/test/ui/box-into-boxed-slice-fail.stderr @@ -5,7 +5,6 @@ LL | let _ = Box::into_boxed_slice(boxed_slice); | ^^^^^^^^^^^ 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 = note: required by `std::boxed::Box::::into_boxed_slice` error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -15,7 +14,6 @@ LL | let _ = Box::into_boxed_slice(boxed_slice); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 = note: slice and array elements must have `Sized` type error[E0277]: the size for values of type `dyn std::fmt::Debug` cannot be known at compilation time @@ -25,7 +23,6 @@ LL | let _ = Box::into_boxed_slice(boxed_trait); | ^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn std::fmt::Debug` - = note: to learn more, visit = note: required by `std::boxed::Box::::into_boxed_slice` error[E0277]: the size for values of type `dyn std::fmt::Debug` cannot be known at compilation time @@ -35,7 +32,6 @@ LL | let _ = Box::into_boxed_slice(boxed_trait); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn std::fmt::Debug` - = note: to learn more, visit = note: slice and array elements must have `Sized` type error: aborting due to 4 previous errors diff --git a/src/test/ui/chalkify/impl_wf.stderr b/src/test/ui/chalkify/impl_wf.stderr index e5d7615e43e31..fb2e0fc1a6169 100644 --- a/src/test/ui/chalkify/impl_wf.stderr +++ b/src/test/ui/chalkify/impl_wf.stderr @@ -8,7 +8,6 @@ LL | impl Foo for str { } | ^^^ 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 error[E0277]: the trait bound `f32: Foo` is not satisfied --> $DIR/impl_wf.rs:27:17 diff --git a/src/test/ui/consts/const-unsized.stderr b/src/test/ui/consts/const-unsized.stderr index beeea87bfb1d3..bf2844cfb70d6 100644 --- a/src/test/ui/consts/const-unsized.stderr +++ b/src/test/ui/consts/const-unsized.stderr @@ -5,7 +5,6 @@ LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync)); | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)` - = note: to learn more, visit error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/const-unsized.rs:6:18 @@ -14,7 +13,6 @@ LL | const CONST_FOO: str = *"foo"; | ^^^ 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 error[E0277]: the size for values of type `(dyn std::fmt::Debug + std::marker::Sync + 'static)` cannot be known at compilation time --> $DIR/const-unsized.rs:9:18 @@ -23,7 +21,6 @@ LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync)); | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)` - = note: to learn more, visit error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/const-unsized.rs:12:20 @@ -32,7 +29,6 @@ LL | static STATIC_BAR: str = *"bar"; | ^^^ 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 error: aborting due to 4 previous errors diff --git a/src/test/ui/dst/dst-bad-assign-2.stderr b/src/test/ui/dst/dst-bad-assign-2.stderr index 4e1e67c7f4809..a5374aedab86b 100644 --- a/src/test/ui/dst/dst-bad-assign-2.stderr +++ b/src/test/ui/dst/dst-bad-assign-2.stderr @@ -5,7 +5,6 @@ LL | f5.ptr = *z; | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn ToBar` - = note: to learn more, visit = note: the left-hand-side of an assignment must have a statically known size error: aborting due to previous error diff --git a/src/test/ui/dst/dst-bad-assign-3.stderr b/src/test/ui/dst/dst-bad-assign-3.stderr index 0b6f9df2d83ee..f8d9300f11a31 100644 --- a/src/test/ui/dst/dst-bad-assign-3.stderr +++ b/src/test/ui/dst/dst-bad-assign-3.stderr @@ -14,7 +14,6 @@ LL | f5.2 = Bar1 {f: 36}; | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn ToBar` - = note: to learn more, visit = note: the left-hand-side of an assignment must have a statically known size error: aborting due to 2 previous errors diff --git a/src/test/ui/dst/dst-bad-assign.stderr b/src/test/ui/dst/dst-bad-assign.stderr index 434c460759fb4..8e3eeefb9ea66 100644 --- a/src/test/ui/dst/dst-bad-assign.stderr +++ b/src/test/ui/dst/dst-bad-assign.stderr @@ -14,7 +14,6 @@ LL | f5.ptr = Bar1 {f: 36}; | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn ToBar` - = note: to learn more, visit = note: the left-hand-side of an assignment must have a statically known size error: aborting due to 2 previous errors diff --git a/src/test/ui/dst/dst-bad-deep-2.stderr b/src/test/ui/dst/dst-bad-deep-2.stderr index cb2735147a35b..d9d6ca3292311 100644 --- a/src/test/ui/dst/dst-bad-deep-2.stderr +++ b/src/test/ui/dst/dst-bad-deep-2.stderr @@ -5,7 +5,6 @@ LL | let h: &(([isize],),) = &(*g,); | ^^^^^ doesn't have a size known at compile-time | = help: within `(([isize],),)`, the trait `std::marker::Sized` is not implemented for `[isize]` - = note: to learn more, visit = note: required because it appears within the type `([isize],)` = note: required because it appears within the type `(([isize],),)` = note: tuples must have a statically known size to be initialized diff --git a/src/test/ui/dst/dst-bad-deep.stderr b/src/test/ui/dst/dst-bad-deep.stderr index 521adf601cc70..1304f04f82062 100644 --- a/src/test/ui/dst/dst-bad-deep.stderr +++ b/src/test/ui/dst/dst-bad-deep.stderr @@ -5,7 +5,6 @@ LL | let h: &Fat> = &Fat { ptr: *g }; | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `Fat>`, the trait `std::marker::Sized` is not implemented for `[isize]` - = note: to learn more, visit = note: required because it appears within the type `Fat<[isize]>` = note: required because it appears within the type `Fat>` = note: structs must have a statically known size to be initialized diff --git a/src/test/ui/dst/dst-object-from-unsized-type.stderr b/src/test/ui/dst/dst-object-from-unsized-type.stderr index 80d188bf2f89b..d6e9aaab7cf39 100644 --- a/src/test/ui/dst/dst-object-from-unsized-type.stderr +++ b/src/test/ui/dst/dst-object-from-unsized-type.stderr @@ -7,7 +7,6 @@ LL | let u: &dyn Foo = t; | ^ 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 = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `T` cannot be known at compilation time @@ -19,7 +18,6 @@ LL | let v: &dyn Foo = t as &dyn Foo; | ^ 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 = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `str` cannot be known at compilation time @@ -29,7 +27,6 @@ LL | let _: &[&dyn Foo] = &["hi"]; | ^^^^ 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 = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `[u8]` cannot be known at compilation time @@ -39,7 +36,6 @@ LL | let _: &dyn Foo = x as &dyn Foo; | ^ 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 = note: required for the cast to the object type `dyn Foo` error: aborting due to 4 previous errors diff --git a/src/test/ui/dst/dst-sized-trait-param.stderr b/src/test/ui/dst/dst-sized-trait-param.stderr index 006a334021b14..7e90e9ce1792d 100644 --- a/src/test/ui/dst/dst-sized-trait-param.stderr +++ b/src/test/ui/dst/dst-sized-trait-param.stderr @@ -8,7 +8,6 @@ LL | impl Foo<[isize]> for usize { } | ^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[isize]` - = note: to learn more, visit help: consider relaxing the implicit `Sized` restriction | LL | trait Foo : Sized { fn take(self, x: &T) { } } // Note: T is sized @@ -24,7 +23,6 @@ LL | impl Foo for [usize] { } | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[usize]` - = note: to learn more, visit error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0277.stderr b/src/test/ui/error-codes/E0277.stderr index a9ea85d14cff5..8789bb9609bd4 100644 --- a/src/test/ui/error-codes/E0277.stderr +++ b/src/test/ui/error-codes/E0277.stderr @@ -2,10 +2,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation --> $DIR/E0277.rs:13:6 | LL | fn f(p: Path) { } - | ^ borrow the `Path` instead + | ^ doesn't have a size known at compile-time | = help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]` - = note: to learn more, visit = note: required because it appears within the type `std::path::Path` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/extern/extern-types-unsized.stderr b/src/test/ui/extern/extern-types-unsized.stderr index 0c7995fde3273..8938afd33ffde 100644 --- a/src/test/ui/extern/extern-types-unsized.stderr +++ b/src/test/ui/extern/extern-types-unsized.stderr @@ -8,7 +8,6 @@ LL | assert_sized::(); | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `A` - = note: to learn more, visit help: consider relaxing the implicit `Sized` restriction | LL | fn assert_sized() { } @@ -24,7 +23,6 @@ LL | assert_sized::(); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `Foo`, the trait `std::marker::Sized` is not implemented for `A` - = note: to learn more, visit = note: required because it appears within the type `Foo` help: consider relaxing the implicit `Sized` restriction | @@ -41,7 +39,6 @@ LL | assert_sized::>(); | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `Bar`, the trait `std::marker::Sized` is not implemented for `A` - = note: to learn more, visit = note: required because it appears within the type `Bar` help: consider relaxing the implicit `Sized` restriction | @@ -58,7 +55,6 @@ LL | assert_sized::>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `Bar>`, the trait `std::marker::Sized` is not implemented for `A` - = note: to learn more, visit = note: required because it appears within the type `Bar` = note: required because it appears within the type `Bar>` help: consider relaxing the implicit `Sized` restriction diff --git a/src/test/ui/extern/issue-36122-accessing-externed-dst.stderr b/src/test/ui/extern/issue-36122-accessing-externed-dst.stderr index add3a8e79267d..5a58e57d36c70 100644 --- a/src/test/ui/extern/issue-36122-accessing-externed-dst.stderr +++ b/src/test/ui/extern/issue-36122-accessing-externed-dst.stderr @@ -5,7 +5,6 @@ LL | static symbol: [usize]; | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[usize]` - = note: to learn more, visit error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr index b4d4c992c9086..d4c09ec40fd92 100644 --- a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr +++ b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr @@ -95,7 +95,6 @@ LL | struct TwoStrs(str, str) where str: Sized; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -108,7 +107,6 @@ LL | | } | |_^ doesn't have a size known at compile-time | = help: within `Dst<(dyn A + 'static)>`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)` - = note: to learn more, visit = note: required because it appears within the type `Dst<(dyn A + 'static)>` = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -122,7 +120,6 @@ LL | | } | |_^ 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 = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr b/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr index d20b9e2981e8c..0775431a9d350 100644 --- a/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr +++ b/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr @@ -5,7 +5,6 @@ LL | fn f(f: dyn FnOnce()) {} | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::FnOnce() + 'static)` - = note: to learn more, visit = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/generator/sized-yield.stderr b/src/test/ui/generator/sized-yield.stderr index 79aeec2ec0280..379bd8ebd1cad 100644 --- a/src/test/ui/generator/sized-yield.stderr +++ b/src/test/ui/generator/sized-yield.stderr @@ -9,7 +9,6 @@ LL | | }; | |____^ 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 = note: the yield type of a generator must have a statically known size error[E0277]: the size for values of type `str` cannot be known at compilation time @@ -19,7 +18,6 @@ LL | Pin::new(&mut gen).resume(()); | ^^^^^^ 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 error: aborting due to 2 previous errors diff --git a/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr b/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr index 95f4aa9e6dbaa..7a6c07d4e082e 100644 --- a/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr +++ b/src/test/ui/generics/issue-61631-default-type-param-can-reference-self-in-trait.stderr @@ -8,7 +8,6 @@ LL | impl Tsized for () {} | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[()]` - = note: to learn more, visit error: aborting due to previous error diff --git a/src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr b/src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr index c55dbd7d2fafe..96f961a2aaf6b 100644 --- a/src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr +++ b/src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr @@ -16,7 +16,6 @@ LL | fn fuz() -> (usize, Trait) { (42, Struct) } | doesn't have a size known at compile-time | = help: within `(usize, (dyn Trait + 'static))`, the trait `std::marker::Sized` is not implemented for `(dyn Trait + 'static)` - = note: to learn more, visit = note: required because it appears within the type `(usize, (dyn Trait + 'static))` = note: the return type of a function must have a statically known size @@ -38,7 +37,6 @@ LL | fn bar() -> (usize, dyn Trait) { (42, Struct) } | doesn't have a size known at compile-time | = help: within `(usize, (dyn Trait + 'static))`, the trait `std::marker::Sized` is not implemented for `(dyn Trait + 'static)` - = note: to learn more, visit = note: required because it appears within the type `(usize, (dyn Trait + 'static))` = note: the return type of a function must have a statically known size diff --git a/src/test/ui/issues/issue-10412.stderr b/src/test/ui/issues/issue-10412.stderr index d7a4bf4f21f18..d241e6406d579 100644 --- a/src/test/ui/issues/issue-10412.stderr +++ b/src/test/ui/issues/issue-10412.stderr @@ -56,7 +56,6 @@ LL | impl<'self> Serializable for &'self str { | ^^^^^^^^^^^^^^^^^ 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 help: consider relaxing the implicit `Sized` restriction | LL | trait Serializable<'self, T: ?Sized> { diff --git a/src/test/ui/issues/issue-14366.stderr b/src/test/ui/issues/issue-14366.stderr index 542d8a904c4e3..4e41acf433e59 100644 --- a/src/test/ui/issues/issue-14366.stderr +++ b/src/test/ui/issues/issue-14366.stderr @@ -5,7 +5,6 @@ LL | let _x = "test" as &dyn (::std::any::Any); | ^^^^^^ 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 = note: required for the cast to the object type `dyn std::any::Any` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-15756.stderr b/src/test/ui/issues/issue-15756.stderr index 987bc512163d6..68ceebc5b651d 100644 --- a/src/test/ui/issues/issue-15756.stderr +++ b/src/test/ui/issues/issue-15756.stderr @@ -5,7 +5,6 @@ LL | &mut something | ^^^^^^^^^ 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 = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/issues/issue-17651.stderr b/src/test/ui/issues/issue-17651.stderr index c3445024c3752..812778911a865 100644 --- a/src/test/ui/issues/issue-17651.stderr +++ b/src/test/ui/issues/issue-17651.stderr @@ -5,7 +5,6 @@ LL | (|| Box::new(*(&[0][..])))(); | ^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[{integer}]` - = note: to learn more, visit = note: required by `std::boxed::Box::::new` error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time @@ -15,7 +14,6 @@ LL | (|| Box::new(*(&[0][..])))(); | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[{integer}]` - = note: to learn more, visit = note: all function arguments must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/issues/issue-18919.stderr b/src/test/ui/issues/issue-18919.stderr index 383cdd4979ad9..3b5dfd1ad158c 100644 --- a/src/test/ui/issues/issue-18919.stderr +++ b/src/test/ui/issues/issue-18919.stderr @@ -8,7 +8,6 @@ LL | enum Option { | - required by this bound in `Option` | = help: the trait `std::marker::Sized` is not implemented for `dyn for<'r> std::ops::Fn(&'r isize) -> isize` - = note: to learn more, visit help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` --> $DIR/issue-18919.rs:7:13 | diff --git a/src/test/ui/issues/issue-20005.stderr b/src/test/ui/issues/issue-20005.stderr index 775f9702401a6..7bd2578344458 100644 --- a/src/test/ui/issues/issue-20005.stderr +++ b/src/test/ui/issues/issue-20005.stderr @@ -8,7 +8,6 @@ LL | ) -> >::Result where Dst: From { | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Self` - = note: to learn more, visit help: consider further restricting `Self` | LL | ) -> >::Result where Dst: From, Self: std::marker::Sized { diff --git a/src/test/ui/issues/issue-20433.stderr b/src/test/ui/issues/issue-20433.stderr index 1dab637e489db..0e96b12066937 100644 --- a/src/test/ui/issues/issue-20433.stderr +++ b/src/test/ui/issues/issue-20433.stderr @@ -10,7 +10,6 @@ LL | pub struct Vec { | - required by this bound in `std::vec::Vec` | = help: the trait `std::marker::Sized` is not implemented for `[i32]` - = note: to learn more, visit error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20605.stderr b/src/test/ui/issues/issue-20605.stderr index 5e050f27ac546..5e06e3bc95c36 100644 --- a/src/test/ui/issues/issue-20605.stderr +++ b/src/test/ui/issues/issue-20605.stderr @@ -5,7 +5,6 @@ LL | for item in *things { *item = 0 } | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn std::iter::Iterator` - = note: to learn more, visit = note: required by `std::iter::IntoIterator::into_iter` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22874.stderr b/src/test/ui/issues/issue-22874.stderr index 9a74bc0313169..6f22fe6a99717 100644 --- a/src/test/ui/issues/issue-22874.stderr +++ b/src/test/ui/issues/issue-22874.stderr @@ -5,7 +5,6 @@ LL | rows: [[String]], | ^^^^^^^^^^ 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 = note: slice and array elements must have `Sized` type error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23281.stderr b/src/test/ui/issues/issue-23281.stderr index cffa52361696c..46b4be6fd3649 100644 --- a/src/test/ui/issues/issue-23281.stderr +++ b/src/test/ui/issues/issue-23281.stderr @@ -8,7 +8,6 @@ LL | struct Vec { | - required by this bound in `Vec` | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() + 'static)` - = note: to learn more, visit help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` --> $DIR/issue-23281.rs:8:12 | diff --git a/src/test/ui/issues/issue-24446.stderr b/src/test/ui/issues/issue-24446.stderr index 344443e783038..d2714408d8a39 100644 --- a/src/test/ui/issues/issue-24446.stderr +++ b/src/test/ui/issues/issue-24446.stderr @@ -5,7 +5,6 @@ LL | static foo: dyn Fn() -> u32 = || -> u32 { | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() -> u32 + 'static)` - = note: to learn more, visit error: aborting due to previous error diff --git a/src/test/ui/issues/issue-27060-2.stderr b/src/test/ui/issues/issue-27060-2.stderr index 8b64128fb01da..881fae1942335 100644 --- a/src/test/ui/issues/issue-27060-2.stderr +++ b/src/test/ui/issues/issue-27060-2.stderr @@ -7,7 +7,6 @@ LL | data: T, | ^ 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 = 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 diff --git a/src/test/ui/issues/issue-27078.stderr b/src/test/ui/issues/issue-27078.stderr index 3eb9d3c62039f..313c294e8a1a5 100644 --- a/src/test/ui/issues/issue-27078.stderr +++ b/src/test/ui/issues/issue-27078.stderr @@ -5,7 +5,6 @@ LL | fn foo(self) -> &'static i32 { | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Self` - = note: to learn more, visit = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature help: consider further restricting `Self` diff --git a/src/test/ui/issues/issue-30355.stderr b/src/test/ui/issues/issue-30355.stderr index 48b151c73c956..98de768a5a819 100644 --- a/src/test/ui/issues/issue-30355.stderr +++ b/src/test/ui/issues/issue-30355.stderr @@ -5,7 +5,6 @@ LL | &X(*Y) | ^ 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 = note: all function arguments must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/issues/issue-35988.stderr b/src/test/ui/issues/issue-35988.stderr index 52660eb7cdac9..a137549693844 100644 --- a/src/test/ui/issues/issue-35988.stderr +++ b/src/test/ui/issues/issue-35988.stderr @@ -5,7 +5,6 @@ LL | V([Box]), | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[std::boxed::Box]` - = note: to learn more, visit = 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 diff --git a/src/test/ui/issues/issue-38954.stderr b/src/test/ui/issues/issue-38954.stderr index 93133bc94bbcf..e96bbe1a99312 100644 --- a/src/test/ui/issues/issue-38954.stderr +++ b/src/test/ui/issues/issue-38954.stderr @@ -5,7 +5,6 @@ LL | fn _test(ref _p: str) {} | ^^^^^^ 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 = help: unsized locals are gated as an unstable feature help: function arguments must have a statically known size, borrowed types always have a known size | diff --git a/src/test/ui/issues/issue-41229-ref-str.stderr b/src/test/ui/issues/issue-41229-ref-str.stderr index 1b908ca49de43..35aa1acdc1c9b 100644 --- a/src/test/ui/issues/issue-41229-ref-str.stderr +++ b/src/test/ui/issues/issue-41229-ref-str.stderr @@ -5,7 +5,6 @@ LL | pub fn example(ref s: str) {} | ^^^^^ 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 = help: unsized locals are gated as an unstable feature help: function arguments must have a statically known size, borrowed types always have a known size | diff --git a/src/test/ui/issues/issue-42312.stderr b/src/test/ui/issues/issue-42312.stderr index 58eb3afee81de..fbe87aa2dbee5 100644 --- a/src/test/ui/issues/issue-42312.stderr +++ b/src/test/ui/issues/issue-42312.stderr @@ -5,7 +5,6 @@ LL | fn baz(_: Self::Target) where Self: Deref {} | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `::Target` - = note: to learn more, visit = help: unsized locals are gated as an unstable feature help: consider further restricting the associated type | @@ -23,7 +22,6 @@ LL | pub fn f(_: dyn ToString) {} | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::string::ToString + 'static)` - = note: to learn more, visit = help: unsized locals are gated as an unstable feature help: function arguments must have a statically known size, borrowed types always have a known size | diff --git a/src/test/ui/issues/issue-54410.stderr b/src/test/ui/issues/issue-54410.stderr index 992c691bf21ef..9205a518c8c3a 100644 --- a/src/test/ui/issues/issue-54410.stderr +++ b/src/test/ui/issues/issue-54410.stderr @@ -5,7 +5,6 @@ LL | pub static mut symbol: [i8]; | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[i8]` - = note: to learn more, visit error: aborting due to previous error diff --git a/src/test/ui/issues/issue-5883.stderr b/src/test/ui/issues/issue-5883.stderr index d886ecc11d17b..149d882af78ff 100644 --- a/src/test/ui/issues/issue-5883.stderr +++ b/src/test/ui/issues/issue-5883.stderr @@ -5,7 +5,6 @@ LL | fn new_struct(r: dyn A + 'static) | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)` - = note: to learn more, visit = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -19,7 +18,6 @@ LL | Struct { r: r } | --------------- this returned value is of type `Struct` | = help: within `Struct`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)` - = note: to learn more, visit = note: required because it appears within the type `Struct` = note: the return type of a function must have a statically known size diff --git a/src/test/ui/issues/issue-65673.stderr b/src/test/ui/issues/issue-65673.stderr index 114f2d62e561a..fef64ebf2d365 100644 --- a/src/test/ui/issues/issue-65673.stderr +++ b/src/test/ui/issues/issue-65673.stderr @@ -10,7 +10,6 @@ LL | type Ctx = dyn Alias; | ^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn Trait + 'static)` - = note: to learn more, visit error: aborting due to previous error diff --git a/src/test/ui/lazy_normalization_consts/feature-gate-lazy_normalization_consts.stderr b/src/test/ui/lazy_normalization_consts/feature-gate-lazy_normalization_consts.stderr index 6e19251c72800..97c7417839825 100644 --- a/src/test/ui/lazy_normalization_consts/feature-gate-lazy_normalization_consts.stderr +++ b/src/test/ui/lazy_normalization_consts/feature-gate-lazy_normalization_consts.stderr @@ -10,7 +10,6 @@ LL | let _: [u8; sof::()]; | ^ 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 help: consider relaxing the implicit `Sized` restriction | LL | pub const fn sof() -> usize { diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index 95936de218b8f..71abda520653e 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -209,7 +209,6 @@ LL | let _ = fat_v as *const dyn Foo; | ^^^^^ 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 = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `str` cannot be known at compilation time @@ -219,7 +218,6 @@ LL | let _ = a as *const dyn Foo; | ^ 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 = note: required for the cast to the object type `dyn Foo` error[E0606]: casting `&{float}` as `f32` is invalid diff --git a/src/test/ui/range/range-1.stderr b/src/test/ui/range/range-1.stderr index 05009358106fa..e179feba7a799 100644 --- a/src/test/ui/range/range-1.stderr +++ b/src/test/ui/range/range-1.stderr @@ -19,7 +19,6 @@ LL | let range = *arr..; | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[{integer}]` - = note: to learn more, visit = note: required by `std::ops::RangeFrom` error: aborting due to 3 previous errors diff --git a/src/test/ui/resolve/issue-5035-2.stderr b/src/test/ui/resolve/issue-5035-2.stderr index 89eb3d97ce0a5..ec2882d6c6d73 100644 --- a/src/test/ui/resolve/issue-5035-2.stderr +++ b/src/test/ui/resolve/issue-5035-2.stderr @@ -5,7 +5,6 @@ LL | fn foo(_x: K) {} | ^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn I + 'static)` - = note: to learn more, visit = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/str/str-array-assignment.stderr b/src/test/ui/str/str-array-assignment.stderr index cc767de3845d2..0b1832d70ff86 100644 --- a/src/test/ui/str/str-array-assignment.stderr +++ b/src/test/ui/str/str-array-assignment.stderr @@ -24,7 +24,6 @@ LL | let v = s[..2]; | 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 = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/str/str-mut-idx.stderr b/src/test/ui/str/str-mut-idx.stderr index 2fd805e646991..7c834165e7f1c 100644 --- a/src/test/ui/str/str-mut-idx.stderr +++ b/src/test/ui/str/str-mut-idx.stderr @@ -8,7 +8,6 @@ LL | s[1..2] = bot(); | ^^^ 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 help: consider relaxing the implicit `Sized` restriction | LL | fn bot() -> T { loop {} } @@ -21,7 +20,6 @@ LL | s[1..2] = bot(); | ^^^^^^^ 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 = note: the left-hand-side of an assignment must have a statically known size error[E0277]: the type `str` cannot be indexed by `usize` diff --git a/src/test/ui/substs-ppaux.normal.stderr b/src/test/ui/substs-ppaux.normal.stderr index bcdeed262ecba..8dab8add80b8a 100644 --- a/src/test/ui/substs-ppaux.normal.stderr +++ b/src/test/ui/substs-ppaux.normal.stderr @@ -80,7 +80,6 @@ LL | >::bar; | ^^^^^^^^^^^^^^^^^^^^^ 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 = note: required because of the requirements on the impl of `Foo<'_, '_, u8>` for `str` error: aborting due to 5 previous errors diff --git a/src/test/ui/substs-ppaux.verbose.stderr b/src/test/ui/substs-ppaux.verbose.stderr index fb5e6fbcfe712..a40d5e4bf7ba1 100644 --- a/src/test/ui/substs-ppaux.verbose.stderr +++ b/src/test/ui/substs-ppaux.verbose.stderr @@ -80,7 +80,6 @@ LL | >::bar; | ^^^^^^^^^^^^^^^^^^^^^ 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 = note: required because of the requirements on the impl of `Foo<'_#0r, '_#1r, u8>` for `str` error: aborting due to 5 previous errors diff --git a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr index 03877e60e2b72..0b08b4a16a692 100644 --- a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr +++ b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr @@ -10,7 +10,6 @@ LL | _t: X, | ^^^^ 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 help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` --> $DIR/adt-param-with-implicit-sized-bound.rs:18:10 | @@ -29,7 +28,6 @@ LL | struct Struct1{ | - required by this bound in `Struct1` | = help: the trait `std::marker::Sized` is not implemented for `Self` - = note: to learn more, visit help: consider further restricting `Self` | LL | fn func1() -> Struct1 where Self: std::marker::Sized; @@ -49,7 +47,6 @@ LL | struct Struct2<'a, T>{ | - required by this bound in `Struct2` | = help: the trait `std::marker::Sized` is not implemented for `Self` - = note: to learn more, visit help: consider further restricting `Self` | LL | fn func2<'a>() -> Struct2<'a, Self> where Self: std::marker::Sized; @@ -69,7 +66,6 @@ LL | struct Struct3{ | - required by this bound in `Struct3` | = help: the trait `std::marker::Sized` is not implemented for `Self` - = note: to learn more, visit help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` --> $DIR/adt-param-with-implicit-sized-bound.rs:14:16 | @@ -92,7 +88,6 @@ LL | struct Struct4{ | - required by this bound in `Struct4` | = help: the trait `std::marker::Sized` is not implemented for `Self` - = note: to learn more, visit help: consider further restricting `Self` | LL | fn func4() -> Struct4 where Self: std::marker::Sized; diff --git a/src/test/ui/suggestions/path-by-value.stderr b/src/test/ui/suggestions/path-by-value.stderr index b073e10749cc1..5bd50fea1cb6c 100644 --- a/src/test/ui/suggestions/path-by-value.stderr +++ b/src/test/ui/suggestions/path-by-value.stderr @@ -2,10 +2,9 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation --> $DIR/path-by-value.rs:3:6 | LL | fn f(p: Path) { } - | ^ borrow the `Path` instead + | ^ doesn't have a size known at compile-time | = help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]` - = note: to learn more, visit = note: required because it appears within the type `std::path::Path` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr b/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr index 5e685105b45a3..082d787fb0b7b 100644 --- a/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr +++ b/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr @@ -13,7 +13,6 @@ LL | fn foo(_x: Foo + Send) { | ^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn Foo + std::marker::Send + 'static)` - = note: to learn more, visit = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/traits/trait-suggest-where-clause.stderr b/src/test/ui/traits/trait-suggest-where-clause.stderr index 4dddcd68f26c9..b8069f9ddb0f6 100644 --- a/src/test/ui/traits/trait-suggest-where-clause.stderr +++ b/src/test/ui/traits/trait-suggest-where-clause.stderr @@ -13,7 +13,6 @@ LL | pub const fn size_of() -> usize { | - required by this bound in `std::mem::size_of` | = help: the trait `std::marker::Sized` is not implemented for `U` - = note: to learn more, visit error[E0277]: the size for values of type `U` cannot be known at compilation time --> $DIR/trait-suggest-where-clause.rs:10:5 @@ -30,7 +29,6 @@ LL | pub const fn size_of() -> usize { | - required by this bound in `std::mem::size_of` | = help: within `Misc`, the trait `std::marker::Sized` is not implemented for `U` - = note: to learn more, visit = note: required because it appears within the type `Misc` error[E0277]: the trait bound `u64: std::convert::From` is not satisfied @@ -69,7 +67,6 @@ LL | pub const fn size_of() -> usize { | - required by this bound in `std::mem::size_of` | = help: the trait `std::marker::Sized` is not implemented for `[T]` - = note: to learn more, visit error[E0277]: the size for values of type `[&U]` cannot be known at compilation time --> $DIR/trait-suggest-where-clause.rs:31:5 @@ -83,7 +80,6 @@ LL | pub const fn size_of() -> usize { | - required by this bound in `std::mem::size_of` | = help: the trait `std::marker::Sized` is not implemented for `[&U]` - = note: to learn more, visit error: aborting due to 7 previous errors diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr index 006fa933d34ca..4f4695612de0b 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr @@ -5,7 +5,6 @@ LL | fn cant_return_str() -> str { | ^^^ 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 = note: the return type of a function must have a statically known size error[E0599]: no method named `test` found for type `i32` in the current scope diff --git a/src/test/ui/union/union-sized-field.stderr b/src/test/ui/union/union-sized-field.stderr index 1bfc44e3eec62..eb169987ccdb9 100644 --- a/src/test/ui/union/union-sized-field.stderr +++ b/src/test/ui/union/union-sized-field.stderr @@ -7,7 +7,6 @@ LL | value: T, | ^ 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 = 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 @@ -28,7 +27,6 @@ LL | value: T, | ^ 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 = 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 @@ -49,7 +47,6 @@ LL | Value(T), | ^ 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 = 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 diff --git a/src/test/ui/union/union-unsized.stderr b/src/test/ui/union/union-unsized.stderr index 442ea83f80168..574f182ecc687 100644 --- a/src/test/ui/union/union-unsized.stderr +++ b/src/test/ui/union/union-unsized.stderr @@ -5,7 +5,6 @@ LL | a: str, | ^^^ 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 = 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 @@ -24,7 +23,6 @@ LL | b: str, | ^^^ 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 = 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 diff --git a/src/test/ui/unsized-locals/issue-30276-feature-flagged.stderr b/src/test/ui/unsized-locals/issue-30276-feature-flagged.stderr index 35f63a91b2b53..2ed35dc0e2c12 100644 --- a/src/test/ui/unsized-locals/issue-30276-feature-flagged.stderr +++ b/src/test/ui/unsized-locals/issue-30276-feature-flagged.stderr @@ -5,7 +5,6 @@ LL | let _x: fn(_) -> Test = Test; | ^^^^ doesn't have a size known at compile-time | = help: within `Test`, the trait `std::marker::Sized` is not implemented for `[i32]` - = note: to learn more, visit = note: required because it appears within the type `Test` = note: the return type of a function must have a statically known size diff --git a/src/test/ui/unsized-locals/issue-30276.stderr b/src/test/ui/unsized-locals/issue-30276.stderr index d42fddb3a4a26..461efcf3dbf29 100644 --- a/src/test/ui/unsized-locals/issue-30276.stderr +++ b/src/test/ui/unsized-locals/issue-30276.stderr @@ -5,7 +5,6 @@ LL | let _x: fn(_) -> Test = Test; | ^^^^ 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 = note: all function arguments must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/unsized-locals/issue-50940-with-feature.stderr b/src/test/ui/unsized-locals/issue-50940-with-feature.stderr index 7b6c2d11ea169..04a8de1b5dc5b 100644 --- a/src/test/ui/unsized-locals/issue-50940-with-feature.stderr +++ b/src/test/ui/unsized-locals/issue-50940-with-feature.stderr @@ -5,7 +5,6 @@ LL | A as fn(str) -> A; | ^ doesn't have a size known at compile-time | = help: within `main::A`, the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit = note: required because it appears within the type `main::A` = note: the return type of a function must have a statically known size diff --git a/src/test/ui/unsized-locals/issue-50940.stderr b/src/test/ui/unsized-locals/issue-50940.stderr index be006c09d6f5c..8e5f753082734 100644 --- a/src/test/ui/unsized-locals/issue-50940.stderr +++ b/src/test/ui/unsized-locals/issue-50940.stderr @@ -5,7 +5,6 @@ LL | A as fn(str) -> A; | ^ 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 = note: all function arguments must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/unsized-locals/unsized-exprs.stderr b/src/test/ui/unsized-locals/unsized-exprs.stderr index 43c35cdd7b5b0..0a9b43dac3344 100644 --- a/src/test/ui/unsized-locals/unsized-exprs.stderr +++ b/src/test/ui/unsized-locals/unsized-exprs.stderr @@ -5,7 +5,6 @@ LL | udrop::<(i32, [u8])>((42, *foo())); | ^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `({integer}, [u8])`, the trait `std::marker::Sized` is not implemented for `[u8]` - = note: to learn more, visit = note: required because it appears within the type `({integer}, [u8])` = note: tuples must have a statically known size to be initialized @@ -16,7 +15,6 @@ LL | udrop::>(A { 0: *foo() }); | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `A<[u8]>`, the trait `std::marker::Sized` is not implemented for `[u8]` - = note: to learn more, visit = note: required because it appears within the type `A<[u8]>` = note: structs must have a statically known size to be initialized @@ -27,7 +25,6 @@ LL | udrop::>(A(*foo())); | ^ doesn't have a size known at compile-time | = help: within `A<[u8]>`, the trait `std::marker::Sized` is not implemented for `[u8]` - = note: to learn more, visit = note: required because it appears within the type `A<[u8]>` = note: the return type of a function must have a statically known size diff --git a/src/test/ui/unsized-locals/unsized-exprs3.stderr b/src/test/ui/unsized-locals/unsized-exprs3.stderr index f9a7452a5ebf2..11435ec0353bc 100644 --- a/src/test/ui/unsized-locals/unsized-exprs3.stderr +++ b/src/test/ui/unsized-locals/unsized-exprs3.stderr @@ -5,7 +5,6 @@ LL | udrop as fn([u8]); | ^^^^^ 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 = note: all function arguments must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/unsized/unsized-bare-typaram.stderr b/src/test/ui/unsized/unsized-bare-typaram.stderr index 3ff6f30db2a84..998cd7a527c9b 100644 --- a/src/test/ui/unsized/unsized-bare-typaram.stderr +++ b/src/test/ui/unsized/unsized-bare-typaram.stderr @@ -9,7 +9,6 @@ LL | fn foo() { bar::() } | this type parameter needs to be `std::marker::Sized` | = help: the trait `std::marker::Sized` is not implemented for `T` - = note: to learn more, visit error: aborting due to previous error diff --git a/src/test/ui/unsized/unsized-enum.stderr b/src/test/ui/unsized/unsized-enum.stderr index 1908aee25ea7b..cb06e707dcaa8 100644 --- a/src/test/ui/unsized/unsized-enum.stderr +++ b/src/test/ui/unsized/unsized-enum.stderr @@ -10,7 +10,6 @@ LL | fn foo2() { not_sized::>() } | this type parameter needs to be `std::marker::Sized` | = help: the trait `std::marker::Sized` is not implemented for `T` - = note: to learn more, visit help: you could relax the implicit `Sized` bound on `U` if it were used through indirection like `&U` or `Box` --> $DIR/unsized-enum.rs:4:10 | diff --git a/src/test/ui/unsized/unsized-enum2.stderr b/src/test/ui/unsized/unsized-enum2.stderr index fb89a6f45d234..82f395740d5ad 100644 --- a/src/test/ui/unsized/unsized-enum2.stderr +++ b/src/test/ui/unsized/unsized-enum2.stderr @@ -8,7 +8,6 @@ LL | VA(W), | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `W` - = note: to learn more, visit = 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 @@ -30,7 +29,6 @@ LL | VB{x: X}, | ^ 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 = 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 @@ -52,7 +50,6 @@ LL | VC(isize, Y), | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Y` - = note: to learn more, visit = 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 @@ -74,7 +71,6 @@ LL | VD{u: isize, x: Z}, | ^ 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 = 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 @@ -93,7 +89,6 @@ LL | VE([u8]), | ^^^^ 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 = 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 @@ -112,7 +107,6 @@ LL | VF{x: str}, | ^^^ 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 = 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 @@ -131,7 +125,6 @@ LL | VG(isize, [f32]), | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[f32]` - = note: to learn more, visit = 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 @@ -150,7 +143,6 @@ LL | VH{u: isize, x: [u32]}, | ^^^^^ 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 = 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 @@ -169,7 +161,6 @@ LL | VM(dyn Foo), | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn Foo + 'static)` - = note: to learn more, visit = 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 @@ -188,7 +179,6 @@ LL | VN{x: dyn Bar}, | ^^^^^^^ 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 = 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 @@ -207,7 +197,6 @@ LL | VO(isize, dyn FooBar), | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn FooBar + 'static)` - = note: to learn more, visit = 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 @@ -226,7 +215,6 @@ LL | VP{u: isize, x: dyn BarFoo}, | ^^^^^^^^^^ 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 = 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 @@ -245,7 +233,6 @@ LL | VQ(<&'static [i8] as Deref>::Target), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[i8]` - = note: to learn more, visit = 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 @@ -264,7 +251,6 @@ LL | VR{x: <&'static [char] as Deref>::Target}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 = 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 @@ -283,7 +269,6 @@ LL | VS(isize, <&'static [f64] as Deref>::Target), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[f64]` - = note: to learn more, visit = 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 @@ -302,7 +287,6 @@ LL | VT{u: isize, x: <&'static [i32] as Deref>::Target}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 = 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 @@ -321,7 +305,6 @@ LL | VI(Path1), | ^^^^^ doesn't have a size known at compile-time | = help: within `Path1`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper1 + 'static)` - = note: to learn more, visit = 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 @@ -341,7 +324,6 @@ LL | VJ{x: Path2}, | ^^^^^ 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 = 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 @@ -361,7 +343,6 @@ LL | VK(isize, Path3), | ^^^^^ doesn't have a size known at compile-time | = help: within `Path3`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper3 + 'static)` - = note: to learn more, visit = 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 @@ -381,7 +362,6 @@ LL | VL{u: isize, x: Path4}, | ^^^^^ 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 = 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 diff --git a/src/test/ui/unsized/unsized-fn-param.stderr b/src/test/ui/unsized/unsized-fn-param.stderr index ed2c2e75cbd44..6b54db7148a74 100644 --- a/src/test/ui/unsized/unsized-fn-param.stderr +++ b/src/test/ui/unsized/unsized-fn-param.stderr @@ -5,7 +5,6 @@ LL | foo11("bar", &"baz"); | ^^^^^ 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 = note: required for the cast to the object type `dyn std::convert::AsRef` error[E0277]: the size for values of type `str` cannot be known at compilation time @@ -15,7 +14,6 @@ LL | foo12(&"bar", "baz"); | ^^^^^ 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 = note: required for the cast to the object type `dyn std::convert::AsRef` error[E0277]: the size for values of type `str` cannot be known at compilation time @@ -25,7 +23,6 @@ LL | foo21("bar", &"baz"); | ^^^^^ 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 = note: required for the cast to the object type `dyn std::convert::AsRef` error[E0277]: the size for values of type `str` cannot be known at compilation time @@ -35,7 +32,6 @@ LL | foo22(&"bar", "baz"); | ^^^^^ 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 = note: required for the cast to the object type `dyn std::convert::AsRef` error: aborting due to 4 previous errors diff --git a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr index e0f077d66f99c..0d08f70c558be 100644 --- a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr @@ -10,7 +10,6 @@ LL | impl S5 { | this type parameter needs to be `std::marker::Sized` | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit help: you could relax the implicit `Sized` bound on `Y` if it were used through indirection like `&Y` or `Box` --> $DIR/unsized-inherent-impl-self-type.rs:5:11 | diff --git a/src/test/ui/unsized/unsized-struct.stderr b/src/test/ui/unsized/unsized-struct.stderr index d92d1d9113e5c..d796fcd1a6b64 100644 --- a/src/test/ui/unsized/unsized-struct.stderr +++ b/src/test/ui/unsized/unsized-struct.stderr @@ -10,7 +10,6 @@ LL | fn foo2() { not_sized::>() } | this type parameter needs to be `std::marker::Sized` | = help: the trait `std::marker::Sized` is not implemented for `T` - = note: to learn more, visit help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` --> $DIR/unsized-struct.rs:4:12 | @@ -31,7 +30,6 @@ LL | fn bar2() { is_sized::>() } | this type parameter needs to be `std::marker::Sized` | = help: within `Bar`, the trait `std::marker::Sized` is not implemented for `T` - = note: to learn more, visit = note: required because it appears within the type `Bar` error: aborting due to 2 previous errors diff --git a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr index 73c5439da53b6..623c83c4d6f07 100644 --- a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr @@ -10,7 +10,6 @@ LL | impl T3 for S5 { | this type parameter needs to be `std::marker::Sized` | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit help: you could relax the implicit `Sized` bound on `Y` if it were used through indirection like `&Y` or `Box` --> $DIR/unsized-trait-impl-self-type.rs:8:11 | diff --git a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr index e423a9bdeab6f..1dc9e313d91a6 100644 --- a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr @@ -10,7 +10,6 @@ LL | impl T2 for S4 { | this type parameter needs to be `std::marker::Sized` | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit help: consider relaxing the implicit `Sized` restriction | LL | trait T2 { diff --git a/src/test/ui/unsized3.stderr b/src/test/ui/unsized3.stderr index e0a0389dc4690..d5c79c71a2349 100644 --- a/src/test/ui/unsized3.stderr +++ b/src/test/ui/unsized3.stderr @@ -10,7 +10,6 @@ LL | fn f2(x: &X) { | - required by this bound in `f2` | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit help: consider relaxing the implicit `Sized` restriction | LL | fn f2(x: &X) { @@ -28,7 +27,6 @@ LL | fn f4(x: &X) { | - required by this bound in `f4` | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit help: consider relaxing the implicit `Sized` restriction | LL | fn f4(x: &X) { @@ -46,7 +44,6 @@ LL | f5(x1); | ^^ doesn't have a size known at compile-time | = help: within `S`, the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit = note: required because it appears within the type `S` help: consider relaxing the implicit `Sized` restriction | @@ -62,7 +59,6 @@ LL | f5(&(*x1, 34)); | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `S`, the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit = note: required because it appears within the type `S` = note: only the last element of a tuple may have a dynamically sized type @@ -75,7 +71,6 @@ LL | f5(&(32, *x1)); | ^^^^^^^^^ doesn't have a size known at compile-time | = help: within `({integer}, S)`, the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit = note: required because it appears within the type `S` = note: required because it appears within the type `({integer}, S)` = note: tuples must have a statically known size to be initialized @@ -92,7 +87,6 @@ LL | f5(&(32, *x1)); | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `({integer}, S)`, the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit = note: required because it appears within the type `S` = note: required because it appears within the type `({integer}, S)` help: consider relaxing the implicit `Sized` restriction diff --git a/src/test/ui/unsized5.stderr b/src/test/ui/unsized5.stderr index 3eef1f4f6771e..9bdcc0399b833 100644 --- a/src/test/ui/unsized5.stderr +++ b/src/test/ui/unsized5.stderr @@ -7,7 +7,6 @@ LL | f1: X, | ^ 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 = 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 @@ -29,7 +28,6 @@ LL | g: X, | ^ 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 = 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 @@ -48,7 +46,6 @@ LL | f: str, | ^^^ 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 = 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 @@ -67,7 +64,6 @@ LL | f: [u8], | ^^^^ 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 = 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 @@ -88,7 +84,6 @@ LL | V1(X, isize), | ^ 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 = 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 @@ -109,7 +104,6 @@ LL | V2{f1: X, f: isize}, | ^ 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 = 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 diff --git a/src/test/ui/unsized6.stderr b/src/test/ui/unsized6.stderr index 337afd2ee7e10..d566399e5ba00 100644 --- a/src/test/ui/unsized6.stderr +++ b/src/test/ui/unsized6.stderr @@ -8,7 +8,6 @@ LL | let y: Y; | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Y` - = note: to learn more, visit = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -22,7 +21,6 @@ LL | let _: (isize, (X, isize)); | ^^^^^^^^^^^^^^^^^^^ 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 = note: only the last element of a tuple may have a dynamically sized type error[E0277]: the size for values of type `Z` cannot be known at compilation time @@ -35,7 +33,6 @@ LL | let y: (isize, (Z, usize)); | ^^^^^^^^^^^^^^^^^^^ 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 = note: only the last element of a tuple may have a dynamically sized type error[E0277]: the size for values of type `X` cannot be known at compilation time @@ -47,7 +44,6 @@ LL | let y: X; | ^ 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 = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -61,7 +57,6 @@ LL | let y: (isize, (Y, isize)); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Y` - = note: to learn more, visit = note: only the last element of a tuple may have a dynamically sized type error[E0277]: the size for values of type `X` cannot be known at compilation time @@ -73,7 +68,6 @@ LL | let y: X = *x1; | ^ 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 = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -87,7 +81,6 @@ LL | let y = *x2; | ^ 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 = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -101,7 +94,6 @@ LL | let (y, z) = (*x3, 4); | ^ 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 = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -114,7 +106,6 @@ LL | let y: X = *x1; | ^ 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 = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -128,7 +119,6 @@ LL | let y = *x2; | ^ 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 = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -142,7 +132,6 @@ LL | let (y, z) = (*x3, 4); | ^ 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 = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -155,7 +144,6 @@ LL | fn g1(x: X) {} | this type parameter needs to be `std::marker::Sized` | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -168,7 +156,6 @@ LL | fn g2(x: X) {} | this type parameter needs to be `std::marker::Sized` | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/unsized7.stderr b/src/test/ui/unsized7.stderr index e616a5cf0f9c2..868c9ea429e24 100644 --- a/src/test/ui/unsized7.stderr +++ b/src/test/ui/unsized7.stderr @@ -10,7 +10,6 @@ LL | impl T1 for S3 { | this type parameter needs to be `std::marker::Sized` | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit help: consider relaxing the implicit `Sized` restriction | LL | trait T1 { diff --git a/src/test/ui/wf/wf-array-elem-sized.stderr b/src/test/ui/wf/wf-array-elem-sized.stderr index b424c9f3ac981..fedec1909fd33 100644 --- a/src/test/ui/wf/wf-array-elem-sized.stderr +++ b/src/test/ui/wf/wf-array-elem-sized.stderr @@ -5,7 +5,6 @@ LL | foo: [[u8]], | ^^^^^^ 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 = note: slice and array elements must have `Sized` type error: aborting due to previous error diff --git a/src/test/ui/wf/wf-fn-where-clause.stderr b/src/test/ui/wf/wf-fn-where-clause.stderr index 731d31ac34f62..938336d3ace76 100644 --- a/src/test/ui/wf/wf-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-fn-where-clause.stderr @@ -22,7 +22,6 @@ LL | struct Vec { | - required by this bound in `Vec` | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Copy + 'static)` - = note: to learn more, visit help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` --> $DIR/wf-fn-where-clause.rs:16:12 | From d989796b478764e1a535951b56d150ab42f1d891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 10 Jul 2020 18:11:40 -0700 Subject: [PATCH 5/7] Suggest borrowing in more unsized fn param cases --- src/librustc_ast_lowering/expr.rs | 2 +- src/librustc_ast_lowering/item.rs | 2 + src/librustc_hir/hir.rs | 1 + .../traits/error_reporting/mod.rs | 1 - .../traits/error_reporting/suggestions.rs | 65 +++++++++---------- .../issue-72590-type-error-sized.stderr | 5 +- src/test/ui/error-codes/E0277.stderr | 5 +- .../feature-gate-unsized_locals.stderr | 5 +- src/test/ui/issues/issue-27078.stderr | 5 +- src/test/ui/issues/issue-5883.stderr | 5 +- src/test/ui/resolve/issue-5035-2.stderr | 5 +- src/test/ui/str/str-array-assignment.stderr | 8 ++- src/test/ui/suggestions/path-by-value.stderr | 5 +- .../trait-bounds-not-on-bare-trait.stderr | 5 +- src/test/ui/unsized6.stderr | 10 ++- 15 files changed, 80 insertions(+), 49 deletions(-) diff --git a/src/librustc_ast_lowering/expr.rs b/src/librustc_ast_lowering/expr.rs index 90a3a5ec64e0e..201972fcf264b 100644 --- a/src/librustc_ast_lowering/expr.rs +++ b/src/librustc_ast_lowering/expr.rs @@ -526,7 +526,7 @@ impl<'hir> LoweringContext<'_, 'hir> { Ident::with_dummy_span(sym::_task_context), hir::BindingAnnotation::Mutable, ); - let param = hir::Param { attrs: &[], hir_id: self.next_id(), pat, span }; + let param = hir::Param { attrs: &[], hir_id: self.next_id(), pat, ty_span: span, span }; let params = arena_vec![self; param]; let body_id = self.lower_body(move |this| { diff --git a/src/librustc_ast_lowering/item.rs b/src/librustc_ast_lowering/item.rs index 00665c4cafb6b..dd5e658102fac 100644 --- a/src/librustc_ast_lowering/item.rs +++ b/src/librustc_ast_lowering/item.rs @@ -972,6 +972,7 @@ impl<'hir> LoweringContext<'_, 'hir> { attrs: self.lower_attrs(¶m.attrs), hir_id: self.lower_node_id(param.id), pat: self.lower_pat(¶m.pat), + ty_span: param.ty.span, span: param.span, } } @@ -1098,6 +1099,7 @@ impl<'hir> LoweringContext<'_, 'hir> { attrs: parameter.attrs, hir_id: parameter.hir_id, pat: new_parameter_pat, + ty_span: parameter.ty_span, span: parameter.span, }; diff --git a/src/librustc_hir/hir.rs b/src/librustc_hir/hir.rs index f3dfec7ca7215..07b489a756267 100644 --- a/src/librustc_hir/hir.rs +++ b/src/librustc_hir/hir.rs @@ -2148,6 +2148,7 @@ pub struct Param<'hir> { pub attrs: &'hir [Attribute], pub hir_id: HirId, pub pat: &'hir Pat<'hir>, + pub ty_span: Span, pub span: Span, } diff --git a/src/librustc_trait_selection/traits/error_reporting/mod.rs b/src/librustc_trait_selection/traits/error_reporting/mod.rs index ad6e81ed3e889..6fb07f5e1954c 100644 --- a/src/librustc_trait_selection/traits/error_reporting/mod.rs +++ b/src/librustc_trait_selection/traits/error_reporting/mod.rs @@ -403,7 +403,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { } self.suggest_dereferences(&obligation, &mut err, &trait_ref, points_at_arg); - self.suggest_borrow_on_unsized_slice(&obligation.cause.code, &mut err); self.suggest_fn_call(&obligation, &mut err, &trait_ref, points_at_arg); self.suggest_remove_reference(&obligation, &mut err, &trait_ref); self.suggest_semicolon_removal(&obligation, &mut err, span, &trait_ref); diff --git a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs index 3daa5b3b1abdc..9bcc2a885fe12 100644 --- a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs +++ b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs @@ -43,12 +43,6 @@ pub trait InferCtxtExt<'tcx> { body_id: hir::HirId, ); - fn suggest_borrow_on_unsized_slice( - &self, - code: &ObligationCauseCode<'tcx>, - err: &mut DiagnosticBuilder<'_>, - ); - fn suggest_dereferences( &self, obligation: &PredicateObligation<'tcx>, @@ -515,32 +509,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { } } - /// When encountering an assignment of an unsized trait, like `let x = ""[..];`, provide a - /// suggestion to borrow the initializer in order to use have a slice instead. - fn suggest_borrow_on_unsized_slice( - &self, - code: &ObligationCauseCode<'tcx>, - err: &mut DiagnosticBuilder<'_>, - ) { - if let &ObligationCauseCode::VariableType(hir_id) = code { - let parent_node = self.tcx.hir().get_parent_node(hir_id); - if let Some(Node::Local(ref local)) = self.tcx.hir().find(parent_node) { - if let Some(ref expr) = local.init { - if let hir::ExprKind::Index(_, _) = expr.kind { - if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(expr.span) { - err.span_suggestion( - expr.span, - "consider borrowing here", - format!("&{}", snippet), - Applicability::MachineApplicable, - ); - } - } - } - } - } - } - /// Given a closure's `DefId`, return the given name of the closure. /// /// This doesn't account for reassignments, but it's only used for suggestions. @@ -1817,8 +1785,37 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { } } } - ObligationCauseCode::VariableType(_) => { - err.note("all local variables must have a statically known size"); + ObligationCauseCode::VariableType(hir_id) => { + let parent_node = self.tcx.hir().get_parent_node(hir_id); + match self.tcx.hir().find(parent_node) { + Some(Node::Local(hir::Local { + init: Some(hir::Expr { kind: hir::ExprKind::Index(_, _), span, .. }), + .. + })) => { + // When encountering an assignment of an unsized trait, like + // `let x = ""[..];`, provide a suggestion to borrow the initializer in + // order to use have a slice instead. + err.span_suggestion_verbose( + span.shrink_to_lo(), + "consider borrowing here", + "&".to_owned(), + Applicability::MachineApplicable, + ); + err.note("all local variables must have a statically known size"); + } + Some(Node::Param(param)) => { + err.span_suggestion_verbose( + param.ty_span.shrink_to_lo(), + "function arguments must have a statically known size, borrowed types \ + always have a known size", + "&".to_owned(), + Applicability::MachineApplicable, + ); + } + _ => { + err.note("all local variables must have a statically known size"); + } + } if !self.tcx.features().unsized_locals { err.help("unsized locals are gated as an unstable feature"); } diff --git a/src/test/ui/async-await/issue-72590-type-error-sized.stderr b/src/test/ui/async-await/issue-72590-type-error-sized.stderr index 95ed9513f357b..762afa6450a95 100644 --- a/src/test/ui/async-await/issue-72590-type-error-sized.stderr +++ b/src/test/ui/async-await/issue-72590-type-error-sized.stderr @@ -18,8 +18,11 @@ LL | async fn frob(self) {} | = help: within `Foo`, the trait `std::marker::Sized` is not implemented for `str` = note: required because it appears within the type `Foo` - = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | async fn frob(&self) {} + | ^ error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0277.stderr b/src/test/ui/error-codes/E0277.stderr index 8789bb9609bd4..203fc18915647 100644 --- a/src/test/ui/error-codes/E0277.stderr +++ b/src/test/ui/error-codes/E0277.stderr @@ -6,8 +6,11 @@ LL | fn f(p: Path) { } | = help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]` = note: required because it appears within the type `std::path::Path` - = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn f(p: &Path) { } + | ^ error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/E0277.rs:17:15 diff --git a/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr b/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr index 0775431a9d350..0195cc1481e74 100644 --- a/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr +++ b/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr @@ -5,8 +5,11 @@ LL | fn f(f: dyn FnOnce()) {} | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::FnOnce() + 'static)` - = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn f(f: &dyn FnOnce()) {} + | ^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-27078.stderr b/src/test/ui/issues/issue-27078.stderr index 313c294e8a1a5..4b031d26ad53b 100644 --- a/src/test/ui/issues/issue-27078.stderr +++ b/src/test/ui/issues/issue-27078.stderr @@ -5,12 +5,15 @@ LL | fn foo(self) -> &'static i32 { | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Self` - = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature help: consider further restricting `Self` | LL | fn foo(self) -> &'static i32 where Self: std::marker::Sized { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn foo(&self) -> &'static i32 { + | ^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-5883.stderr b/src/test/ui/issues/issue-5883.stderr index 149d882af78ff..897984d0ae410 100644 --- a/src/test/ui/issues/issue-5883.stderr +++ b/src/test/ui/issues/issue-5883.stderr @@ -5,8 +5,11 @@ LL | fn new_struct(r: dyn A + 'static) | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)` - = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn new_struct(r: &dyn A + 'static) + | ^ error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time --> $DIR/issue-5883.rs:8:8 diff --git a/src/test/ui/resolve/issue-5035-2.stderr b/src/test/ui/resolve/issue-5035-2.stderr index ec2882d6c6d73..4ed93ad3279ad 100644 --- a/src/test/ui/resolve/issue-5035-2.stderr +++ b/src/test/ui/resolve/issue-5035-2.stderr @@ -5,8 +5,11 @@ LL | fn foo(_x: K) {} | ^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn I + 'static)` - = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn foo(_x: &K) {} + | ^ error: aborting due to previous error diff --git a/src/test/ui/str/str-array-assignment.stderr b/src/test/ui/str/str-array-assignment.stderr index 0b1832d70ff86..52d3aefe125c0 100644 --- a/src/test/ui/str/str-array-assignment.stderr +++ b/src/test/ui/str/str-array-assignment.stderr @@ -19,13 +19,15 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t --> $DIR/str-array-assignment.rs:7:7 | LL | let v = s[..2]; - | ^ ------ help: consider borrowing here: `&s[..2]` - | | - | 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: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature +help: consider borrowing here + | +LL | let v = &s[..2]; + | ^ error[E0308]: mismatched types --> $DIR/str-array-assignment.rs:9:17 diff --git a/src/test/ui/suggestions/path-by-value.stderr b/src/test/ui/suggestions/path-by-value.stderr index 5bd50fea1cb6c..2b7c29e20cd31 100644 --- a/src/test/ui/suggestions/path-by-value.stderr +++ b/src/test/ui/suggestions/path-by-value.stderr @@ -6,8 +6,11 @@ LL | fn f(p: Path) { } | = help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]` = note: required because it appears within the type `std::path::Path` - = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn f(p: &Path) { } + | ^ error: aborting due to previous error diff --git a/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr b/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr index 082d787fb0b7b..daca91abff843 100644 --- a/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr +++ b/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr @@ -13,8 +13,11 @@ LL | fn foo(_x: Foo + Send) { | ^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn Foo + std::marker::Send + 'static)` - = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn foo(_x: &Foo + Send) { + | ^ error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/unsized6.stderr b/src/test/ui/unsized6.stderr index d566399e5ba00..82f1e87008d30 100644 --- a/src/test/ui/unsized6.stderr +++ b/src/test/ui/unsized6.stderr @@ -144,8 +144,11 @@ LL | fn g1(x: X) {} | this type parameter needs to be `std::marker::Sized` | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn g1(x: &X) {} + | ^ error[E0277]: the size for values of type `X` cannot be known at compilation time --> $DIR/unsized6.rs:40:22 @@ -156,8 +159,11 @@ LL | fn g2(x: X) {} | this type parameter needs to be `std::marker::Sized` | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature +help: function arguments must have a statically known size, borrowed types always have a known size + | +LL | fn g2(x: &X) {} + | ^ error: aborting due to 13 previous errors From c38b127d8463b595b5df93f3b8c4462d39d7cd0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 10 Jul 2020 18:47:53 -0700 Subject: [PATCH 6/7] Remove redundant explanatory `note` for type parameters --- .../traits/error_reporting/mod.rs | 7 ++++++- .../defaults-unsound-62211-1.stderr | 4 ---- .../defaults-unsound-62211-2.stderr | 4 ---- src/test/ui/associated-types/issue-63593.stderr | 1 - ...trait-with-supertraits-needing-sized-self.stderr | 1 - src/test/ui/async-await/issue-70818.stderr | 1 - src/test/ui/bad/bad-method-typaram-kind.stderr | 1 - src/test/ui/bound-suggestions.stderr | 6 ------ .../builtin-superkinds-double-superkind.stderr | 2 -- .../builtin-superkinds-in-metadata.stderr | 1 - .../builtin-superkinds-typaram-not-send.stderr | 1 - ...e-bounds-cant-promote-superkind-in-struct.stderr | 1 - src/test/ui/closures/closure-bounds-subtype.stderr | 1 - src/test/ui/dst/dst-object-from-unsized-type.stderr | 2 -- .../issue-68642-broken-llvm-ir.stderr | 1 - .../issue-68643-broken-mir.stderr | 1 - .../issue-68644-codegen-selection.stderr | 1 - .../issue-68645-codegen-fulfillment.stderr | 1 - src/test/ui/issues/issue-20005.stderr | 1 - src/test/ui/issues/issue-27060-2.stderr | 1 - src/test/ui/issues/issue-27078.stderr | 1 - .../ui/kindck/kindck-impl-type-params.nll.stderr | 2 -- src/test/ui/kindck/kindck-impl-type-params.stderr | 2 -- .../feature-gate-lazy_normalization_consts.stderr | 1 - src/test/ui/phantom-oibit.stderr | 2 -- .../deafult-generic-associated-type-bound.stderr | 1 - .../adt-param-with-implicit-sized-bound.stderr | 5 ----- .../ui/suggestions/restrict-type-argument.stderr | 6 ------ .../ui/traits/trait-suggest-where-clause.stderr | 3 --- .../generic_underconstrained2.stderr | 2 -- .../typeck-default-trait-impl-send-param.stderr | 1 - src/test/ui/union/union-sized-field.stderr | 3 --- src/test/ui/unsized/unsized-bare-typaram.stderr | 2 -- src/test/ui/unsized/unsized-enum.stderr | 1 - src/test/ui/unsized/unsized-enum2.stderr | 4 ---- .../unsized/unsized-inherent-impl-self-type.stderr | 1 - src/test/ui/unsized/unsized-struct.stderr | 2 -- .../ui/unsized/unsized-trait-impl-self-type.stderr | 1 - .../ui/unsized/unsized-trait-impl-trait-arg.stderr | 1 - src/test/ui/unsized3.stderr | 6 ------ src/test/ui/unsized5.stderr | 4 ---- src/test/ui/unsized6.stderr | 13 ------------- src/test/ui/unsized7.stderr | 1 - 43 files changed, 6 insertions(+), 98 deletions(-) diff --git a/src/librustc_trait_selection/traits/error_reporting/mod.rs b/src/librustc_trait_selection/traits/error_reporting/mod.rs index 6fb07f5e1954c..4ade1ce91632f 100644 --- a/src/librustc_trait_selection/traits/error_reporting/mod.rs +++ b/src/librustc_trait_selection/traits/error_reporting/mod.rs @@ -376,7 +376,12 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { // If it has a custom `#[rustc_on_unimplemented]` // error message, let's display it as the label! err.span_label(span, s.as_str()); - err.help(&explanation); + if !matches!(trait_ref.skip_binder().self_ty().kind, ty::Param(_)) { + // When the self type is a type param We don't need to "the trait + // `std::marker::Sized` is not implemented for `T`" as we will point + // at the type param with a label to suggest constraining it. + err.help(&explanation); + } } else { err.span_label(span, explanation); } diff --git a/src/test/ui/associated-types/defaults-unsound-62211-1.stderr b/src/test/ui/associated-types/defaults-unsound-62211-1.stderr index 69c310766c1cc..2ba854eac4665 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-1.stderr +++ b/src/test/ui/associated-types/defaults-unsound-62211-1.stderr @@ -21,7 +21,6 @@ LL | trait UncheckedCopy: Sized { LL | + AddAssign<&'static str> | ^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `Self += &'static str` | - = help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `Self` help: consider further restricting `Self` | LL | trait UncheckedCopy: Sized + std::ops::AddAssign<&'static str> { @@ -50,7 +49,6 @@ LL | trait UncheckedCopy: Sized { LL | + Display = Self; | ^^^^^^^ `Self` cannot be formatted with the default formatter | - = help: the trait `std::fmt::Display` is not implemented for `Self` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead help: consider further restricting `Self` | @@ -69,7 +67,6 @@ LL | + Display = Self; LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter | - = help: the trait `std::fmt::Display` is not implemented for `T` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead help: consider restricting type parameter `T` | @@ -105,7 +102,6 @@ LL | + AddAssign<&'static str> LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ no implementation for `T += &'static str` | - = help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `T` help: consider restricting type parameter `T` | LL | impl> UncheckedCopy for T {} diff --git a/src/test/ui/associated-types/defaults-unsound-62211-2.stderr b/src/test/ui/associated-types/defaults-unsound-62211-2.stderr index 84f0ba7529ea2..d4fd0ca98ee54 100644 --- a/src/test/ui/associated-types/defaults-unsound-62211-2.stderr +++ b/src/test/ui/associated-types/defaults-unsound-62211-2.stderr @@ -21,7 +21,6 @@ LL | trait UncheckedCopy: Sized { LL | + AddAssign<&'static str> | ^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `Self += &'static str` | - = help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `Self` help: consider further restricting `Self` | LL | trait UncheckedCopy: Sized + std::ops::AddAssign<&'static str> { @@ -50,7 +49,6 @@ LL | trait UncheckedCopy: Sized { LL | + Display = Self; | ^^^^^^^ `Self` cannot be formatted with the default formatter | - = help: the trait `std::fmt::Display` is not implemented for `Self` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead help: consider further restricting `Self` | @@ -69,7 +67,6 @@ LL | + Display = Self; LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter | - = help: the trait `std::fmt::Display` is not implemented for `T` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead help: consider restricting type parameter `T` | @@ -105,7 +102,6 @@ LL | + AddAssign<&'static str> LL | impl UncheckedCopy for T {} | ^^^^^^^^^^^^^ no implementation for `T += &'static str` | - = help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `T` help: consider restricting type parameter `T` | LL | impl> UncheckedCopy for T {} diff --git a/src/test/ui/associated-types/issue-63593.stderr b/src/test/ui/associated-types/issue-63593.stderr index c3db950c75844..be3b61665b11f 100644 --- a/src/test/ui/associated-types/issue-63593.stderr +++ b/src/test/ui/associated-types/issue-63593.stderr @@ -6,7 +6,6 @@ LL | trait MyTrait { LL | type This = Self; | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `Self` help: consider further restricting `Self` | LL | trait MyTrait: std::marker::Sized { diff --git a/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr b/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr index f2ed2d32bd1e0..7813d3b6596bf 100644 --- a/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr +++ b/src/test/ui/associated-types/trait-with-supertraits-needing-sized-self.stderr @@ -9,7 +9,6 @@ LL | trait ArithmeticOps: Add + Sub + Mul LL | pub trait Add { | --- required by this bound in `std::ops::Add` | - = help: the trait `std::marker::Sized` is not implemented for `Self` help: consider further restricting `Self` | LL | trait ArithmeticOps: Add + Sub + Mul + Div + std::marker::Sized {} diff --git a/src/test/ui/async-await/issue-70818.stderr b/src/test/ui/async-await/issue-70818.stderr index 5fb772fa10acb..2166420070a07 100644 --- a/src/test/ui/async-await/issue-70818.stderr +++ b/src/test/ui/async-await/issue-70818.stderr @@ -7,7 +7,6 @@ LL | LL | async { (ty, ty1) } | ------------------- this returned value is of type `impl std::future::Future` | - = help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `U` note: captured value is not `Send` --> $DIR/issue-70818.rs:6:18 | diff --git a/src/test/ui/bad/bad-method-typaram-kind.stderr b/src/test/ui/bad/bad-method-typaram-kind.stderr index 81fc961e3dea0..fd3999ae6fbec 100644 --- a/src/test/ui/bad/bad-method-typaram-kind.stderr +++ b/src/test/ui/bad/bad-method-typaram-kind.stderr @@ -4,7 +4,6 @@ error[E0277]: `T` cannot be sent between threads safely LL | 1.bar::(); | ^^^ `T` cannot be sent between threads safely | - = help: the trait `std::marker::Send` is not implemented for `T` help: consider further restricting this bound | LL | fn foo() { diff --git a/src/test/ui/bound-suggestions.stderr b/src/test/ui/bound-suggestions.stderr index b9bc503f5301a..623252a8c1139 100644 --- a/src/test/ui/bound-suggestions.stderr +++ b/src/test/ui/bound-suggestions.stderr @@ -4,7 +4,6 @@ error[E0277]: `impl Sized` doesn't implement `std::fmt::Debug` LL | println!("{:?}", t); | ^ `impl Sized` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | - = help: the trait `std::fmt::Debug` is not implemented for `impl Sized` = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting this bound @@ -18,7 +17,6 @@ error[E0277]: `T` doesn't implement `std::fmt::Debug` LL | println!("{:?}", t); | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | - = help: the trait `std::fmt::Debug` is not implemented for `T` = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `T` @@ -32,7 +30,6 @@ error[E0277]: `T` doesn't implement `std::fmt::Debug` LL | println!("{:?}", t); | ^ `T` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | - = help: the trait `std::fmt::Debug` is not implemented for `T` = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting this bound @@ -46,7 +43,6 @@ error[E0277]: `Y` doesn't implement `std::fmt::Debug` LL | println!("{:?} {:?}", x, y); | ^ `Y` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | - = help: the trait `std::fmt::Debug` is not implemented for `Y` = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting type parameter `Y` @@ -60,7 +56,6 @@ error[E0277]: `X` doesn't implement `std::fmt::Debug` LL | println!("{:?}", x); | ^ `X` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | - = help: the trait `std::fmt::Debug` is not implemented for `X` = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting this bound @@ -74,7 +69,6 @@ error[E0277]: `X` doesn't implement `std::fmt::Debug` LL | println!("{:?}", x); | ^ `X` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | - = help: the trait `std::fmt::Debug` is not implemented for `X` = note: required by `std::fmt::Debug::fmt` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting type parameter `X` diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr index 4e7b513629d05..7ff986ec38109 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr @@ -7,7 +7,6 @@ LL | LL | impl Foo for (T,) { } | ^^^ `T` cannot be sent between threads safely | - = help: within `(T,)`, the trait `std::marker::Send` is not implemented for `T` = note: required because it appears within the type `(T,)` help: consider further restricting this bound | @@ -23,7 +22,6 @@ LL | trait Foo : Send+Sync { } LL | impl Foo for (T,T) { } | ^^^ `T` cannot be shared between threads safely | - = help: within `(T, T)`, the trait `std::marker::Sync` is not implemented for `T` = note: required because it appears within the type `(T, T)` help: consider further restricting this bound | diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr index 3fb1af3a67cc2..9ee045edfe546 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr @@ -9,7 +9,6 @@ LL | impl RequiresRequiresShareAndSend for X { } LL | pub trait RequiresRequiresShareAndSend : RequiresShare + Send { } | ---- required by this bound in `trait_superkinds_in_metadata::RequiresRequiresShareAndSend` | - = help: within `X`, the trait `std::marker::Send` is not implemented for `T` = note: required because it appears within the type `X` help: consider further restricting this bound | diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr index 9c5073a1e49d7..ad80b3fa8d11f 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr @@ -7,7 +7,6 @@ LL | LL | impl Foo for T { } | ^^^ `T` cannot be sent between threads safely | - = help: the trait `std::marker::Send` is not implemented for `T` help: consider further restricting this bound | LL | impl Foo for T { } diff --git a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr index ffd70fac6b19b..273eae995538a 100644 --- a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr +++ b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr @@ -7,7 +7,6 @@ LL | struct X where F: FnOnce() + 'static + Send { LL | fn foo(blk: F) -> X where F: FnOnce() + 'static { | ^^^^ `F` cannot be sent between threads safely | - = help: the trait `std::marker::Send` is not implemented for `F` help: consider further restricting this bound | LL | fn foo(blk: F) -> X where F: FnOnce() + 'static + std::marker::Send { diff --git a/src/test/ui/closures/closure-bounds-subtype.stderr b/src/test/ui/closures/closure-bounds-subtype.stderr index 691864c9e1d45..7df29d5a098a0 100644 --- a/src/test/ui/closures/closure-bounds-subtype.stderr +++ b/src/test/ui/closures/closure-bounds-subtype.stderr @@ -7,7 +7,6 @@ LL | fn take_const_owned(_: F) where F: FnOnce() + Sync + Send { LL | take_const_owned(f); | ^ `F` cannot be shared between threads safely | - = help: the trait `std::marker::Sync` is not implemented for `F` help: consider further restricting this bound | LL | fn give_owned(f: F) where F: FnOnce() + Send + std::marker::Sync { diff --git a/src/test/ui/dst/dst-object-from-unsized-type.stderr b/src/test/ui/dst/dst-object-from-unsized-type.stderr index d6e9aaab7cf39..da8ead885c898 100644 --- a/src/test/ui/dst/dst-object-from-unsized-type.stderr +++ b/src/test/ui/dst/dst-object-from-unsized-type.stderr @@ -6,7 +6,6 @@ LL | fn test1(t: &T) { LL | let u: &dyn Foo = t; | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `T` = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `T` cannot be known at compilation time @@ -17,7 +16,6 @@ LL | fn test2(t: &T) { LL | let v: &dyn Foo = t as &dyn Foo; | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `T` = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `str` cannot be known at compilation time diff --git a/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr b/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr index 89cc5dfd06018..2fab7ffb66050 100644 --- a/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr +++ b/src/test/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr @@ -16,7 +16,6 @@ LL | type F<'a>: Fn() -> u32; LL | type F<'a> = Self; | ^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `T` | - = help: the trait `std::ops::Fn<()>` is not implemented for `T` = note: wrap the `T` in a closure with no arguments: `|| { /* code */ } help: consider restricting type parameter `T` | diff --git a/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr b/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr index efd3287853f03..186e142138be2 100644 --- a/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr +++ b/src/test/ui/generic-associated-types/issue-68643-broken-mir.stderr @@ -16,7 +16,6 @@ LL | type F<'a>: Fn() -> u32; LL | type F<'a> = Self; | ^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `T` | - = help: the trait `std::ops::Fn<()>` is not implemented for `T` = note: wrap the `T` in a closure with no arguments: `|| { /* code */ } help: consider restricting type parameter `T` | diff --git a/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr b/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr index 5da924a512f00..d16bdcbbb6b00 100644 --- a/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr +++ b/src/test/ui/generic-associated-types/issue-68644-codegen-selection.stderr @@ -16,7 +16,6 @@ LL | type F<'a>: Fn() -> u32; LL | type F<'a> = Self; | ^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `T` | - = help: the trait `std::ops::Fn<()>` is not implemented for `T` = note: wrap the `T` in a closure with no arguments: `|| { /* code */ } help: consider restricting type parameter `T` | diff --git a/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr b/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr index 12d84ab6a369b..72c42917c83c9 100644 --- a/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr +++ b/src/test/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr @@ -16,7 +16,6 @@ LL | type F<'a>: Fn() -> u32; LL | type F<'a> = Self; | ^^^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `T` | - = help: the trait `std::ops::Fn<()>` is not implemented for `T` = note: wrap the `T` in a closure with no arguments: `|| { /* code */ } help: consider restricting type parameter `T` | diff --git a/src/test/ui/issues/issue-20005.stderr b/src/test/ui/issues/issue-20005.stderr index 7bd2578344458..cbaa7507244a3 100644 --- a/src/test/ui/issues/issue-20005.stderr +++ b/src/test/ui/issues/issue-20005.stderr @@ -7,7 +7,6 @@ LL | trait From { LL | ) -> >::Result where Dst: From { | ^^^^^^^^^^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `Self` help: consider further restricting `Self` | LL | ) -> >::Result where Dst: From, Self: std::marker::Sized { diff --git a/src/test/ui/issues/issue-27060-2.stderr b/src/test/ui/issues/issue-27060-2.stderr index 881fae1942335..96696fabd9338 100644 --- a/src/test/ui/issues/issue-27060-2.stderr +++ b/src/test/ui/issues/issue-27060-2.stderr @@ -6,7 +6,6 @@ LL | pub struct Bad { LL | data: T, | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `T` = 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 diff --git a/src/test/ui/issues/issue-27078.stderr b/src/test/ui/issues/issue-27078.stderr index 4b031d26ad53b..de1810e99aac6 100644 --- a/src/test/ui/issues/issue-27078.stderr +++ b/src/test/ui/issues/issue-27078.stderr @@ -4,7 +4,6 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation LL | fn foo(self) -> &'static i32 { | ^^^^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `Self` = help: unsized locals are gated as an unstable feature help: consider further restricting `Self` | diff --git a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr index a2f70a8c24082..eb400cf061547 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr @@ -4,7 +4,6 @@ error[E0277]: `T` cannot be sent between threads safely LL | let a = &t as &dyn Gettable; | ^^ `T` cannot be sent between threads safely | - = help: the trait `std::marker::Send` is not implemented for `T` = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` help: consider restricting type parameter `T` @@ -31,7 +30,6 @@ error[E0277]: `T` cannot be sent between threads safely LL | let a: &dyn Gettable = &t; | ^^ `T` cannot be sent between threads safely | - = help: the trait `std::marker::Send` is not implemented for `T` = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` help: consider restricting type parameter `T` diff --git a/src/test/ui/kindck/kindck-impl-type-params.stderr b/src/test/ui/kindck/kindck-impl-type-params.stderr index cc98f1d9f34b8..ab9dfc9b8a779 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.stderr @@ -4,7 +4,6 @@ error[E0277]: `T` cannot be sent between threads safely LL | let a = &t as &dyn Gettable; | ^^ `T` cannot be sent between threads safely | - = help: the trait `std::marker::Send` is not implemented for `T` = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` help: consider restricting type parameter `T` @@ -31,7 +30,6 @@ error[E0277]: `T` cannot be sent between threads safely LL | let a: &dyn Gettable = &t; | ^^ `T` cannot be sent between threads safely | - = help: the trait `std::marker::Send` is not implemented for `T` = note: required because of the requirements on the impl of `Gettable` for `S` = note: required for the cast to the object type `dyn Gettable` help: consider restricting type parameter `T` diff --git a/src/test/ui/lazy_normalization_consts/feature-gate-lazy_normalization_consts.stderr b/src/test/ui/lazy_normalization_consts/feature-gate-lazy_normalization_consts.stderr index 97c7417839825..98bf9923823d7 100644 --- a/src/test/ui/lazy_normalization_consts/feature-gate-lazy_normalization_consts.stderr +++ b/src/test/ui/lazy_normalization_consts/feature-gate-lazy_normalization_consts.stderr @@ -9,7 +9,6 @@ LL | fn test() { LL | let _: [u8; sof::()]; | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `T` help: consider relaxing the implicit `Sized` restriction | LL | pub const fn sof() -> usize { diff --git a/src/test/ui/phantom-oibit.stderr b/src/test/ui/phantom-oibit.stderr index fd0307f15c79a..e143747d637ee 100644 --- a/src/test/ui/phantom-oibit.stderr +++ b/src/test/ui/phantom-oibit.stderr @@ -7,7 +7,6 @@ LL | fn is_zen(_: T) {} LL | is_zen(x) | ^ `T` cannot be shared between threads safely | - = help: the trait `std::marker::Sync` is not implemented for `T` = note: required because of the requirements on the impl of `Zen` for `&T` = note: required because it appears within the type `std::marker::PhantomData<&T>` = note: required because it appears within the type `Guard<'_, T>` @@ -25,7 +24,6 @@ LL | fn is_zen(_: T) {} LL | is_zen(x) | ^ `T` cannot be shared between threads safely | - = help: the trait `std::marker::Sync` is not implemented for `T` = note: required because of the requirements on the impl of `Zen` for `&T` = note: required because it appears within the type `std::marker::PhantomData<&T>` = note: required because it appears within the type `Guard<'_, T>` diff --git a/src/test/ui/specialization/deafult-generic-associated-type-bound.stderr b/src/test/ui/specialization/deafult-generic-associated-type-bound.stderr index 7f3c49e753fd7..3da8725d88a0c 100644 --- a/src/test/ui/specialization/deafult-generic-associated-type-bound.stderr +++ b/src/test/ui/specialization/deafult-generic-associated-type-bound.stderr @@ -24,7 +24,6 @@ LL | type U<'a>: PartialEq<&'a Self>; LL | default type U<'a> = &'a T; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `T == T` | - = help: the trait `std::cmp::PartialEq` is not implemented for `T` = note: required because of the requirements on the impl of `std::cmp::PartialEq` for `&'a T` help: consider further restricting this bound | diff --git a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr index 0b08b4a16a692..f4c0d0f96c428 100644 --- a/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr +++ b/src/test/ui/suggestions/adt-param-with-implicit-sized-bound.stderr @@ -9,7 +9,6 @@ LL | struct Struct5{ LL | _t: X, | ^^^^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `T` help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` --> $DIR/adt-param-with-implicit-sized-bound.rs:18:10 | @@ -27,7 +26,6 @@ LL | fn func1() -> Struct1; LL | struct Struct1{ | - required by this bound in `Struct1` | - = help: the trait `std::marker::Sized` is not implemented for `Self` help: consider further restricting `Self` | LL | fn func1() -> Struct1 where Self: std::marker::Sized; @@ -46,7 +44,6 @@ LL | fn func2<'a>() -> Struct2<'a, Self>; LL | struct Struct2<'a, T>{ | - required by this bound in `Struct2` | - = help: the trait `std::marker::Sized` is not implemented for `Self` help: consider further restricting `Self` | LL | fn func2<'a>() -> Struct2<'a, Self> where Self: std::marker::Sized; @@ -65,7 +62,6 @@ LL | fn func3() -> Struct3; LL | struct Struct3{ | - required by this bound in `Struct3` | - = help: the trait `std::marker::Sized` is not implemented for `Self` help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` --> $DIR/adt-param-with-implicit-sized-bound.rs:14:16 | @@ -87,7 +83,6 @@ LL | fn func4() -> Struct4; LL | struct Struct4{ | - required by this bound in `Struct4` | - = help: the trait `std::marker::Sized` is not implemented for `Self` help: consider further restricting `Self` | LL | fn func4() -> Struct4 where Self: std::marker::Sized; diff --git a/src/test/ui/suggestions/restrict-type-argument.stderr b/src/test/ui/suggestions/restrict-type-argument.stderr index 0c52778b0d886..33af13d943f74 100644 --- a/src/test/ui/suggestions/restrict-type-argument.stderr +++ b/src/test/ui/suggestions/restrict-type-argument.stderr @@ -7,7 +7,6 @@ LL | fn is_send(val: T) {} LL | is_send(val); | ^^^ `impl Sync` cannot be sent between threads safely | - = help: the trait `std::marker::Send` is not implemented for `impl Sync` help: consider further restricting this bound | LL | fn use_impl_sync(val: impl Sync + std::marker::Send) { @@ -22,7 +21,6 @@ LL | fn is_send(val: T) {} LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | - = help: the trait `std::marker::Send` is not implemented for `S` help: consider further restricting this bound | LL | fn use_where(val: S) where S: Sync + std::marker::Send { @@ -37,7 +35,6 @@ LL | fn is_send(val: T) {} LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | - = help: the trait `std::marker::Send` is not implemented for `S` help: consider further restricting this bound | LL | fn use_bound(val: S) { @@ -52,7 +49,6 @@ LL | fn is_send(val: T) {} LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | - = help: the trait `std::marker::Send` is not implemented for `S` help: consider further restricting this bound | LL | Sync + std::marker::Send @@ -67,7 +63,6 @@ LL | fn is_send(val: T) {} LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | - = help: the trait `std::marker::Send` is not implemented for `S` help: consider further restricting this bound | LL | fn use_bound_and_where(val: S) where S: std::fmt::Debug + std::marker::Send { @@ -82,7 +77,6 @@ LL | fn is_send(val: T) {} LL | is_send(val); | ^^^ `S` cannot be sent between threads safely | - = help: the trait `std::marker::Send` is not implemented for `S` help: consider restricting type parameter `S` | LL | fn use_unbound(val: S) { diff --git a/src/test/ui/traits/trait-suggest-where-clause.stderr b/src/test/ui/traits/trait-suggest-where-clause.stderr index b8069f9ddb0f6..86a313baa5c38 100644 --- a/src/test/ui/traits/trait-suggest-where-clause.stderr +++ b/src/test/ui/traits/trait-suggest-where-clause.stderr @@ -11,8 +11,6 @@ LL | mem::size_of::(); | LL | pub const fn size_of() -> usize { | - required by this bound in `std::mem::size_of` - | - = help: the trait `std::marker::Sized` is not implemented for `U` error[E0277]: the size for values of type `U` cannot be known at compilation time --> $DIR/trait-suggest-where-clause.rs:10:5 @@ -28,7 +26,6 @@ LL | mem::size_of::>(); LL | pub const fn size_of() -> usize { | - required by this bound in `std::mem::size_of` | - = help: within `Misc`, the trait `std::marker::Sized` is not implemented for `U` = note: required because it appears within the type `Misc` error[E0277]: the trait bound `u64: std::convert::From` is not satisfied diff --git a/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr b/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr index 247d68ef2a1f0..28e30cbdd9d96 100644 --- a/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr @@ -19,7 +19,6 @@ LL | type Underconstrained = impl 'static; LL | 5u32 | ---- this returned value is of type `u32` | - = help: the trait `std::fmt::Debug` is not implemented for `U` = note: the return type of a function must have a statically known size help: consider restricting type parameter `U` | @@ -35,7 +34,6 @@ LL | type Underconstrained2 = impl 'static; LL | 5u32 | ---- this returned value is of type `u32` | - = help: the trait `std::fmt::Debug` is not implemented for `V` = note: the return type of a function must have a statically known size help: consider restricting type parameter `V` | diff --git a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr index 9cba3578449c3..7398b48a238d1 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr @@ -7,7 +7,6 @@ LL | is_send::() LL | fn is_send() { | ---- required by this bound in `is_send` | - = help: the trait `std::marker::Send` is not implemented for `T` help: consider restricting type parameter `T` | LL | fn foo() { diff --git a/src/test/ui/union/union-sized-field.stderr b/src/test/ui/union/union-sized-field.stderr index eb169987ccdb9..d7224e46add3d 100644 --- a/src/test/ui/union/union-sized-field.stderr +++ b/src/test/ui/union/union-sized-field.stderr @@ -6,7 +6,6 @@ LL | union Foo { LL | value: T, | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `T` = 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 @@ -26,7 +25,6 @@ LL | struct Foo2 { LL | value: T, | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `T` = 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 @@ -46,7 +44,6 @@ LL | enum Foo3 { LL | Value(T), | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `T` = 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 diff --git a/src/test/ui/unsized/unsized-bare-typaram.stderr b/src/test/ui/unsized/unsized-bare-typaram.stderr index 998cd7a527c9b..19978ae24cacb 100644 --- a/src/test/ui/unsized/unsized-bare-typaram.stderr +++ b/src/test/ui/unsized/unsized-bare-typaram.stderr @@ -7,8 +7,6 @@ LL | fn foo() { bar::() } | - ^ doesn't have a size known at compile-time | | | this type parameter needs to be `std::marker::Sized` - | - = help: the trait `std::marker::Sized` is not implemented for `T` error: aborting due to previous error diff --git a/src/test/ui/unsized/unsized-enum.stderr b/src/test/ui/unsized/unsized-enum.stderr index cb06e707dcaa8..fdfdb9b4e2a5b 100644 --- a/src/test/ui/unsized/unsized-enum.stderr +++ b/src/test/ui/unsized/unsized-enum.stderr @@ -9,7 +9,6 @@ LL | fn foo2() { not_sized::>() } | | | this type parameter needs to be `std::marker::Sized` | - = help: the trait `std::marker::Sized` is not implemented for `T` help: you could relax the implicit `Sized` bound on `U` if it were used through indirection like `&U` or `Box` --> $DIR/unsized-enum.rs:4:10 | diff --git a/src/test/ui/unsized/unsized-enum2.stderr b/src/test/ui/unsized/unsized-enum2.stderr index 82f395740d5ad..742abc39209e6 100644 --- a/src/test/ui/unsized/unsized-enum2.stderr +++ b/src/test/ui/unsized/unsized-enum2.stderr @@ -7,7 +7,6 @@ LL | // parameter LL | VA(W), | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `W` = 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 @@ -28,7 +27,6 @@ LL | enum E { LL | VB{x: X}, | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `X` = 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 @@ -49,7 +47,6 @@ LL | enum E { LL | VC(isize, Y), | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `Y` = 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 @@ -70,7 +67,6 @@ LL | enum E { LL | VD{u: isize, x: Z}, | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `Z` = 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 diff --git a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr index 0d08f70c558be..50b54593f3aa1 100644 --- a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr @@ -9,7 +9,6 @@ LL | impl S5 { | | | this type parameter needs to be `std::marker::Sized` | - = help: the trait `std::marker::Sized` is not implemented for `X` help: you could relax the implicit `Sized` bound on `Y` if it were used through indirection like `&Y` or `Box` --> $DIR/unsized-inherent-impl-self-type.rs:5:11 | diff --git a/src/test/ui/unsized/unsized-struct.stderr b/src/test/ui/unsized/unsized-struct.stderr index d796fcd1a6b64..0c8529bf1a9af 100644 --- a/src/test/ui/unsized/unsized-struct.stderr +++ b/src/test/ui/unsized/unsized-struct.stderr @@ -9,7 +9,6 @@ LL | fn foo2() { not_sized::>() } | | | this type parameter needs to be `std::marker::Sized` | - = help: the trait `std::marker::Sized` is not implemented for `T` help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box` --> $DIR/unsized-struct.rs:4:12 | @@ -29,7 +28,6 @@ LL | fn bar2() { is_sized::>() } | | | this type parameter needs to be `std::marker::Sized` | - = help: within `Bar`, the trait `std::marker::Sized` is not implemented for `T` = note: required because it appears within the type `Bar` error: aborting due to 2 previous errors diff --git a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr index 623c83c4d6f07..4514208a90dc9 100644 --- a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr @@ -9,7 +9,6 @@ LL | impl T3 for S5 { | | | this type parameter needs to be `std::marker::Sized` | - = help: the trait `std::marker::Sized` is not implemented for `X` help: you could relax the implicit `Sized` bound on `Y` if it were used through indirection like `&Y` or `Box` --> $DIR/unsized-trait-impl-self-type.rs:8:11 | diff --git a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr index 1dc9e313d91a6..f48d4ef9f1461 100644 --- a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr @@ -9,7 +9,6 @@ LL | impl T2 for S4 { | | | this type parameter needs to be `std::marker::Sized` | - = help: the trait `std::marker::Sized` is not implemented for `X` help: consider relaxing the implicit `Sized` restriction | LL | trait T2 { diff --git a/src/test/ui/unsized3.stderr b/src/test/ui/unsized3.stderr index d5c79c71a2349..ddddae4eaba57 100644 --- a/src/test/ui/unsized3.stderr +++ b/src/test/ui/unsized3.stderr @@ -9,7 +9,6 @@ LL | f2::(x); LL | fn f2(x: &X) { | - required by this bound in `f2` | - = help: the trait `std::marker::Sized` is not implemented for `X` help: consider relaxing the implicit `Sized` restriction | LL | fn f2(x: &X) { @@ -26,7 +25,6 @@ LL | f4::(x); LL | fn f4(x: &X) { | - required by this bound in `f4` | - = help: the trait `std::marker::Sized` is not implemented for `X` help: consider relaxing the implicit `Sized` restriction | LL | fn f4(x: &X) { @@ -43,7 +41,6 @@ LL | fn f8(x1: &S, x2: &S) { LL | f5(x1); | ^^ doesn't have a size known at compile-time | - = help: within `S`, the trait `std::marker::Sized` is not implemented for `X` = note: required because it appears within the type `S` help: consider relaxing the implicit `Sized` restriction | @@ -58,7 +55,6 @@ LL | fn f9(x1: Box>) { LL | f5(&(*x1, 34)); | ^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `S`, the trait `std::marker::Sized` is not implemented for `X` = note: required because it appears within the type `S` = note: only the last element of a tuple may have a dynamically sized type @@ -70,7 +66,6 @@ LL | fn f10(x1: Box>) { LL | f5(&(32, *x1)); | ^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `({integer}, S)`, the trait `std::marker::Sized` is not implemented for `X` = note: required because it appears within the type `S` = note: required because it appears within the type `({integer}, S)` = note: tuples must have a statically known size to be initialized @@ -86,7 +81,6 @@ LL | fn f10(x1: Box>) { LL | f5(&(32, *x1)); | ^^^^^^^^^^ doesn't have a size known at compile-time | - = help: within `({integer}, S)`, the trait `std::marker::Sized` is not implemented for `X` = note: required because it appears within the type `S` = note: required because it appears within the type `({integer}, S)` help: consider relaxing the implicit `Sized` restriction diff --git a/src/test/ui/unsized5.stderr b/src/test/ui/unsized5.stderr index 9bdcc0399b833..80cf4baeab794 100644 --- a/src/test/ui/unsized5.stderr +++ b/src/test/ui/unsized5.stderr @@ -6,7 +6,6 @@ LL | struct S1 { LL | f1: X, | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `X` = 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 @@ -27,7 +26,6 @@ LL | f: isize, LL | g: X, | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `X` = 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 @@ -83,7 +81,6 @@ LL | enum E { LL | V1(X, isize), | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `X` = 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 @@ -103,7 +100,6 @@ LL | enum F { LL | V2{f1: X, f: isize}, | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `X` = 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 diff --git a/src/test/ui/unsized6.stderr b/src/test/ui/unsized6.stderr index 82f1e87008d30..f045bfe2444bc 100644 --- a/src/test/ui/unsized6.stderr +++ b/src/test/ui/unsized6.stderr @@ -7,7 +7,6 @@ LL | fn f1(x: &X) { LL | let y: Y; | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `Y` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -20,7 +19,6 @@ LL | let _: W; // <-- this is OK, no bindings created, no initializer. LL | let _: (isize, (X, isize)); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `X` = note: only the last element of a tuple may have a dynamically sized type error[E0277]: the size for values of type `Z` cannot be known at compilation time @@ -32,7 +30,6 @@ LL | fn f1(x: &X) { LL | let y: (isize, (Z, usize)); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `Z` = note: only the last element of a tuple may have a dynamically sized type error[E0277]: the size for values of type `X` cannot be known at compilation time @@ -43,7 +40,6 @@ LL | fn f2(x: &X) { LL | let y: X; | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `X` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -56,7 +52,6 @@ LL | fn f2(x: &X) { LL | let y: (isize, (Y, isize)); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `Y` = note: only the last element of a tuple may have a dynamically sized type error[E0277]: the size for values of type `X` cannot be known at compilation time @@ -67,7 +62,6 @@ LL | fn f3(x1: Box, x2: Box, x3: Box) { LL | let y: X = *x1; | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `X` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -80,7 +74,6 @@ LL | fn f3(x1: Box, x2: Box, x3: Box) { LL | let y = *x2; | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `X` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -93,7 +86,6 @@ LL | fn f3(x1: Box, x2: Box, x3: Box) { LL | let (y, z) = (*x3, 4); | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `X` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -105,7 +97,6 @@ LL | fn f4(x1: Box, x2: Box, x3: Box) { LL | let y: X = *x1; | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `X` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -118,7 +109,6 @@ LL | fn f4(x1: Box, x2: Box, x3: Box) { LL | let y = *x2; | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `X` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -131,7 +121,6 @@ LL | fn f4(x1: Box, x2: Box, x3: Box) { LL | let (y, z) = (*x3, 4); | ^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `X` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature @@ -143,7 +132,6 @@ LL | fn g1(x: X) {} | | | this type parameter needs to be `std::marker::Sized` | - = help: the trait `std::marker::Sized` is not implemented for `X` = help: unsized locals are gated as an unstable feature help: function arguments must have a statically known size, borrowed types always have a known size | @@ -158,7 +146,6 @@ LL | fn g2(x: X) {} | | | this type parameter needs to be `std::marker::Sized` | - = help: the trait `std::marker::Sized` is not implemented for `X` = help: unsized locals are gated as an unstable feature help: function arguments must have a statically known size, borrowed types always have a known size | diff --git a/src/test/ui/unsized7.stderr b/src/test/ui/unsized7.stderr index 868c9ea429e24..7dbddd4ed2443 100644 --- a/src/test/ui/unsized7.stderr +++ b/src/test/ui/unsized7.stderr @@ -9,7 +9,6 @@ LL | impl T1 for S3 { | | | this type parameter needs to be `std::marker::Sized` | - = help: the trait `std::marker::Sized` is not implemented for `X` help: consider relaxing the implicit `Sized` restriction | LL | trait T1 { From ff75395ca833a3ea4276d09f5cbe63be63a8c554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 14 Jul 2020 12:18:01 -0700 Subject: [PATCH 7/7] Reword message --- .../traits/error_reporting/suggestions.rs | 3 +- src/test/ui/issues/issue-27060-2.stderr | 2 +- src/test/ui/issues/issue-35988.stderr | 2 +- src/test/ui/union/union-sized-field.stderr | 6 +-- src/test/ui/union/union-unsized.stderr | 4 +- src/test/ui/unsized/unsized-enum2.stderr | 40 +++++++++---------- src/test/ui/unsized5.stderr | 12 +++--- 7 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs index 9bcc2a885fe12..2c6589eb2bdf9 100644 --- a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs +++ b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs @@ -1882,7 +1882,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { Applicability::MachineApplicable, ); err.multipart_suggestion( - "heap allocated types always have a statically known size", + "the `Box` type always has a statically known size and allocates its contents \ + in the heap", vec![ (span.shrink_to_lo(), "Box<".to_string()), (span.shrink_to_hi(), ">".to_string()), diff --git a/src/test/ui/issues/issue-27060-2.stderr b/src/test/ui/issues/issue-27060-2.stderr index 96696fabd9338..5dbcc96e87488 100644 --- a/src/test/ui/issues/issue-27060-2.stderr +++ b/src/test/ui/issues/issue-27060-2.stderr @@ -12,7 +12,7 @@ help: borrowed types always have a statically known size | LL | data: &T, | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | data: Box, | ^^^^ ^ diff --git a/src/test/ui/issues/issue-35988.stderr b/src/test/ui/issues/issue-35988.stderr index a137549693844..0f0b80a9ff8d3 100644 --- a/src/test/ui/issues/issue-35988.stderr +++ b/src/test/ui/issues/issue-35988.stderr @@ -11,7 +11,7 @@ help: borrowed types always have a statically known size | LL | V(&[Box]), | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | V(Box<[Box]>), | ^^^^ ^ diff --git a/src/test/ui/union/union-sized-field.stderr b/src/test/ui/union/union-sized-field.stderr index d7224e46add3d..b916bbe8ad10a 100644 --- a/src/test/ui/union/union-sized-field.stderr +++ b/src/test/ui/union/union-sized-field.stderr @@ -12,7 +12,7 @@ help: borrowed types always have a statically known size | LL | value: &T, | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | value: Box, | ^^^^ ^ @@ -31,7 +31,7 @@ help: borrowed types always have a statically known size | LL | value: &T, | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | value: Box, | ^^^^ ^ @@ -50,7 +50,7 @@ help: borrowed types always have a statically known size | LL | Value(&T), | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | Value(Box), | ^^^^ ^ diff --git a/src/test/ui/union/union-unsized.stderr b/src/test/ui/union/union-unsized.stderr index 574f182ecc687..f62a3b4d14b97 100644 --- a/src/test/ui/union/union-unsized.stderr +++ b/src/test/ui/union/union-unsized.stderr @@ -11,7 +11,7 @@ help: borrowed types always have a statically known size | LL | a: &str, | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | a: Box, | ^^^^ ^ @@ -29,7 +29,7 @@ help: borrowed types always have a statically known size | LL | b: &str, | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | b: Box, | ^^^^ ^ diff --git a/src/test/ui/unsized/unsized-enum2.stderr b/src/test/ui/unsized/unsized-enum2.stderr index 742abc39209e6..988c310167682 100644 --- a/src/test/ui/unsized/unsized-enum2.stderr +++ b/src/test/ui/unsized/unsized-enum2.stderr @@ -13,7 +13,7 @@ help: borrowed types always have a statically known size | LL | VA(&W), | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VA(Box), | ^^^^ ^ @@ -33,7 +33,7 @@ help: borrowed types always have a statically known size | LL | VB{x: &X}, | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VB{x: Box}, | ^^^^ ^ @@ -53,7 +53,7 @@ help: borrowed types always have a statically known size | LL | VC(isize, &Y), | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VC(isize, Box), | ^^^^ ^ @@ -73,7 +73,7 @@ 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 +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VD{u: isize, x: Box}, | ^^^^ ^ @@ -91,7 +91,7 @@ help: borrowed types always have a statically known size | LL | VE(&[u8]), | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VE(Box<[u8]>), | ^^^^ ^ @@ -109,7 +109,7 @@ help: borrowed types always have a statically known size | LL | VF{x: &str}, | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VF{x: Box}, | ^^^^ ^ @@ -127,7 +127,7 @@ help: borrowed types always have a statically known size | LL | VG(isize, &[f32]), | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VG(isize, Box<[f32]>), | ^^^^ ^ @@ -145,7 +145,7 @@ 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 +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VH{u: isize, x: Box<[u32]>}, | ^^^^ ^ @@ -163,7 +163,7 @@ help: borrowed types always have a statically known size | LL | VM(&dyn Foo), | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VM(Box), | ^^^^ ^ @@ -181,7 +181,7 @@ help: borrowed types always have a statically known size | LL | VN{x: &dyn Bar}, | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VN{x: Box}, | ^^^^ ^ @@ -199,7 +199,7 @@ help: borrowed types always have a statically known size | LL | VO(isize, &dyn FooBar), | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VO(isize, Box), | ^^^^ ^ @@ -217,7 +217,7 @@ 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 +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VP{u: isize, x: Box}, | ^^^^ ^ @@ -235,7 +235,7 @@ 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 +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VQ(Box<<&'static [i8] as Deref>::Target>), | ^^^^ ^ @@ -253,7 +253,7 @@ 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 +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VR{x: Box<<&'static [char] as Deref>::Target>}, | ^^^^ ^ @@ -271,7 +271,7 @@ 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 +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VS(isize, Box<<&'static [f64] as Deref>::Target>), | ^^^^ ^ @@ -289,7 +289,7 @@ 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 +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VT{u: isize, x: Box<<&'static [i32] as Deref>::Target>}, | ^^^^ ^ @@ -308,7 +308,7 @@ help: borrowed types always have a statically known size | LL | VI(&Path1), | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VI(Box), | ^^^^ ^ @@ -327,7 +327,7 @@ help: borrowed types always have a statically known size | LL | VJ{x: &Path2}, | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VJ{x: Box}, | ^^^^ ^ @@ -346,7 +346,7 @@ help: borrowed types always have a statically known size | LL | VK(isize, &Path3), | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VK(isize, Box), | ^^^^ ^ @@ -365,7 +365,7 @@ 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 +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | VL{u: isize, x: Box}, | ^^^^ ^ diff --git a/src/test/ui/unsized5.stderr b/src/test/ui/unsized5.stderr index 80cf4baeab794..3fd0b429becc1 100644 --- a/src/test/ui/unsized5.stderr +++ b/src/test/ui/unsized5.stderr @@ -12,7 +12,7 @@ help: borrowed types always have a statically known size | LL | f1: &X, | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | f1: Box, | ^^^^ ^ @@ -32,7 +32,7 @@ help: borrowed types always have a statically known size | LL | g: &X, | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | g: Box, | ^^^^ ^ @@ -50,7 +50,7 @@ help: borrowed types always have a statically known size | LL | f: &str, | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | f: Box, | ^^^^ ^ @@ -68,7 +68,7 @@ help: borrowed types always have a statically known size | LL | f: &[u8], | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | f: Box<[u8]>, | ^^^^ ^ @@ -87,7 +87,7 @@ help: borrowed types always have a statically known size | LL | V1(&X, isize), | ^ -help: heap allocated types always have a statically known size +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | V1(Box, isize), | ^^^^ ^ @@ -106,7 +106,7 @@ 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 +help: the `Box` type always has a statically known size and allocates its contents in the heap | LL | V2{f1: Box, f: isize}, | ^^^^ ^