diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index d5416e393f46..9c0508f1234e 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -93,7 +93,9 @@ impl !Send for *mut T { } #[lang = "sized"] #[rustc_on_unimplemented( message="`{Self}` does not have a constant size known at compile-time", - label="`{Self}` does not have a constant size known at compile-time" + label="`{Self}` does not have a constant size known at compile-time", + note="to learn more, visit ", )] #[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable pub trait Sized { diff --git a/src/test/ui/const-unsized.stderr b/src/test/ui/const-unsized.stderr index ca434541cc28..6baeab90db22 100644 --- a/src/test/ui/const-unsized.stderr +++ b/src/test/ui/const-unsized.stderr @@ -5,6 +5,7 @@ LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` + = note: to learn more, visit = note: constant expressions must have a statically known size error[E0277]: `str` does not have a constant size known at compile-time @@ -14,6 +15,7 @@ LL | const CONST_FOO: str = *"foo"; | ^^^^^^ `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit = note: constant expressions must have a statically known size error[E0277]: `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time @@ -23,6 +25,7 @@ LL | static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` + = note: to learn more, visit = note: constant expressions must have a statically known size error[E0277]: `str` does not have a constant size known at compile-time @@ -32,6 +35,7 @@ LL | static STATIC_BAR: str = *"bar"; | ^^^^^^ `str` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit = note: constant expressions must have a statically known size error: aborting due to 4 previous errors diff --git a/src/test/ui/error-codes/E0277.stderr b/src/test/ui/error-codes/E0277.stderr index 9cfd42b9c195..e1c3183104a1 100644 --- a/src/test/ui/error-codes/E0277.stderr +++ b/src/test/ui/error-codes/E0277.stderr @@ -5,6 +5,7 @@ LL | fn f(p: Path) { } | ^ `[u8]` does not have a constant 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 diff --git a/src/test/ui/feature-gate-trivial_bounds.stderr b/src/test/ui/feature-gate-trivial_bounds.stderr index 3c6d87e059a2..9344e78c23c1 100644 --- a/src/test/ui/feature-gate-trivial_bounds.stderr +++ b/src/test/ui/feature-gate-trivial_bounds.stderr @@ -94,6 +94,7 @@ LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `str` does not have a constant 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 @@ -106,6 +107,7 @@ LL | | } | |_^ `A + 'static` does not have a constant size known at compile-time | = help: within `Dst`, the trait `std::marker::Sized` is not implemented for `A + 'static` + = note: to learn more, visit = note: required because it appears within the type `Dst` = help: see issue #48214 = help: add #![feature(trivial_bounds)] to the crate attributes to enable @@ -119,6 +121,7 @@ LL | | } | |_^ `str` does not have a constant 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/generator/sized-yield.stderr b/src/test/ui/generator/sized-yield.stderr index 45f066590536..7918101850e0 100644 --- a/src/test/ui/generator/sized-yield.stderr +++ b/src/test/ui/generator/sized-yield.stderr @@ -9,6 +9,7 @@ LL | | }; | |____^ `str` does not have a constant 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]: `str` does not have a constant size known at compile-time @@ -18,6 +19,7 @@ LL | unsafe { gen.resume(); } | ^^^^^^ `str` does not have a constant 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/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index 2b00c20e201f..70914ded9609 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -223,6 +223,7 @@ LL | let _ = fat_v as *const Foo; //~ ERROR `[u8]` does not have a constant | ^^^^^ `[u8]` does not have a constant 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 `Foo` error[E0277]: `str` does not have a constant size known at compile-time @@ -232,6 +233,7 @@ LL | let _ = a as *const Foo; //~ ERROR `str` does not have a constant size | ^ `str` does not have a constant 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 `Foo` error[E0606]: casting `&{float}` as `f32` is invalid diff --git a/src/test/ui/resolve/issue-5035-2.stderr b/src/test/ui/resolve/issue-5035-2.stderr index 554e97a12815..1488f6b99853 100644 --- a/src/test/ui/resolve/issue-5035-2.stderr +++ b/src/test/ui/resolve/issue-5035-2.stderr @@ -5,6 +5,7 @@ LL | fn foo(_x: K) {} | ^^ `I + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `I + 'static` + = note: to learn more, visit = note: all local variables must have a statically known size error: aborting due to previous error diff --git a/src/test/ui/suggestions/str-array-assignment.stderr b/src/test/ui/suggestions/str-array-assignment.stderr index 91e86e344b41..acf51f89fc48 100644 --- a/src/test/ui/suggestions/str-array-assignment.stderr +++ b/src/test/ui/suggestions/str-array-assignment.stderr @@ -28,6 +28,7 @@ LL | let v = s[..2]; | `str` does not have a constant 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 error[E0308]: mismatched types diff --git a/src/test/ui/trait-suggest-where-clause.stderr b/src/test/ui/trait-suggest-where-clause.stderr index d31e92880372..d87641d8d0fa 100644 --- a/src/test/ui/trait-suggest-where-clause.stderr +++ b/src/test/ui/trait-suggest-where-clause.stderr @@ -5,6 +5,7 @@ LL | mem::size_of::(); | ^^^^^^^^^^^^^^^^^ `U` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `U` + = note: to learn more, visit = help: consider adding a `where U: std::marker::Sized` bound = note: required by `std::mem::size_of` @@ -15,6 +16,7 @@ LL | mem::size_of::>(); | ^^^^^^^^^^^^^^^^^^^^^^^ `U` does not have a constant size known at compile-time | = help: within `Misc`, the trait `std::marker::Sized` is not implemented for `U` + = note: to learn more, visit = help: consider adding a `where U: std::marker::Sized` bound = note: required because it appears within the type `Misc` = note: required by `std::mem::size_of` @@ -52,6 +54,7 @@ LL | mem::size_of::<[T]>(); | ^^^^^^^^^^^^^^^^^^^ `[T]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[T]` + = note: to learn more, visit = note: required by `std::mem::size_of` error[E0277]: `[&U]` does not have a constant size known at compile-time @@ -61,6 +64,7 @@ LL | mem::size_of::<[&U]>(); | ^^^^^^^^^^^^^^^^^^^^ `[&U]` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[&U]` + = note: to learn more, visit = note: required by `std::mem::size_of` 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 ce6de86cff9b..9fdc5af0481a 100644 --- a/src/test/ui/union/union-sized-field.stderr +++ b/src/test/ui/union/union-sized-field.stderr @@ -5,6 +5,7 @@ LL | value: T, | ^^^^^^^^ `T` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound = note: no field of a union may have a dynamically sized type @@ -15,6 +16,7 @@ LL | value: T, | ^^^^^^^^ `T` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound = note: only the last field of a struct may have a dynamically sized type @@ -25,6 +27,7 @@ LL | Value(T), | ^ `T` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type diff --git a/src/test/ui/unsized-enum2.stderr b/src/test/ui/unsized-enum2.stderr index 2784bf5af1b9..91b8e5def7ed 100644 --- a/src/test/ui/unsized-enum2.stderr +++ b/src/test/ui/unsized-enum2.stderr @@ -5,6 +5,7 @@ LL | VA(W), | ^ `W` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `W` + = note: to learn more, visit = help: consider adding a `where W: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type @@ -15,6 +16,7 @@ LL | VB{x: X}, | ^^^^ `X` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type @@ -25,6 +27,7 @@ LL | VC(isize, Y), | ^ `Y` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Y` + = note: to learn more, visit = help: consider adding a `where Y: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type @@ -35,6 +38,7 @@ LL | VD{u: isize, x: Z}, | ^^^^ `Z` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Z` + = note: to learn more, visit = help: consider adding a `where Z: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type @@ -45,6 +49,7 @@ LL | VE([u8]), | ^^^^ `[u8]` does not have a constant 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 error[E0277]: `str` does not have a constant size known at compile-time @@ -54,6 +59,7 @@ LL | VF{x: str}, | ^^^^^^ `str` does not have a constant 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 error[E0277]: `[f32]` does not have a constant size known at compile-time @@ -63,6 +69,7 @@ LL | VG(isize, [f32]), | ^^^^^ `[f32]` does not have a constant 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 error[E0277]: `[u32]` does not have a constant size known at compile-time @@ -72,6 +79,7 @@ LL | VH{u: isize, x: [u32]}, | ^^^^^^^^ `[u32]` does not have a constant 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 error[E0277]: `Foo + 'static` does not have a constant size known at compile-time @@ -81,6 +89,7 @@ LL | VM(Foo), | ^^^ `Foo + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Foo + 'static` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `Bar + 'static` does not have a constant size known at compile-time @@ -90,6 +99,7 @@ LL | VN{x: Bar}, | ^^^^^^ `Bar + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Bar + 'static` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `FooBar + 'static` does not have a constant size known at compile-time @@ -99,6 +109,7 @@ LL | VO(isize, FooBar), | ^^^^^^ `FooBar + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `FooBar + 'static` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `BarFoo + 'static` does not have a constant size known at compile-time @@ -108,6 +119,7 @@ LL | VP{u: isize, x: BarFoo}, | ^^^^^^^^^ `BarFoo + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `BarFoo + 'static` + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: `[i8]` does not have a constant size known at compile-time @@ -117,6 +129,7 @@ LL | VQ(<&'static [i8] as Deref>::Target), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[i8]` does not have a constant 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 error[E0277]: `[char]` does not have a constant size known at compile-time @@ -126,6 +139,7 @@ LL | VR{x: <&'static [char] as Deref>::Target}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[char]` does not have a constant 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 error[E0277]: `[f64]` does not have a constant size known at compile-time @@ -135,6 +149,7 @@ LL | VS(isize, <&'static [f64] as Deref>::Target), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[f64]` does not have a constant 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 error[E0277]: `[i32]` does not have a constant size known at compile-time @@ -144,6 +159,7 @@ LL | VT{u: isize, x: <&'static [i32] as Deref>::Target}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[i32]` does not have a constant 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 error[E0277]: `PathHelper1 + 'static` does not have a constant size known at compile-time @@ -153,6 +169,7 @@ LL | VI(Path1), | ^^^^^ `PathHelper1 + 'static` does not have a constant size known at compile-time | = help: within `Path1`, the trait `std::marker::Sized` is not implemented for `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 @@ -163,6 +180,7 @@ LL | VJ{x: Path2}, | ^^^^^^^^ `PathHelper2 + 'static` does not have a constant size known at compile-time | = help: within `Path2`, the trait `std::marker::Sized` is not implemented for `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 @@ -173,6 +191,7 @@ LL | VK(isize, Path3), | ^^^^^ `PathHelper3 + 'static` does not have a constant size known at compile-time | = help: within `Path3`, the trait `std::marker::Sized` is not implemented for `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 @@ -183,6 +202,7 @@ LL | VL{u: isize, x: Path4}, | ^^^^^^^^ `PathHelper4 + 'static` does not have a constant size known at compile-time | = help: within `Path4`, the trait `std::marker::Sized` is not implemented for `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