Skip to content

Commit 016480a

Browse files
Add a non-lifetime-binders test
1 parent a233b16 commit 016480a

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#![feature(generic_const_exprs)]
2+
//~^ WARN the feature `generic_const_exprs` is incomplete
3+
#![feature(non_lifetime_binders)]
4+
//~^ WARN the feature `non_lifetime_binders` is incomplete
5+
6+
// Test for <https://github.com/rust-lang/rust/issues/115497>,
7+
// which originally relied on associated_type_bounds, but was
8+
// minimized away from that.
9+
10+
trait TraitA {
11+
type AsA;
12+
}
13+
trait TraitB {
14+
type AsB;
15+
}
16+
trait TraitC {}
17+
18+
fn foo<T>()
19+
where
20+
for<const N: u8 = { T::A }> T: TraitA<AsA = impl TraitB<AsB = impl TraitC>>,
21+
//~^ ERROR defaults for generic parameters are not allowed in `for<...>` binders
22+
//~| ERROR `impl Trait` is not allowed in bounds
23+
{
24+
}
25+
26+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/bad-suggestion-on-missing-assoc.rs:1:12
3+
|
4+
LL | #![feature(generic_const_exprs)]
5+
| ^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
8+
= note: `#[warn(incomplete_features)]` on by default
9+
10+
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
11+
--> $DIR/bad-suggestion-on-missing-assoc.rs:3:12
12+
|
13+
LL | #![feature(non_lifetime_binders)]
14+
| ^^^^^^^^^^^^^^^^^^^^
15+
|
16+
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
17+
18+
error: defaults for generic parameters are not allowed in `for<...>` binders
19+
--> $DIR/bad-suggestion-on-missing-assoc.rs:16:9
20+
|
21+
LL | for<const N: u8 = { T::A }> T: TraitA<AsA = impl TraitB<AsB = impl TraitC>>,
22+
| ^^^^^^^^^^^^^^^^^^^^^^
23+
24+
error[E0562]: `impl Trait` is not allowed in bounds
25+
--> $DIR/bad-suggestion-on-missing-assoc.rs:16:49
26+
|
27+
LL | for<const N: u8 = { T::A }> T: TraitA<AsA = impl TraitB<AsB = impl TraitC>>,
28+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29+
|
30+
= note: `impl Trait` is only allowed in arguments and return types of functions and methods
31+
32+
error: aborting due to 2 previous errors; 2 warnings emitted
33+
34+
For more information about this error, try `rustc --explain E0562`.

0 commit comments

Comments
 (0)