Skip to content

Commit d4bfae1

Browse files
committed
Update message for !Sized types
1 parent 76a4952 commit d4bfae1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+209
-207
lines changed

src/libcore/marker.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ impl<T: ?Sized> !Send for *mut T { }
9292
#[stable(feature = "rust1", since = "1.0.0")]
9393
#[lang = "sized"]
9494
#[rustc_on_unimplemented(
95-
message="`{Self}` does not have a constant size known at compile-time",
96-
label="`{Self}` does not have a constant size known at compile-time",
95+
message="the size for value values of type `{Self}` cannot be known at compilation time",
96+
label="doesn't have a size known at compile-time",
9797
note="to learn more, visit <https://doc.rust-lang.org/book/second-edition/\
9898
ch19-04-advanced-types.html#dynamically-sized-types--sized>",
9999
)]

src/test/compile-fail/associated-types-unsized.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ trait Get {
1414
}
1515

1616
fn foo<T:Get>(t: T) {
17-
let x = t.get(); //~ ERROR `<T as Get>::Value` does not have a constant size known at
17+
let x = t.get(); //~ ERROR the size for value values of type
1818
}
1919

2020
fn main() {

src/test/compile-fail/bad-sized.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ trait Trait {}
1313
pub fn main() {
1414
let x: Vec<Trait + Sized> = Vec::new();
1515
//~^ ERROR only auto traits can be used as additional traits in a trait object
16-
//~| ERROR `Trait` does not have a constant size known at compile-time
17-
//~| ERROR `Trait` does not have a constant size known at compile-time
16+
//~| ERROR the size for value values of type
17+
//~| ERROR the size for value values of type
1818
}

src/test/compile-fail/dst-bad-assign-2.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ pub fn main() {
4343
let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} };
4444
let z: Box<ToBar> = Box::new(Bar1 {f: 36});
4545
f5.ptr = *z;
46-
//~^ ERROR `ToBar` does not have a constant size known at compile-time
46+
//~^ ERROR the size for value values of type
47+
4748
}

src/test/compile-fail/dst-bad-assign-3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ pub fn main() {
4545
//~| expected type `ToBar`
4646
//~| found type `Bar1`
4747
//~| expected trait ToBar, found struct `Bar1`
48-
//~| ERROR `ToBar` does not have a constant size known at compile-time
48+
//~| ERROR the size for value values of type
4949
}

src/test/compile-fail/dst-bad-assign.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ pub fn main() {
4747
//~| expected type `ToBar`
4848
//~| found type `Bar1`
4949
//~| expected trait ToBar, found struct `Bar1`
50-
//~| ERROR `ToBar` does not have a constant size known at compile-time
50+
//~| ERROR the size for value values of type
5151
}

src/test/compile-fail/dst-bad-deep-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ pub fn main() {
1919
let f: ([isize; 3],) = ([5, 6, 7],);
2020
let g: &([isize],) = &f;
2121
let h: &(([isize],),) = &(*g,);
22-
//~^ ERROR `[isize]` does not have a constant size known at compile-time
22+
//~^ ERROR the size for value values of type
2323
}

src/test/compile-fail/dst-bad-deep.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ pub fn main() {
2121
let f: Fat<[isize; 3]> = Fat { ptr: [5, 6, 7] };
2222
let g: &Fat<[isize]> = &f;
2323
let h: &Fat<Fat<[isize]>> = &Fat { ptr: *g };
24-
//~^ ERROR `[isize]` does not have a constant size known at compile-time
24+
//~^ ERROR the size for value values of type
2525
}

src/test/compile-fail/dst-object-from-unsized-type.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ impl Foo for [u8] {}
1616

1717
fn test1<T: ?Sized + Foo>(t: &T) {
1818
let u: &Foo = t;
19-
//~^ ERROR `T` does not have a constant size known at compile-time
19+
//~^ ERROR the size for value values of type
2020
}
2121

2222
fn test2<T: ?Sized + Foo>(t: &T) {
2323
let v: &Foo = t as &Foo;
24-
//~^ ERROR `T` does not have a constant size known at compile-time
24+
//~^ ERROR the size for value values of type
2525
}
2626

