-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #102338 - compiler-errors:assoc-ty-binding-in-assoc-t…
…y-binding, r=cjgillot Deny associated type bindings within associated type bindings Fixes #102335 This was made worse by #100865, which unified the way we generate substs for GATs and non-generic associated types. However, the issue was not _caused_ by #100865, evidenced by the test I added for GATs: ```rust trait T { type A: S<C<(), i32 = ()> = ()>; //~^ ERROR associated type bindings are not allowed here } trait Q {} trait S { type C<T>: Q; } fn main() {} ``` ^ which passes on beta (where GATs are stable) and presumably ever since GATs support was added to `create_substs_for_associated_item` in astconv.
- Loading branch information
Showing
9 changed files
with
82 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#![feature(associated_const_equality)] | ||
|
||
trait T { | ||
type A: S<C<X = 0i32> = 34>; | ||
//~^ ERROR associated type bindings are not allowed here | ||
} | ||
|
||
trait S { | ||
const C: i32; | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0229]: associated type bindings are not allowed here | ||
--> $DIR/issue-102335-const.rs:4:17 | ||
| | ||
LL | type A: S<C<X = 0i32> = 34>; | ||
| ^^^^^^^^ associated type not allowed here | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0229`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
trait T { | ||
type A: S<C<i32 = u32> = ()>; | ||
//~^ ERROR associated type bindings are not allowed here | ||
} | ||
|
||
trait Q {} | ||
|
||
trait S { | ||
type C: Q; | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0229]: associated type bindings are not allowed here | ||
--> $DIR/issue-102335-ty.rs:2:17 | ||
| | ||
LL | type A: S<C<i32 = u32> = ()>; | ||
| ^^^^^^^^^ associated type not allowed here | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0229`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
trait T { | ||
type A: S<C<(), i32 = ()> = ()>; | ||
//~^ ERROR associated type bindings are not allowed here | ||
} | ||
|
||
trait Q {} | ||
|
||
trait S { | ||
type C<T>: Q; | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0229]: associated type bindings are not allowed here | ||
--> $DIR/issue-102335-gat.rs:2:21 | ||
| | ||
LL | type A: S<C<(), i32 = ()> = ()>; | ||
| ^^^^^^^^ associated type not allowed here | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0229`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters