Add link to book for Sized errors

This commit is contained in:
Esteban Küber 2018-06-09 18:37:52 -07:00
parent 776544f011
commit f1dee43887
11 changed files with 44 additions and 1 deletions

View File

@ -93,7 +93,9 @@ impl<T: ?Sized> !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 <https://doc.rust-lang.org/book/second-edition/\
ch19-04-advanced-types.html#dynamically-sized-types--sized>",
)]
#[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable
pub trait Sized {

View File

@ -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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: constant expressions must have a statically known size
error: aborting due to 4 previous errors

View File

@ -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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: required because it appears within the type `std::path::Path`
= note: all local variables must have a statically known size

View File

@ -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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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<A + 'static>`, the trait `std::marker::Sized` is not implemented for `A + 'static`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: required because it appears within the type `Dst<A + 'static>`
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= help: see issue #48214
= help: add #![feature(trivial_bounds)] to the crate attributes to enable

View File

@ -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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
error: aborting due to 2 previous errors

View File

@ -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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: required for the cast to the object type `Foo`
error[E0606]: casting `&{float}` as `f32` is invalid

View File

@ -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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: all local variables must have a statically known size
error: aborting due to previous error

View File

@ -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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: all local variables must have a statically known size
error[E0308]: mismatched types

View File

@ -5,6 +5,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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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::<Misc<U>>();
| ^^^^^^^^^^^^^^^^^^^^^^^ `U` does not have a constant size known at compile-time
|
= help: within `Misc<U>`, the trait `std::marker::Sized` is not implemented for `U`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= help: consider adding a `where U: std::marker::Sized` bound
= note: required because it appears within the type `Misc<U>`
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: required by `std::mem::size_of`
error: aborting due to 7 previous errors

View File

@ -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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= help: consider adding a `where T: std::marker::Sized` bound
= note: no field of an enum variant may have a dynamically sized type

View File

@ -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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= 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 <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
= note: required because it appears within the type `Path4`
= note: no field of an enum variant may have a dynamically sized type