File tree Expand file tree Collapse file tree 4 files changed +87
-0
lines changed
traits/non_lifetime_binders Expand file tree Collapse file tree 4 files changed +87
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ feature( associated_type_bounds) ]
2+
3+ // Test for <https://github.com/rust-lang/rust/issues/119857>.
4+
5+ pub trait Iter {
6+ type Item < ' a > : ' a where Self : ' a ;
7+
8+ fn next < ' a > ( & ' a mut self ) -> Option < Self :: Item < ' a , As1 : Copy > > ;
9+ //~^ ERROR associated type bindings are not allowed here
10+ }
11+
12+ impl Iter for ( ) {
13+ type Item < ' a > = & ' a mut [ ( ) ] ;
14+
15+ fn next < ' a > ( & ' a mut self ) -> Option < Self :: Item < ' a > > { None }
16+ }
17+
18+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0229]: associated type bindings are not allowed here
2+ --> $DIR/no-gat-position.rs:8:56
3+ |
4+ LL | fn next<'a>(&'a mut self) -> Option<Self::Item<'a, As1: Copy>>;
5+ | ^^^^^^^^^ associated type not allowed here
6+
7+ error: aborting due to 1 previous error
8+
9+ For more information about this error, try `rustc --explain E0229`.
Original file line number Diff line number Diff line change 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 number Diff line number Diff line change 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:20: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:20: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`.
You can’t perform that action at this time.
0 commit comments