Skip to content

Commit 0df4d37

Browse files
authored
Unrolled build for rust-lang#123579
Rollup merge of rust-lang#123579 - matthiaskrgr:I_Love_Tests, r=jieyouxu add some more tests Fixes rust-lang#115806 Fixes rust-lang#116710 Fixes rust-lang#123145 Fixes rust-lang#105488 Fixes rust-lang#122488 Fixes rust-lang#123078
2 parents 0e3235f + 88aa71f commit 0df4d37

12 files changed

+245
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// ICE unknown alias DefKind: AnonConst
2+
// issue: rust-lang/rust#116710
3+
#![feature(generic_const_exprs)]
4+
#![allow(incomplete_features)]
5+
6+
struct A<const N: u32 = 1, const M: u32 = u8>;
7+
//~^ ERROR expected value, found builtin type `u8`
8+
9+
trait Trait {}
10+
impl<const N: u32> Trait for A<N> {}
11+
12+
impl<const N: u32> Trait for A<N> {}
13+
//~^ ERROR conflicting implementations of trait `Trait` for type `A<_>`
14+
15+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0423]: expected value, found builtin type `u8`
2+
--> $DIR/unknown-alias-defkind-anonconst-ice-116710.rs:6:43
3+
|
4+
LL | struct A<const N: u32 = 1, const M: u32 = u8>;
5+
| ^^ not a value
6+
7+
error[E0119]: conflicting implementations of trait `Trait` for type `A<_>`
8+
--> $DIR/unknown-alias-defkind-anonconst-ice-116710.rs:12:1
9+
|
10+
LL | impl<const N: u32> Trait for A<N> {}
11+
| --------------------------------- first implementation here
12+
LL |
13+
LL | impl<const N: u32> Trait for A<N> {}
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A<_>`
15+
16+
error: aborting due to 2 previous errors
17+
18+
Some errors have detailed explanations: E0119, E0423.
19+
For more information about an error, try `rustc --explain E0119`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// ICE: assertion failed: !value.has_infer()
2+
// issue: rust-lang/rust#115806
3+
#![feature(associated_const_equality)]
4+
#![allow(incomplete_features)]
5+
6+
pub struct NoPin;
7+
8+
impl<TA> Pins<TA> for NoPin {}
9+
10+
pub trait PinA<PER> {
11+
const A: &'static () = &();
12+
}
13+
14+
pub trait Pins<USART> {}
15+
16+
impl<USART, T> Pins<USART> for T where T: PinA<USART, A = { &() }> {}
17+
//~^ ERROR conflicting implementations of trait `Pins<_>` for type `NoPin`
18+
19+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0119]: conflicting implementations of trait `Pins<_>` for type `NoPin`
2+
--> $DIR/assoc-const-no-infer-ice-115806.rs:16:1
3+
|
4+
LL | impl<TA> Pins<TA> for NoPin {}
5+
| --------------------------- first implementation here
6+
...
7+
LL | impl<USART, T> Pins<USART> for T where T: PinA<USART, A = { &() }> {}
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `NoPin`
9+
|
10+
= note: downstream crates may implement trait `PinA<_>` for type `NoPin`
11+
12+
error: aborting due to 1 previous error
13+
14+
For more information about this error, try `rustc --explain E0119`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// ICE failed to resolve instance for <fn() -> impl MyFnOnce ...
2+
// issue: rust-lang/rust#105488
3+
//@ build-fail
4+
//~^^^ ERROR overflow evaluating the requirement `fn() -> impl MyFnOnce
5+
6+
pub trait MyFnOnce {
7+
type Output;
8+
9+
fn call_my_fn_once(self) -> Self::Output;
10+
}
11+
12+
pub struct WrapFnOnce<F>(F);
13+
14+
impl<F: FnOnce() -> D, D: MyFnOnce> MyFnOnce for WrapFnOnce<F> {
15+
type Output = D::Output;
16+
17+
fn call_my_fn_once(self) -> Self::Output {
18+
D::call_my_fn_once(self.0())
19+
}
20+
}
21+
22+
impl<F: FnOnce() -> D, D: MyFnOnce> MyFnOnce for F {
23+
type Output = D::Output;
24+
25+
fn call_my_fn_once(self) -> Self::Output {
26+
D::call_my_fn_once(self())
27+
}
28+
}
29+
30+
pub fn my_fn_1() -> impl MyFnOnce {
31+
my_fn_2
32+
}
33+
34+
pub fn my_fn_2() -> impl MyFnOnce {
35+
WrapFnOnce(my_fn_1)
36+
}
37+
38+
fn main() {
39+
let v = my_fn_1();
40+
41+
let _ = v.call_my_fn_once();
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0275]: overflow evaluating the requirement `fn() -> impl MyFnOnce {my_fn_2}: MyFnOnce`
2+
|
3+
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`failed_to_resolve_instance_ice_105488`)
4+
note: required for `WrapFnOnce<fn() -> impl MyFnOnce {my_fn_1}>` to implement `MyFnOnce`
5+
--> $DIR/failed-to-resolve-instance-ice-105488.rs:14:37
6+
|
7+
LL | impl<F: FnOnce() -> D, D: MyFnOnce> MyFnOnce for WrapFnOnce<F> {
8+
| -------- ^^^^^^^^ ^^^^^^^^^^^^^
9+
| |
10+
| unsatisfied trait bound introduced here
11+
= note: 126 redundant requirements hidden
12+
= note: required for `WrapFnOnce<fn() -> impl MyFnOnce {my_fn_1}>` to implement `MyFnOnce`
13+
14+
error: aborting due to 1 previous error
15+
16+
For more information about this error, try `rustc --explain E0275`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ICE failed to resolve instance for ...
2+
// issue: rust-lang/rust#123145
3+
//@ build-fail
4+
//~^^^ ERROR overflow evaluating the requirement `(fn() -> impl Handler
5+
6+
trait Handler {
7+
fn handle(&self) {}
8+
}
9+
10+
impl<H: Handler, F: Fn() -> H> Handler for F {}
11+
12+
impl<L: Handler> Handler for (L,) {}
13+
14+
fn one() -> impl Handler {
15+
(one,)
16+
}
17+
18+
fn main() {
19+
one.handle();
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0275]: overflow evaluating the requirement `(fn() -> impl Handler {one},): Handler`
2+
|
3+
note: required for `fn() -> impl Handler {one}` to implement `Handler`
4+
--> $DIR/failed-to-resolve-instance-ice-123145.rs:10:32
5+
|
6+
LL | impl<H: Handler, F: Fn() -> H> Handler for F {}
7+
| ------- ^^^^^^^ ^
8+
| |
9+
| unsatisfied trait bound introduced here
10+
= note: 2 redundant requirements hidden
11+
= note: required for `fn() -> impl Handler {one}` to implement `Handler`
12+
13+
error: aborting due to 1 previous error
14+
15+
For more information about this error, try `rustc --explain E0275`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ICE !base.layout().is_sized()
2+
// issue: rust-lang/rust#123078
3+
4+
struct S {
5+
a: [u8],
6+
//~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
7+
b: (),
8+
}
9+
10+
const C: S = unsafe { std::mem::transmute(()) };
11+
//~^ ERROR cannot transmute between types of different sizes, or dependently-sized types
12+
const _: [(); {
13+
C;
14+
0
15+
}] = [];
16+
17+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
2+
--> $DIR/base-layout-is-sized-ice-123078.rs:5:8
3+
|
4+
LL | a: [u8],
5+
| ^^^^ doesn't have a size known at compile-time
6+
|
7+
= help: the trait `Sized` is not implemented for `[u8]`
8+
= note: only the last field of a struct may have a dynamically sized type
9+
= help: change the field's type to have a statically known size
10+
help: borrowed types always have a statically known size
11+
|
12+
LL | a: &[u8],
13+
| +
14+
help: the `Box` type always has a statically known size and allocates its contents in the heap
15+
|
16+
LL | a: Box<[u8]>,
17+
| ++++ +
18+
19+
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
20+
--> $DIR/base-layout-is-sized-ice-123078.rs:10:23
21+
|
22+
LL | const C: S = unsafe { std::mem::transmute(()) };
23+
| ^^^^^^^^^^^^^^^^^^^
24+
|
25+
= note: source type: `()` (0 bits)
26+
= note: target type: `S` (this type does not have a fixed size)
27+
28+
error: aborting due to 2 previous errors
29+
30+
Some errors have detailed explanations: E0277, E0512.
31+
For more information about an error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// ICE Unexpected unsized type tail: &ReStatic [u8]
2+
// issue: rust-lang/rust#122488
3+
use std::ops::Deref;
4+
5+
struct ArenaSet<U: Deref, V: ?Sized = <U as Deref>::Target>(V, U);
6+
//~^ ERROR the size for values of type `V` cannot be known at compilation time
7+
8+
const DATA: *const ArenaSet<Vec<u8>> = std::ptr::null_mut();
9+
10+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
error[E0277]: the size for values of type `V` cannot be known at compilation time
2+
--> $DIR/issue-unsized-tail-restatic-ice-122488.rs:5:61
3+
|
4+
LL | struct ArenaSet<U: Deref, V: ?Sized = <U as Deref>::Target>(V, U);
5+
| -------------------------------- ^ doesn't have a size known at compile-time
6+
| |
7+
| this type parameter needs to be `Sized`
8+
|
9+
= note: only the last field of a struct may have a dynamically sized type
10+
= help: change the field's type to have a statically known size
11+
help: consider removing the `?Sized` bound to make the type parameter `Sized`
12+
|
13+
LL - struct ArenaSet<U: Deref, V: ?Sized = <U as Deref>::Target>(V, U);
14+
LL + struct ArenaSet<U: Deref, V = <U as Deref>::Target>(V, U);
15+
|
16+
help: borrowed types always have a statically known size
17+
|
18+
LL | struct ArenaSet<U: Deref, V: ?Sized = <U as Deref>::Target>(&V, U);
19+
| +
20+
help: the `Box` type always has a statically known size and allocates its contents in the heap
21+
|
22+
LL | struct ArenaSet<U: Deref, V: ?Sized = <U as Deref>::Target>(Box<V>, U);
23+
| ++++ +
24+
25+
error: aborting due to 1 previous error
26+
27+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)