2727
fn test3() {
2828
let _: &[&Foo] = &["hi"];
29-
//~^ ERROR `str` does not have a constant size known at compile-time
29+
//~^ ERROR the size for value values of type
3030
}
3131

3232
fn test4(x: &[u8]) {
3333
let _: &Foo = x as &Foo;
34-
//~^ ERROR `[u8]` does not have a constant size known at compile-time
34+
//~^ ERROR the size for value values of type
3535
}
3636

3737
fn main() { }

src/test/compile-fail/dst-sized-trait-param.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
trait Foo<T> : Sized { fn take(self, x: &T) { } } // Note: T is sized
1616

1717
impl Foo<[isize]> for usize { }
18-
//~^ ERROR `[isize]` does not have a constant size known at compile-time
18+
//~^ ERROR the size for value values of type
1919

2020
impl Foo<isize> for [usize] { }
21-
//~^ ERROR `[usize]` does not have a constant size known at compile-time
21+
//~^ ERROR the size for value values of type
2222

2323
pub fn main() { }

src/test/compile-fail/extern-types-unsized.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ fn assert_sized<T>() { }
3030

3131
fn main() {
3232
assert_sized::<A>();
33-
//~^ ERROR `A` does not have a constant size known at compile-time
33+
//~^ ERROR the size for value values of type
3434

3535
assert_sized::<Foo>();
36-
//~^ ERROR `A` does not have a constant size known at compile-time
36+
//~^ ERROR the size for value values of type
3737

3838
assert_sized::<Bar<A>>();
39-
//~^ ERROR `A` does not have a constant size known at compile-time
39+
//~^ ERROR the size for value values of type
4040

4141
assert_sized::<Bar<Bar<A>>>();
42-
//~^ ERROR `A` does not have a constant size known at compile-time
42+
//~^ ERROR the size for value values of type
4343
}

src/test/compile-fail/issue-14366.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
fn main() {
1212
let _x = "test" as &::std::any::Any;
13-
//~^ ERROR `str` does not have a constant size known at compile-time
13+
//~^ ERROR the size for value values of type
1414
}

