Skip to content

Commit b6a3f12

Browse files
author
Lukas Markeffsky
committed
change std::marker::Sized to just Sized
1 parent ee7e717 commit b6a3f12

25 files changed

+69
-76
lines changed

compiler/rustc_middle/src/ty/diagnostics.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,10 @@ pub fn suggest_constraining_type_params<'a>(
252252
{
253253
let mut sized_constraints =
254254
constraints.extract_if(|(_, def_id)| *def_id == tcx.lang_items().sized_trait());
255-
if let Some((constraint, def_id)) = sized_constraints.next() {
255+
if let Some((_, def_id)) = sized_constraints.next() {
256256
applicability = Applicability::MaybeIncorrect;
257257

258-
err.span_label(
259-
param.span,
260-
format!("this type parameter needs to be `{}`", constraint),
261-
);
258+
err.span_label(param.span, "this type parameter needs to be `Sized`");
262259
suggest_changing_unsized_bound(generics, &mut suggestions, param, def_id);
263260
}
264261
}

tests/ui/const-generics/const-argument-if-length.full.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
22
--> $DIR/const-argument-if-length.rs:15:12
33
|
44
LL | pub struct AtLeastByte<T: ?Sized> {
5-
| - this type parameter needs to be `std::marker::Sized`
5+
| - this type parameter needs to be `Sized`
66
LL | value: T,
77
| ^ doesn't have a size known at compile-time
88
|

tests/ui/const-generics/const-argument-if-length.min.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
1111
--> $DIR/const-argument-if-length.rs:15:12
1212
|
1313
LL | pub struct AtLeastByte<T: ?Sized> {
14-
| - this type parameter needs to be `std::marker::Sized`
14+
| - this type parameter needs to be `Sized`
1515
LL | value: T,
1616
| ^ doesn't have a size known at compile-time
1717
|

tests/ui/dst/dst-object-from-unsized-type.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
22
--> $DIR/dst-object-from-unsized-type.rs:8:23
33
|
44
LL | fn test1<T: ?Sized + Foo>(t: &T) {
5-
| - this type parameter needs to be `std::marker::Sized`
5+
| - this type parameter needs to be `Sized`
66
LL | let u: &dyn Foo = t;
77
| ^ doesn't have a size known at compile-time
88
|
@@ -17,7 +17,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
1717
--> $DIR/dst-object-from-unsized-type.rs:13:23
1818
|
1919
LL | fn test2<T: ?Sized + Foo>(t: &T) {
20-
| - this type parameter needs to be `std::marker::Sized`
20+
| - this type parameter needs to be `Sized`
2121
LL | let v: &dyn Foo = t as &dyn Foo;
2222
| ^ doesn't have a size known at compile-time
2323
|

tests/ui/generic-associated-types/issue-88287.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim
22
--> $DIR/issue-88287.rs:34:9
33
|
44
LL | type SearchFutureTy<'f, A, B: 'f>
5-
| - this type parameter needs to be `std::marker::Sized`
5+
| - this type parameter needs to be `Sized`
66
...
77
LL | async move { todo!() }
88
| ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time

tests/ui/offset-of/offset-of-dst-field.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
7070
--> $DIR/offset-of-dst-field.rs:50:5
7171
|
7272
LL | fn generic_with_maybe_sized<T: ?Sized>() -> usize {
73-
| - this type parameter needs to be `std::marker::Sized`
73+
| - this type parameter needs to be `Sized`
7474
LL | offset_of!(Delta<T>, z)
7575
| ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
7676
|

tests/ui/packed/issue-27060-2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
22
--> $DIR/issue-27060-2.rs:3:11
33
|
44
LL | pub struct Bad<T: ?Sized> {
5-
| - this type parameter needs to be `std::marker::Sized`
5+
| - this type parameter needs to be `Sized`
66
LL | data: T,
77
| ^ doesn't have a size known at compile-time
88
|

tests/ui/suggestions/adt-param-with-implicit-sized-bound.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
22
--> $DIR/adt-param-with-implicit-sized-bound.rs:25:9
33
|
44
LL | struct Struct5<T: ?Sized>{
5-
| - this type parameter needs to be `std::marker::Sized`
5+
| - this type parameter needs to be `Sized`
66
LL | _t: X<T>,
77
| ^^^^ doesn't have a size known at compile-time
88
|

tests/ui/suggestions/removal-of-multiline-trait-bound-in-where-clause.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
44
LL | fn foo<T>(foo: Wrapper<T>)
55
| - ^^^^^^^^^^ doesn't have a size known at compile-time
66
| |
7-
| this type parameter needs to be `std::marker::Sized`
7+
| this type parameter needs to be `Sized`
88
|
99
note: required by a bound in `Wrapper`
1010
--> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:1:16
@@ -33,7 +33,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
3333
LL | fn bar<T>(foo: Wrapper<T>)
3434
| - ^^^^^^^^^^ doesn't have a size known at compile-time
3535
| |
36-
| this type parameter needs to be `std::marker::Sized`
36+
| this type parameter needs to be `Sized`
3737
|
3838
note: required by a bound in `Wrapper`
3939
--> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:1:16
@@ -58,7 +58,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
5858
LL | fn qux<T>(foo: Wrapper<T>)
5959
| - ^^^^^^^^^^ doesn't have a size known at compile-time
6060
| |
61-
| this type parameter needs to be `std::marker::Sized`
61+
| this type parameter needs to be `Sized`
6262
|
6363
note: required by a bound in `Wrapper`
6464
--> $DIR/removal-of-multiline-trait-bound-in-where-clause.rs:1:16

tests/ui/trait-bounds/apit-unsized.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the size for values of type `impl Iterator<Item = i32> + ?Sized` c
22
--> $DIR/apit-unsized.rs:1:8
33
|
44
LL | fn foo(_: impl Iterator<Item = i32> + ?Sized) {}
5-
| ^ ---------------------------------- this type parameter needs to be `std::marker::Sized`
5+
| ^ ---------------------------------- this type parameter needs to be `Sized`
66
| |
77
| doesn't have a size known at compile-time
88
|
@@ -21,7 +21,7 @@ error[E0277]: the size for values of type `impl ?Sized` cannot be known at compi
2121
--> $DIR/apit-unsized.rs:2:8
2222
|
2323
LL | fn bar(_: impl ?Sized) {}
24-
| ^ ----------- this type parameter needs to be `std::marker::Sized`
24+
| ^ ----------- this type parameter needs to be `Sized`
2525
| |
2626
| doesn't have a size known at compile-time
2727
|

tests/ui/trait-bounds/unsized-bound.stderr

+13-17
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `B` cannot be known at compilation tim
44
LL | impl<A, B> Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {}
55
| - ^^^^^^ doesn't have a size known at compile-time
66
| |
7-
| this type parameter needs to be `std::marker::Sized`
7+
| this type parameter needs to be `Sized`
88
|
99
= note: required because it appears within the type `(A, B)`
1010
note: required by a bound in `Trait`
@@ -28,7 +28,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim
2828
LL | impl<A, B> Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {}
2929
| - ^^^^^^ doesn't have a size known at compile-time
3030
| |
31-
| this type parameter needs to be `std::marker::Sized`
31+
| this type parameter needs to be `Sized`
3232
|
3333
= note: only the last element of a tuple may have a dynamically sized type
3434
help: consider removing the `?Sized` bound to make the type parameter `Sized`
@@ -43,7 +43,7 @@ error[E0277]: the size for values of type `C` cannot be known at compilation tim
4343
LL | impl<A, B: ?Sized, C: ?Sized> Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {}
4444
| - ^^^^^^^^^ doesn't have a size known at compile-time
4545
| |
46-
| this type parameter needs to be `std::marker::Sized`
46+
| this type parameter needs to be `Sized`
4747
|
4848
= note: required because it appears within the type `(A, B, C)`
4949
note: required by a bound in `Trait`
@@ -65,9 +65,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim
6565
--> $DIR/unsized-bound.rs:5:52
6666
|
6767
LL | impl<A, B: ?Sized, C: ?Sized> Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {}
68-
| - ^^^^^^^^^ doesn't have a size known at compile-time
69-
| |
70-
| this type parameter needs to be `std::marker::Sized`
68+
| - this type parameter needs to be `Sized` ^^^^^^^^^ doesn't have a size known at compile-time
7169
|
7270
= note: only the last element of a tuple may have a dynamically sized type
7371
help: consider removing the `?Sized` bound to make the type parameter `Sized`
@@ -80,9 +78,7 @@ error[E0277]: the size for values of type `B` cannot be known at compilation tim
8078
--> $DIR/unsized-bound.rs:5:52
8179
|
8280
LL | impl<A, B: ?Sized, C: ?Sized> Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {}
83-
| - ^^^^^^^^^ doesn't have a size known at compile-time
84-
| |
85-
| this type parameter needs to be `std::marker::Sized`
81+
| - this type parameter needs to be `Sized` ^^^^^^^^^ doesn't have a size known at compile-time
8682
|
8783
= note: only the last element of a tuple may have a dynamically sized type
8884
help: consider removing the `?Sized` bound to make the type parameter `Sized`
@@ -97,7 +93,7 @@ error[E0277]: the size for values of type `B` cannot be known at compilation tim
9793
LL | impl<A: ?Sized, B: ?Sized> Trait2<(A, B)> for (A, B) {}
9894
| - ^^^^^^ doesn't have a size known at compile-time
9995
| |
100-
| this type parameter needs to be `std::marker::Sized`
96+
| this type parameter needs to be `Sized`
10197
|
10298
= note: required because it appears within the type `(A, B)`
10399
note: required by a bound in `Trait2`
@@ -121,7 +117,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim
121117
LL | impl<A: ?Sized, B: ?Sized> Trait2<(A, B)> for (A, B) {}
122118
| - ^^^^^^ doesn't have a size known at compile-time
123119
| |
124-
| this type parameter needs to be `std::marker::Sized`
120+
| this type parameter needs to be `Sized`
125121
|
126122
= note: only the last element of a tuple may have a dynamically sized type
127123
help: consider removing the `?Sized` bound to make the type parameter `Sized`
@@ -136,7 +132,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim
136132
LL | impl<A> Trait3<A> for A where A: ?Sized {}
137133
| - ^ doesn't have a size known at compile-time
138134
| |
139-
| this type parameter needs to be `std::marker::Sized`
135+
| this type parameter needs to be `Sized`
140136
|
141137
note: required by a bound in `Trait3`
142138
--> $DIR/unsized-bound.rs:13:14
@@ -159,7 +155,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim
159155
LL | impl<A: ?Sized> Trait4<A> for A {}
160156
| - ^ doesn't have a size known at compile-time
161157
| |
162-
| this type parameter needs to be `std::marker::Sized`
158+
| this type parameter needs to be `Sized`
163159
|
164160
note: required by a bound in `Trait4`
165161
--> $DIR/unsized-bound.rs:16:14
@@ -182,7 +178,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim
182178
LL | impl<X, Y> Trait5<X, Y> for X where X: ?Sized {}
183179
| - ^ doesn't have a size known at compile-time
184180
| |
185-
| this type parameter needs to be `std::marker::Sized`
181+
| this type parameter needs to be `Sized`
186182
|
187183
note: required by a bound in `Trait5`
188184
--> $DIR/unsized-bound.rs:19:14
@@ -205,7 +201,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim
205201
LL | impl<X: ?Sized, Y> Trait6<X, Y> for X {}
206202
| - ^ doesn't have a size known at compile-time
207203
| |
208-
| this type parameter needs to be `std::marker::Sized`
204+
| this type parameter needs to be `Sized`
209205
|
210206
note: required by a bound in `Trait6`
211207
--> $DIR/unsized-bound.rs:22:14
@@ -228,7 +224,7 @@ error[E0277]: the size for values of type `Y` cannot be known at compilation tim
228224
LL | impl<X, Y> Trait7<X, Y> for X where Y: ?Sized {}
229225
| - ^^^^^^^^^^^^ doesn't have a size known at compile-time
230226
| |
231-
| this type parameter needs to be `std::marker::Sized`
227+
| this type parameter needs to be `Sized`
232228
|
233229
note: required by a bound in `Trait7`
234230
--> $DIR/unsized-bound.rs:25:17
@@ -251,7 +247,7 @@ error[E0277]: the size for values of type `Y` cannot be known at compilation tim
251247
LL | impl<X, Y: ?Sized> Trait8<X, Y> for X {}
252248
| - ^^^^^^^^^^^^ doesn't have a size known at compile-time
253249
| |
254-
| this type parameter needs to be `std::marker::Sized`
250+
| this type parameter needs to be `Sized`
255251
|
256252
note: required by a bound in `Trait8`
257253
--> $DIR/unsized-bound.rs:28:17

tests/ui/traits/suggest-where-clause.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the size for values of type `U` cannot be known at compilation tim
22
--> $DIR/suggest-where-clause.rs:7:20
33
|
44
LL | fn check<T: Iterator, U: ?Sized>() {
5-
| - this type parameter needs to be `std::marker::Sized`
5+
| - this type parameter needs to be `Sized`
66
LL | // suggest a where-clause, if needed
77
LL | mem::size_of::<U>();
88
| ^ doesn't have a size known at compile-time
@@ -19,7 +19,7 @@ error[E0277]: the size for values of type `U` cannot be known at compilation tim
1919
--> $DIR/suggest-where-clause.rs:10:20
2020
|
2121
LL | fn check<T: Iterator, U: ?Sized>() {
22-
| - this type parameter needs to be `std::marker::Sized`
22+
| - this type parameter needs to be `Sized`
2323
...
2424
LL | mem::size_of::<Misc<U>>();
2525
| ^^^^^^^ doesn't have a size known at compile-time

tests/ui/union/union-sized-field.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
22
--> $DIR/union-sized-field.rs:4:12
33
|
44
LL | union Foo<T: ?Sized> {
5-
| - this type parameter needs to be `std::marker::Sized`
5+
| - this type parameter needs to be `Sized`
66
LL | value: ManuallyDrop<T>,
77
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
88
|
@@ -28,7 +28,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
2828
--> $DIR/union-sized-field.rs:9:12
2929
|
3030
LL | struct Foo2<T: ?Sized> {
31-
| - this type parameter needs to be `std::marker::Sized`
31+
| - this type parameter needs to be `Sized`
3232
LL | value: ManuallyDrop<T>,
3333
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
3434
|
@@ -54,7 +54,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
5454
--> $DIR/union-sized-field.rs:15:11
5555
|
5656
LL | enum Foo3<T: ?Sized> {
57-
| - this type parameter needs to be `std::marker::Sized`
57+
| - this type parameter needs to be `Sized`
5858
LL | Value(ManuallyDrop<T>),
5959
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
6060
|

tests/ui/unsized/unsized-bare-typaram.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
44
LL | fn foo<T: ?Sized>() { bar::<T>() }
55
| - ^ doesn't have a size known at compile-time
66
| |
7-
| this type parameter needs to be `std::marker::Sized`
7+
| this type parameter needs to be `Sized`
88
|
99
note: required by a bound in `bar`
1010
--> $DIR/unsized-bare-typaram.rs:1:8

tests/ui/unsized/unsized-enum.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
44
LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
55
| - ^^^^^^ doesn't have a size known at compile-time
66
| |
7-
| this type parameter needs to be `std::marker::Sized`
7+
| this type parameter needs to be `Sized`
88
|
99
note: required by a bound in `Foo`
1010
--> $DIR/unsized-enum.rs:4:10

tests/ui/unsized/unsized-enum2.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the size for values of type `W` cannot be known at compilation tim
22
--> $DIR/unsized-enum2.rs:23:8
33
|
44
LL | enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized> {
5-
| - this type parameter needs to be `std::marker::Sized`
5+
| - this type parameter needs to be `Sized`
66
LL | // parameter
77
LL | VA(W),
88
| ^ doesn't have a size known at compile-time
@@ -27,7 +27,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim
2727
--> $DIR/unsized-enum2.rs:25:11
2828
|
2929
LL | enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized> {
30-
| - this type parameter needs to be `std::marker::Sized`
30+
| - this type parameter needs to be `Sized`
3131
...
3232
LL | VB{x: X},
3333
| ^ doesn't have a size known at compile-time
@@ -52,7 +52,7 @@ error[E0277]: the size for values of type `Y` cannot be known at compilation tim
5252
--> $DIR/unsized-enum2.rs:27:15
5353
|
5454
LL | enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized> {
55-
| - this type parameter needs to be `std::marker::Sized`
55+
| - this type parameter needs to be `Sized`
5656
...
5757
LL | VC(isize, Y),
5858
| ^ doesn't have a size known at compile-time
@@ -77,7 +77,7 @@ error[E0277]: the size for values of type `Z` cannot be known at compilation tim
7777
--> $DIR/unsized-enum2.rs:29:21
7878
|
7979
LL | enum E<W: ?Sized, X: ?Sized, Y: ?Sized, Z: ?Sized> {
80-
| - this type parameter needs to be `std::marker::Sized`
80+
| - this type parameter needs to be `Sized`
8181
...
8282
LL | VD{u: isize, x: Z},
8383
| ^ doesn't have a size known at compile-time

tests/ui/unsized/unsized-fn-arg.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
44
LL | fn f<T: ?Sized>(t: T) {}
55
| - ^ doesn't have a size known at compile-time
66
| |
7-
| this type parameter needs to be `std::marker::Sized`
7+
| this type parameter needs to be `Sized`
88
|
99
= help: unsized fn params are gated as an unstable feature
1010
help: consider removing the `?Sized` bound to make the type parameter `Sized`

tests/ui/unsized/unsized-inherent-impl-self-type.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim
44
LL | impl<X: ?Sized> S5<X> {
55
| - ^^^^^ doesn't have a size known at compile-time
66
| |
7-
| this type parameter needs to be `std::marker::Sized`
7+
| this type parameter needs to be `Sized`
88
|
99
note: required by a bound in `S5`
1010
--> $DIR/unsized-inherent-impl-self-type.rs:5:11

tests/ui/unsized/unsized-struct.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
44
LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
55
| - ^^^^^^ doesn't have a size known at compile-time
66
| |
7-
| this type parameter needs to be `std::marker::Sized`
7+
| this type parameter needs to be `Sized`
88
|
99
note: required by a bound in `Foo`
1010
--> $DIR/unsized-struct.rs:4:12
@@ -30,7 +30,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
3030
LL | fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
3131
| - ^^^^^^ doesn't have a size known at compile-time
3232
| |
33-
| this type parameter needs to be `std::marker::Sized`
33+
| this type parameter needs to be `Sized`
3434
|
3535
note: required because it appears within the type `Bar<T>`
3636
--> $DIR/unsized-struct.rs:11:8

tests/ui/unsized/unsized-trait-impl-self-type.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim
44
LL | impl<X: ?Sized> T3<X> for S5<X> {
55
| - ^^^^^ doesn't have a size known at compile-time
66
| |
7-
| this type parameter needs to be `std::marker::Sized`
7+
| this type parameter needs to be `Sized`
88
|
99
note: required by a bound in `S5`
1010
--> $DIR/unsized-trait-impl-self-type.rs:8:11

0 commit comments

Comments
 (0)