Skip to content

Commit 64ea0b5

Browse files
committed
Bless (and add) some tests
1 parent 1e9bb85 commit 64ea0b5

40 files changed

+544
-212
lines changed

tests/crashes/127643.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/crashes/131046.rs

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/crashes/131406.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/crashes/133066.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/crashes/133199.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/crashes/136894.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/crashes/137813.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// regression test for #137813 where we would assume all constants in the type system
2+
// cannot contain inference variables, even though associated const equality syntax
3+
// was still lowered without the feature gate enabled.
4+
5+
trait AssocConst {
6+
const A: u8;
7+
}
8+
9+
impl<T> AssocConst for (T,) {
10+
const A: u8 = 0;
11+
}
12+
13+
trait Trait {}
14+
15+
impl<U> Trait for () where (U,): AssocConst<A = { 0 }> {}
16+
17+
fn foo()
18+
where
19+
(): Trait,
20+
{
21+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#![feature(associated_const_equality)]
2+
3+
trait Owner<K> {
4+
const C: K;
5+
}
6+
impl<K: ConstDefault> Owner<K> for () {
7+
const C: K = K::DEFAULT;
8+
}
9+
10+
trait ConstDefault {
11+
const DEFAULT: Self;
12+
}
13+
14+
fn user() -> impl Owner<dyn Sized, C = 0> {}
15+
//~^ ERROR: the trait bound `(dyn Sized + 'static): ConstDefault` is not satisfied
16+
//~| ERROR: the size for values of type `(dyn Sized + 'static)` cannot be known at compilation time
17+
//~| ERROR: the trait `Sized` is not dyn compatible
18+
//~| ERROR: mismatched types
19+
20+
fn main() {}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
error[E0277]: the trait bound `(dyn Sized + 'static): ConstDefault` is not satisfied
2+
--> $DIR/wf_before_evaluate-2.rs:14:14
3+
|
4+
LL | fn user() -> impl Owner<dyn Sized, C = 0> {}
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `ConstDefault` is not implemented for `(dyn Sized + 'static)`
6+
|
7+
help: this trait has no implementations, consider adding one
8+
--> $DIR/wf_before_evaluate-2.rs:10:1
9+
|
10+
LL | trait ConstDefault {
11+
| ^^^^^^^^^^^^^^^^^^
12+
note: required for `()` to implement `Owner<(dyn Sized + 'static)>`
13+
--> $DIR/wf_before_evaluate-2.rs:6:23
14+
|
15+
LL | impl<K: ConstDefault> Owner<K> for () {
16+
| ------------ ^^^^^^^^ ^^
17+
| |
18+
| unsatisfied trait bound introduced here
19+
20+
error[E0277]: the size for values of type `(dyn Sized + 'static)` cannot be known at compilation time
21+
--> $DIR/wf_before_evaluate-2.rs:14:14
22+
|
23+
LL | fn user() -> impl Owner<dyn Sized, C = 0> {}
24+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
25+
|
26+
= help: the trait `Sized` is not implemented for `(dyn Sized + 'static)`
27+
= help: the trait `Owner<K>` is implemented for `()`
28+
note: required for `()` to implement `Owner<(dyn Sized + 'static)>`
29+
--> $DIR/wf_before_evaluate-2.rs:6:23
30+
|
31+
LL | impl<K: ConstDefault> Owner<K> for () {
32+
| - ^^^^^^^^ ^^
33+
| |
34+
| unsatisfied trait bound introduced here
35+
36+
error[E0038]: the trait `Sized` is not dyn compatible
37+
--> $DIR/wf_before_evaluate-2.rs:14:40
38+
|
39+
LL | fn user() -> impl Owner<dyn Sized, C = 0> {}
40+
| ^ `Sized` is not dyn compatible
41+
|
42+
= note: the trait is not dyn compatible because it requires `Self: Sized`
43+
= note: for a trait to be dyn compatible it needs to allow building a vtable
44+
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
45+
46+
error[E0308]: mismatched types
47+
--> $DIR/wf_before_evaluate-2.rs:14:40
48+
|
49+
LL | fn user() -> impl Owner<dyn Sized, C = 0> {}
50+
| ^ expected `dyn Sized`, found integer
51+
|
52+
= note: expected trait object `(dyn Sized + 'static)`
53+
found type `{integer}`
54+
55+
error: aborting due to 4 previous errors
56+
57+
Some errors have detailed explanations: E0038, E0277, E0308.
58+
For more information about an error, try `rustc --explain E0038`.

0 commit comments

Comments
 (0)