src/test/compile-fail/issue-15756.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: ChunksMut<'a,T>)
1515
{
1616
for
1717
&mut something
18-
//~^ ERROR `[T]` does not have a constant size known at compile-time
18+
//~^ ERROR the size for value values of type
1919
in arg2
2020
{
2121
}

src/test/compile-fail/issue-17651.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313

1414
fn main() {
1515
(|| Box::new(*(&[0][..])))();
16-
//~^ ERROR `[{integer}]` does not have a constant size known at compile-time
16+
//~^ ERROR the size for value values of type
1717
}

src/test/compile-fail/issue-18107.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub trait AbstractRenderer {}
1212

1313
fn _create_render(_: &()) ->
1414
AbstractRenderer
15-
//~^ ERROR: `AbstractRenderer + 'static` does not have a constant size known at compile-time
15+
//~^ ERROR the size for value values of type
1616
{
1717
match 0 {
1818
_ => unimplemented!()

src/test/compile-fail/issue-18919.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
type FuncType<'f> = Fn(&isize) -> isize + 'f;
1212

1313
fn ho_func(f: Option<FuncType>) {
14-
//~^ ERROR: `for<'r> std::ops::Fn(&'r isize) -> isize` does not have a constant size known at
14+
//~^ ERROR the size for value values of type
1515
}
1616

1717
fn main() {}

src/test/compile-fail/issue-20005.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ trait From<Src> {
1515
}
1616

1717
trait To {
18-
fn to<Dst>( //~ ERROR `Self` does not have a constant size known at compile-time
18+
fn to<Dst>( //~ ERROR the size for value values of type
1919
self
2020
) -> <Dst as From<Self>>::Result where Dst: From<Self> {
2121
From::from(self)

src/test/compile-fail/issue-20433.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ struct The;
1414

1515
impl The {
1616
fn iceman(c: Vec<[i32]>) {}
17-
//~^ ERROR `[i32]` does not have a constant size known at compile-time
17+
//~^ ERROR the size for value values of type
1818
}

src/test/compile-fail/issue-20605.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
fn changer<'a>(mut things: Box<Iterator<Item=&'a mut u8>>) {
1212
for item in *things { *item = 0 }
13-
//~^ ERROR `std::iter::Iterator<Item=&mut u8>` does not have a constant size known at compile-time
13+
//~^ ERROR the size for value values of type
1414
}
1515

1616
fn main() {}

src/test/compile-fail/issue-22874.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
struct Table {
1212
rows: [[String]],
13-
//~^ ERROR `[std::string::String]` does not have a constant size known at compile-time
13+
//~^ ERROR the size for value values of type
1414
}
1515

1616
fn f(table: &Table) -> &[String] {

src/test/compile-fail/issue-23281.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub struct Struct;
1414

1515
impl Struct {
1616
pub fn function(funs: Vec<Fn() -> ()>) {}
17-
//~^ ERROR `std::ops::Fn() + 'static` does not have a constant size known at compile-time
17+
//~^ ERROR the size for value values of type
1818
}
1919

2020
fn main() {}

src/test/compile-fail/issue-24446.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
fn main() {
1212
static foo: Fn() -> u32 = || -> u32 {
13-
//~^ ERROR: mismatched types
14-
//~| ERROR: `std::ops::Fn() -> u32 + 'static` does not have a constant size known at
13+
//~^ ERROR mismatched types
14+
//~| ERROR the size for value values of type
1515
0
1616
};
1717
}

src/test/compile-fail/issue-27060-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#[repr(packed)]
1212
pub struct Bad<T: ?Sized> {
13-
data: T, //~ ERROR `T` does not have a constant size known at compile-time
13+
data: T, //~ ERROR the size for value values of type
1414
}
1515

1616
fn main() {}

src/test/compile-fail/issue-27078.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
trait Foo {
1414
const BAR: i32;
1515
fn foo(self) -> &'static i32 {
16-
//~^ ERROR `Self` does not have a constant size known at compile-time
16+
//~^ ERROR the size for value values of type
1717
&<Self>::BAR
1818
}
1919
}

src/test/compile-fail/issue-35988.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
enum E {
1212
V([Box<E>]),
13-
//~^ ERROR `[std::boxed::Box<E>]` does not have a constant size known at compile-time
13+
//~^ ERROR the size for value values of type
1414
}
1515

1616
fn main() {}

src/test/compile-fail/issue-38954.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
// except according to those terms.
1010

1111
fn _test(ref _p: str) {}
12-
//~^ ERROR `str` does not have a constant size known at compile-time
12+
//~^ ERROR the size for value values of type
1313

1414
fn main() { }

src/test/compile-fail/issue-41229-ref-str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
// except according to those terms.
1010

1111
pub fn example(ref s: str) {}
12-
//~^ ERROR `str` does not have a constant size known at compile-time
12+
//~^ ERROR the size for value values of type
1313

1414
fn main() {}

src/test/compile-fail/issue-42312.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ use std::ops::Deref;
1212

1313
pub trait Foo {
1414
fn baz(_: Self::Target) where Self: Deref {}
15-
//~^ ERROR `<Self as std::ops::Deref>::Target` does not have a constant size known at
15+
//~^ ERROR the size for value values of type
1616
}
1717

1818
pub fn f(_: ToString) {}
19-
//~^ ERROR `std::string::ToString + 'static` does not have a constant size known at compile-time
19+
//~^ ERROR the size for value values of type
2020

2121
fn main() { }

src/test/compile-fail/issue-5883.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ struct Struct {
1515
}
1616

1717
fn new_struct(r: A+'static)
18-
-> Struct { //~^ ERROR `A + 'static` does not have a constant size known at compile-time
19-
//~^ ERROR `A + 'static` does not have a constant size known at compile-time
18+
-> Struct { //~^ ERROR the size for value values of type
19+
//~^ ERROR the size for value values of type
2020
Struct { r: r }
2121
}
2222

src/test/compile-fail/range-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ pub fn main() {
2222
// Unsized type.
2323
let arr: &[_] = &[1, 2, 3];
2424
let range = *arr..;
25-
//~^ ERROR `[{integer}]` does not have a constant size known at compile-time
25+
//~^ ERROR the size for value values of type
2626
}

src/test/compile-fail/str-mut-idx.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ fn bot<T>() -> T { loop {} }
1212

1313
fn mutate(s: &mut str) {
1414
s[1..2] = bot();
15-
//~^ ERROR `str` does not have a constant size known at compile-time
16-
//~| ERROR `str` does not have a constant size known at compile-time
15+
//~^ ERROR the size for value values of type
16+
//~| ERROR the size for value values of type
1717
s[1usize] = bot();
1818
//~^ ERROR the type `str` cannot be mutably indexed by `usize`
1919
}

src/test/compile-fail/substs-ppaux.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ fn foo<'z>() where &'z (): Sized {
5656
//[normal]~| found type `fn() {foo::<'static>}`
5757

5858
<str as Foo<u8>>::bar;
59-
//[verbose]~^ ERROR `str` does not have a constant size known at compile-time
60-
//[normal]~^^ ERROR `str` does not have a constant size known at compile-time
59+
//[verbose]~^ ERROR the size for value values of type
60+
//[normal]~^^ ERROR the size for value values of type
6161
}

src/test/compile-fail/trait-bounds-not-on-bare-trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ trait Foo {
1515
// This should emit the less confusing error, not the more confusing one.
1616

1717
fn foo(_x: Foo + Send) {
18-
//~^ ERROR `Foo + std::marker::Send + 'static` does not have a constant size known at
18+
//~^ ERROR the size for value values of type
1919
}
2020

2121
fn main() { }

src/test/compile-fail/union/union-unsized.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212

1313
union U {
1414
a: str,
15-
//~^ ERROR `str` does not have a constant size known at compile-time
15+
//~^ ERROR the size for value values of type
16+
1617
b: u8,
1718
}
1819

1920
union W {
2021
a: u8,
2122
b: str,
22-
//~^ ERROR `str` does not have a constant size known at compile-time
23+
//~^ ERROR the size for value values of type
2324
}
2425

2526
fn main() {}

src/test/compile-fail/unsized-bare-typaram.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
fn bar<T: Sized>() { }
1212
fn foo<T: ?Sized>() { bar::<T>() }
13-
//~^ ERROR `T` does not have a constant size known at compile-time
13+
//~^ ERROR the size for value values of type
1414
fn main() { }

src/test/compile-fail/unsized-enum.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn not_sized<T: ?Sized>() { }
1515
enum Foo<U> { FooSome(U), FooNone }
1616
fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
1717
fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
18-
//~^ ERROR `T` does not have a constant size known at compile-time
18+
//~^ ERROR the size for value values of type
1919
//
2020
// Not OK: `T` is not sized.
2121

src/test/compile-fail/unsized-inherent-impl-self-type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
struct S5<Y>(Y);
1616

1717
impl<X: ?Sized> S5<X> {
18-
//~^ ERROR `X` does not have a constant size known at compile-time
18+
//~^ ERROR the size for value values of type
1919
}
2020

2121
fn main() { }

src/test/compile-fail/unsized-struct.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ fn not_sized<T: ?Sized>() { }
1515
struct Foo<T> { data: T }
1616
fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
1717
fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
18-
//~^ ERROR `T` does not have a constant size known at compile-time
18+
//~^ ERROR the size for value values of type
1919
//
2020
// Not OK: `T` is not sized.
2121

2222
struct Bar<T: ?Sized> { data: T }
2323
fn bar1<T: ?Sized>() { not_sized::<Bar<T>>() }
2424
fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
25-
//~^ ERROR `T` does not have a constant size known at compile-time
25+
//~^ ERROR the size for value values of type
2626
//
2727
// Not OK: `Bar<T>` is not sized, but it should be.
2828

src/test/compile-fail/unsized-trait-impl-self-type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ trait T3<Z: ?Sized> {
1818
struct S5<Y>(Y);
1919

2020
impl<X: ?Sized> T3<X> for S5<X> {
21-
//~^ ERROR `X` does not have a constant size known at compile-time
21+
//~^ ERROR the size for value values of type
2222
}
2323

2424
fn main() { }

src/test/compile-fail/unsized-trait-impl-trait-arg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ trait T2<Z> {
1616
}
1717
struct S4<Y: ?Sized>(Box<Y>);
1818
impl<X: ?Sized> T2<X> for S4<X> {
19-
//~^ ERROR `X` does not have a constant size known at compile-time
19+
//~^ ERROR the size for value values of type
2020
}
2121

2222
fn main() { }

0 commit comments

Comments
 (0)