Skip to content

Commit eff3899

Browse files
authored
Unrolled build for rust-lang#122224
Rollup merge of rust-lang#122224 - gurry:add-tests, r=Nadrieril Add missing regression tests Add tests for issues rust-lang#121612 and rust-lang#121424 Closes rust-lang#121612 Closes rust-lang#121424
2 parents b054da8 + b1f4657 commit eff3899

4 files changed

+109
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Regression test for issue #121612
2+
3+
trait Trait {}
4+
impl Trait for bool {}
5+
struct MySlice<T: FnOnce(&T, Idx) -> Idx>(bool, T);
6+
//~^ ERROR cannot find type `Idx` in this scope
7+
//~| ERROR cannot find type `Idx` in this scope
8+
type MySliceBool = MySlice<[bool]>;
9+
const MYSLICE_GOOD: &MySliceBool = &MySlice(true, [false]);
10+
//~^ ERROR the size for values of type `[bool]` cannot be known at compilation time
11+
//~| ERROR the size for values of type `[bool]` cannot be known at compilation time
12+
13+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
error[E0412]: cannot find type `Idx` in this scope
2+
--> $DIR/ice-unsized-struct-arg-issue-121612.rs:5:30
3+
|
4+
LL | struct MySlice<T: FnOnce(&T, Idx) -> Idx>(bool, T);
5+
| ^^^ not found in this scope
6+
7+
error[E0412]: cannot find type `Idx` in this scope
8+
--> $DIR/ice-unsized-struct-arg-issue-121612.rs:5:38
9+
|
10+
LL | struct MySlice<T: FnOnce(&T, Idx) -> Idx>(bool, T);
11+
| ^^^ not found in this scope
12+
13+
error[E0277]: the size for values of type `[bool]` cannot be known at compilation time
14+
--> $DIR/ice-unsized-struct-arg-issue-121612.rs:9:22
15+
|
16+
LL | const MYSLICE_GOOD: &MySliceBool = &MySlice(true, [false]);
17+
| ^^^^^^^^^^^ doesn't have a size known at compile-time
18+
|
19+
= help: the trait `Sized` is not implemented for `[bool]`
20+
note: required by an implicit `Sized` bound in `MySlice`
21+
--> $DIR/ice-unsized-struct-arg-issue-121612.rs:5:16
22+
|
23+
LL | struct MySlice<T: FnOnce(&T, Idx) -> Idx>(bool, T);
24+
| ^ required by the implicit `Sized` requirement on this type parameter in `MySlice`
25+
help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>`
26+
--> $DIR/ice-unsized-struct-arg-issue-121612.rs:5:16
27+
|
28+
LL | struct MySlice<T: FnOnce(&T, Idx) -> Idx>(bool, T);
29+
| ^ - ...if indirection were used here: `Box<T>`
30+
| |
31+
| this could be changed to `T: ?Sized`...
32+
33+
error[E0277]: the size for values of type `[bool]` cannot be known at compilation time
34+
--> $DIR/ice-unsized-struct-arg-issue-121612.rs:9:22
35+
|
36+
LL | const MYSLICE_GOOD: &MySliceBool = &MySlice(true, [false]);
37+
| ^^^^^^^^^^^ doesn't have a size known at compile-time
38+
|
39+
= help: the trait `Sized` is not implemented for `[bool]`
40+
note: required by an implicit `Sized` bound in `MySlice`
41+
--> $DIR/ice-unsized-struct-arg-issue-121612.rs:5:16
42+
|
43+
LL | struct MySlice<T: FnOnce(&T, Idx) -> Idx>(bool, T);
44+
| ^ required by the implicit `Sized` requirement on this type parameter in `MySlice`
45+
help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>`
46+
--> $DIR/ice-unsized-struct-arg-issue-121612.rs:5:16
47+
|
48+
LL | struct MySlice<T: FnOnce(&T, Idx) -> Idx>(bool, T);
49+
| ^ - ...if indirection were used here: `Box<T>`
50+
| |
51+
| this could be changed to `T: ?Sized`...
52+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
53+
54+
error: aborting due to 4 previous errors
55+
56+
Some errors have detailed explanations: E0277, E0412.
57+
For more information about an error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Regression test for issue #121424
2+
#[repr(C)]
3+
struct MySlice<T: Copy>(bool, T);
4+
type MySliceBool = MySlice<[bool]>;
5+
const MYSLICE_GOOD: &MySliceBool = &MySlice(true, [false]);
6+
//~^ ERROR the trait bound `[bool]: Copy` is not satisfied
7+
//~| ERROR the trait bound `[bool]: Copy` is not satisfied
8+
9+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error[E0277]: the trait bound `[bool]: Copy` is not satisfied
2+
--> $DIR/ice-unsized-struct-arg-issue2-121424.rs:5:22
3+
|
4+
LL | const MYSLICE_GOOD: &MySliceBool = &MySlice(true, [false]);
5+
| ^^^^^^^^^^^ the trait `Copy` is not implemented for `[bool]`
6+
|
7+
= help: the trait `Copy` is implemented for `[T; N]`
8+
note: required by a bound in `MySlice`
9+
--> $DIR/ice-unsized-struct-arg-issue2-121424.rs:3:19
10+
|
11+
LL | struct MySlice<T: Copy>(bool, T);
12+
| ^^^^ required by this bound in `MySlice`
13+
14+
error[E0277]: the trait bound `[bool]: Copy` is not satisfied
15+
--> $DIR/ice-unsized-struct-arg-issue2-121424.rs:5:22
16+
|
17+
LL | const MYSLICE_GOOD: &MySliceBool = &MySlice(true, [false]);
18+
| ^^^^^^^^^^^ the trait `Copy` is not implemented for `[bool]`
19+
|
20+
= help: the trait `Copy` is implemented for `[T; N]`
21+
note: required by a bound in `MySlice`
22+
--> $DIR/ice-unsized-struct-arg-issue2-121424.rs:3:19
23+
|
24+
LL | struct MySlice<T: Copy>(bool, T);
25+
| ^^^^ required by this bound in `MySlice`
26+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
27+
28+
error: aborting due to 2 previous errors
29+
30+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)