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

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

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

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)