Skip to content

Commit fe25260

Browse files
committed
Bless (and add) some tests
1 parent 031f947 commit fe25260

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

+634
-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: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
//~^ ERROR associated const equality is incomplete
17+
//~| ERROR the type parameter `U` is not constrained by the impl trait
18+
19+
fn foo()
20+
where
21+
(): Trait,
22+
//~^ ERROR type mismatch resolving
23+
{
24+
}
25+
26+
fn main() {}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
error[E0658]: associated const equality is incomplete
2+
--> $DIR/unconstrained_impl_param.rs:15:45
3+
|
4+
LL | impl<U> Trait for () where (U,): AssocConst<A = { 0 }> {}
5+
| ^^^^^^^^^
6+
|
7+
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
8+
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10+
11+
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
12+
--> $DIR/unconstrained_impl_param.rs:15:6
13+
|
14+
LL | impl<U> Trait for () where (U,): AssocConst<A = { 0 }> {}
15+
| ^ unconstrained type parameter
16+
17+
error[E0271]: type mismatch resolving `<(_,) as AssocConst>::A == 0`
18+
--> $DIR/unconstrained_impl_param.rs:21:5
19+
|
20+
LL | (): Trait,
21+
| ^^^^^^^^^ expected `0`, found `<(_,) as AssocConst>::A`
22+
|
23+
= note: expected constant `0`
24+
found constant `<(_,) as AssocConst>::A`
25+
note: required for `()` to implement `Trait`
26+
--> $DIR/unconstrained_impl_param.rs:15:9
27+
|
28+
LL | impl<U> Trait for () where (U,): AssocConst<A = { 0 }> {}
29+
| ^^^^^ ^^ --------- unsatisfied trait bound introduced here
30+
= help: see issue #48214
31+
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
32+
|
33+
LL + #![feature(trivial_bounds)]
34+
|
35+
36+
error: aborting due to 3 previous errors
37+
38+
Some errors have detailed explanations: E0207, E0271, E0658.
39+
For more information about an error, try `rustc --explain E0207`.
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() {}

0 commit comments

Comments
 (0)