Skip to content

Commit 0bd2ee3

Browse files
committed
Fix the testcases to not use UnsizedConstParamTy
1 parent 1a02cd5 commit 0bd2ee3

File tree

43 files changed

+218
-291
lines changed

Some content is hidden

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

43 files changed

+218
-291
lines changed

tests/ui/const-generics/adt_const_params/auxiliary/unsized_const_param.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![feature(adt_const_params, unsized_const_params)]
22

3-
#[derive(std::marker::UnsizedConstParamTy, Eq, PartialEq)]
3+
#[derive(std::marker::ConstParamTy, Eq, PartialEq)]
44
pub struct Foo([u8]);
55

66
#[derive(std::marker::ConstParamTy, Eq, PartialEq)]

tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(incomplete_features)]
22
#![feature(adt_const_params, unsized_const_params)]
33

4-
fn check(_: impl std::marker::UnsizedConstParamTy) {}
4+
fn check(_: impl std::marker::ConstParamTy_) {}
55

66
fn main() {
77
check(main); //~ error: `fn() {main}` can't be used as a const parameter type

tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ error[E0277]: `fn() {main}` can't be used as a const parameter type
22
--> $DIR/const_param_ty_bad.rs:7:11
33
|
44
LL | check(main);
5-
| ----- ^^^^ the trait `UnsizedConstParamTy` is not implemented for fn item `fn() {main}`
5+
| ----- ^^^^ the trait `ConstParamTy_` is not implemented for fn item `fn() {main}`
66
| |
77
| required by a bound introduced by this call
88
|
99
note: required by a bound in `check`
1010
--> $DIR/const_param_ty_bad.rs:4:18
1111
|
12-
LL | fn check(_: impl std::marker::UnsizedConstParamTy) {}
13-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
12+
LL | fn check(_: impl std::marker::ConstParamTy_) {}
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
1414
help: use parentheses to call this function
1515
|
1616
LL | check(main());
@@ -24,12 +24,12 @@ LL | check(|| {});
2424
| |
2525
| required by a bound introduced by this call
2626
|
27-
= help: the trait `UnsizedConstParamTy` is not implemented for closure `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}`
27+
= help: the trait `ConstParamTy_` is not implemented for closure `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}`
2828
note: required by a bound in `check`
2929
--> $DIR/const_param_ty_bad.rs:4:18
3030
|
31-
LL | fn check(_: impl std::marker::UnsizedConstParamTy) {}
32-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
31+
LL | fn check(_: impl std::marker::ConstParamTy_) {}
32+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
3333
help: use parentheses to call this closure
3434
|
3535
LL - check(|| {});
@@ -40,15 +40,15 @@ error[E0277]: `fn()` can't be used as a const parameter type
4040
--> $DIR/const_param_ty_bad.rs:9:11
4141
|
4242
LL | check(main as fn());
43-
| ----- ^^^^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `fn()`
43+
| ----- ^^^^^^^^^^^^ the trait `ConstParamTy_` is not implemented for `fn()`
4444
| |
4545
| required by a bound introduced by this call
4646
|
4747
note: required by a bound in `check`
4848
--> $DIR/const_param_ty_bad.rs:4:18
4949
|
50-
LL | fn check(_: impl std::marker::UnsizedConstParamTy) {}
51-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
50+
LL | fn check(_: impl std::marker::ConstParamTy_) {}
51+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
5252
help: use parentheses to call this function pointer
5353
|
5454
LL | check(main as fn()());
@@ -58,16 +58,16 @@ error[E0277]: `&mut ()` can't be used as a const parameter type
5858
--> $DIR/const_param_ty_bad.rs:10:11
5959
|
6060
LL | check(&mut ());
61-
| ----- ^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `&mut ()`
61+
| ----- ^^^^^^^ the trait `ConstParamTy_` is not implemented for `&mut ()`
6262
| |
6363
| required by a bound introduced by this call
6464
|
65-
= note: `UnsizedConstParamTy` is implemented for `&()`, but not for `&mut ()`
65+
= note: `ConstParamTy_` is implemented for `&()`, but not for `&mut ()`
6666
note: required by a bound in `check`
6767
--> $DIR/const_param_ty_bad.rs:4:18
6868
|
69-
LL | fn check(_: impl std::marker::UnsizedConstParamTy) {}
70-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
69+
LL | fn check(_: impl std::marker::ConstParamTy_) {}
70+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
7171
help: consider removing the leading `&`-reference
7272
|
7373
LL - check(&mut ());
@@ -78,31 +78,31 @@ error[E0277]: `*mut ()` can't be used as a const parameter type
7878
--> $DIR/const_param_ty_bad.rs:11:11
7979
|
8080
LL | check(&mut () as *mut ());
81-
| ----- ^^^^^^^^^^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `*mut ()`
81+
| ----- ^^^^^^^^^^^^^^^^^^ the trait `ConstParamTy_` is not implemented for `*mut ()`
8282
| |
8383
| required by a bound introduced by this call
8484
|
85-
= help: the trait `UnsizedConstParamTy` is implemented for `()`
85+
= help: the trait `ConstParamTy_` is implemented for `()`
8686
note: required by a bound in `check`
8787
--> $DIR/const_param_ty_bad.rs:4:18
8888
|
89-
LL | fn check(_: impl std::marker::UnsizedConstParamTy) {}
90-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
89+
LL | fn check(_: impl std::marker::ConstParamTy_) {}
90+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
9191

9292
error[E0277]: `*const ()` can't be used as a const parameter type
9393
--> $DIR/const_param_ty_bad.rs:12:11
9494
|
9595
LL | check(&() as *const ());
96-
| ----- ^^^^^^^^^^^^^^^^ the trait `UnsizedConstParamTy` is not implemented for `*const ()`
96+
| ----- ^^^^^^^^^^^^^^^^ the trait `ConstParamTy_` is not implemented for `*const ()`
9797
| |
9898
| required by a bound introduced by this call
9999
|
100-
= help: the trait `UnsizedConstParamTy` is implemented for `()`
100+
= help: the trait `ConstParamTy_` is implemented for `()`
101101
note: required by a bound in `check`
102102
--> $DIR/const_param_ty_bad.rs:4:18
103103
|
104-
LL | fn check(_: impl std::marker::UnsizedConstParamTy) {}
105-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
104+
LL | fn check(_: impl std::marker::ConstParamTy_) {}
105+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
106106

107107
error: aborting due to 6 previous errors
108108

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
#![feature(adt_const_params, unsized_const_params)]
22
#![allow(incomplete_features)]
33

4-
use std::marker::{ConstParamTy_, UnsizedConstParamTy};
4+
use std::marker::ConstParamTy_;
55

66
fn foo(a: &dyn ConstParamTy_) {}
77
//~^ ERROR: the trait `ConstParamTy_`
88

9-
fn bar(a: &dyn UnsizedConstParamTy) {}
10-
//~^ ERROR: the trait `UnsizedConstParamTy`
11-
129
fn main() {}

tests/ui/const-generics/adt_const_params/const_param_ty_dyn_compatibility.stderr

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,6 @@ LL - fn foo(a: &dyn ConstParamTy_) {}
1515
LL + fn foo(a: &impl ConstParamTy_) {}
1616
|
1717

18-
error[E0038]: the trait `UnsizedConstParamTy` is not dyn compatible
19-
--> $DIR/const_param_ty_dyn_compatibility.rs:9:16
20-
|
21-
LL | fn bar(a: &dyn UnsizedConstParamTy) {}
22-
| ^^^^^^^^^^^^^^^^^^^ `UnsizedConstParamTy` is not dyn compatible
23-
|
24-
note: for a trait to be dyn compatible it needs to allow building a vtable
25-
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
26-
--> $SRC_DIR/core/src/cmp.rs:LL:COL
27-
|
28-
= note: the trait is not dyn compatible because it uses `Self` as a type parameter
29-
help: consider using an opaque type instead
30-
|
31-
LL - fn bar(a: &dyn UnsizedConstParamTy) {}
32-
LL + fn bar(a: &impl UnsizedConstParamTy) {}
33-
|
34-
35-
error: aborting due to 2 previous errors
18+
error: aborting due to 1 previous error
3619

3720
For more information about this error, try `rustc --explain E0038`.

tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#[derive(PartialEq, Eq)]
55
struct NotParam;
66

7-
fn check<T: std::marker::UnsizedConstParamTy + ?Sized>() {}
7+
fn check<T: std::marker::ConstParamTy_ + ?Sized>() {}
88

99
fn main() {
1010
check::<&NotParam>(); //~ error: `NotParam` can't be used as a const parameter type

tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,53 @@ error[E0277]: `NotParam` can't be used as a const parameter type
44
LL | check::<&NotParam>();
55
| ^^^^^^^^^ unsatisfied trait bound
66
|
7-
help: the trait `UnsizedConstParamTy` is not implemented for `NotParam`
7+
help: the trait `ConstParamTy_` is not implemented for `NotParam`
88
--> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:5:1
99
|
1010
LL | struct NotParam;
1111
| ^^^^^^^^^^^^^^^
12-
= note: required for `&NotParam` to implement `UnsizedConstParamTy`
12+
= note: required for `&NotParam` to implement `ConstParamTy_`
1313
note: required by a bound in `check`
1414
--> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:7:13
1515
|
16-
LL | fn check<T: std::marker::UnsizedConstParamTy + ?Sized>() {}
17-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
16+
LL | fn check<T: std::marker::ConstParamTy_ + ?Sized>() {}
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
1818

1919
error[E0277]: `NotParam` can't be used as a const parameter type
2020
--> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:11:13
2121
|
2222
LL | check::<[NotParam]>();
2323
| ^^^^^^^^^^ unsatisfied trait bound
2424
|
25-
help: the trait `UnsizedConstParamTy` is not implemented for `NotParam`
25+
help: the trait `ConstParamTy_` is not implemented for `NotParam`
2626
--> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:5:1
2727
|
2828
LL | struct NotParam;
2929
| ^^^^^^^^^^^^^^^
30-
= note: required for `[NotParam]` to implement `UnsizedConstParamTy`
30+
= note: required for `[NotParam]` to implement `ConstParamTy_`
3131
note: required by a bound in `check`
3232
--> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:7:13
3333
|
34-
LL | fn check<T: std::marker::UnsizedConstParamTy + ?Sized>() {}
35-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
34+
LL | fn check<T: std::marker::ConstParamTy_ + ?Sized>() {}
35+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
3636

3737
error[E0277]: `NotParam` can't be used as a const parameter type
3838
--> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:12:13
3939
|
4040
LL | check::<[NotParam; 17]>();
4141
| ^^^^^^^^^^^^^^ unsatisfied trait bound
4242
|
43-
help: the trait `UnsizedConstParamTy` is not implemented for `NotParam`
43+
help: the trait `ConstParamTy_` is not implemented for `NotParam`
4444
--> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:5:1
4545
|
4646
LL | struct NotParam;
4747
| ^^^^^^^^^^^^^^^
48-
= note: required for `[NotParam; 17]` to implement `UnsizedConstParamTy`
48+
= note: required for `[NotParam; 17]` to implement `ConstParamTy_`
4949
note: required by a bound in `check`
5050
--> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:7:13
5151
|
52-
LL | fn check<T: std::marker::UnsizedConstParamTy + ?Sized>() {}
53-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
52+
LL | fn check<T: std::marker::ConstParamTy_ + ?Sized>() {}
53+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
5454

5555
error: aborting due to 3 previous errors
5656

tests/ui/const-generics/adt_const_params/const_param_ty_good.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
#![feature(adt_const_params, unsized_const_params)]
44
#![allow(incomplete_features)]
55

6-
use std::marker::UnsizedConstParamTy;
6+
use std::marker::{ConstParamTy, ConstParamTy_};
77

88
#[derive(PartialEq, Eq)]
99
struct S<T> {
1010
field: u8,
1111
gen: T,
1212
}
1313

14-
impl<T: UnsizedConstParamTy> UnsizedConstParamTy for S<T> {}
14+
impl<T: ConstParamTy_> ConstParamTy_ for S<T> {}
1515

16-
#[derive(PartialEq, Eq, UnsizedConstParamTy)]
16+
#[derive(PartialEq, Eq, ConstParamTy)]
1717
struct D<T> {
1818
field: u8,
1919
gen: T,
2020
}
2121

22-
fn check<T: UnsizedConstParamTy + ?Sized>() {}
22+
fn check<T: ConstParamTy_ + ?Sized>() {}
2323

2424
fn main() {
2525
check::<u8>();

tests/ui/const-generics/adt_const_params/const_param_ty_impl_bad_field.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ struct NotParam;
77
#[derive(PartialEq, Eq)]
88
struct CantParam(NotParam);
99

10-
impl std::marker::UnsizedConstParamTy for CantParam {}
10+
impl std::marker::ConstParamTy_ for CantParam {}
1111
//~^ error: the trait `ConstParamTy_` cannot be implemented for this type
1212

13-
#[derive(std::marker::UnsizedConstParamTy, Eq, PartialEq)]
13+
#[derive(std::marker::ConstParamTy, Eq, PartialEq)]
1414
//~^ error: the trait `ConstParamTy_` cannot be implemented for this type
1515
struct CantParamDerive(NotParam);
1616

tests/ui/const-generics/adt_const_params/const_param_ty_impl_bad_field.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
2-
--> $DIR/const_param_ty_impl_bad_field.rs:10:43
2+
--> $DIR/const_param_ty_impl_bad_field.rs:10:37
33
|
44
LL | struct CantParam(NotParam);
55
| -------- this field does not implement `ConstParamTy_`
66
LL |
7-
LL | impl std::marker::UnsizedConstParamTy for CantParam {}
8-
| ^^^^^^^^^
7+
LL | impl std::marker::ConstParamTy_ for CantParam {}
8+
| ^^^^^^^^^
99

1010
error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type
1111
--> $DIR/const_param_ty_impl_bad_field.rs:13:10
1212
|
13-
LL | #[derive(std::marker::UnsizedConstParamTy, Eq, PartialEq)]
14-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13+
LL | #[derive(std::marker::ConstParamTy, Eq, PartialEq)]
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
1515
LL |
1616
LL | struct CantParamDerive(NotParam);
1717
| -------- this field does not implement `ConstParamTy_`

0 commit comments

Comments
 (0)