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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 2 additions & 2 deletions
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() { }

0 commit comments

Comments
 (0)