-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 #82579 - osa1:issue82566, r=estebank
Fix turbofish recovery with multiple generic args This consists of two commits, each can be individually reviewed. - First commit fixes the issue in [this comment](#82566 (comment)). - Second commit fixes #82566 --- r? ````@estebank````
- Loading branch information
Showing
7 changed files
with
134 additions
and
4 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
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,21 @@ | ||
struct T1<const X1: usize>; | ||
struct T2<const X1: usize, const X2: usize>; | ||
struct T3<const X1: usize, const X2: usize, const X3: usize>; | ||
|
||
impl T1<1> { | ||
const C: () = (); | ||
} | ||
|
||
impl T2<1, 2> { | ||
const C: () = (); | ||
} | ||
|
||
impl T3<1, 2, 3> { | ||
const C: () = (); | ||
} | ||
|
||
fn main() { | ||
T1<1>::C; //~ ERROR: comparison operators cannot be chained | ||
T2<1, 2>::C; //~ ERROR: expected one of `.`, `;`, `?`, `}`, or an operator, found `,` | ||
T3<1, 2, 3>::C; //~ ERROR: expected one of `.`, `;`, `?`, `}`, or an operator, found `,` | ||
} |
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,35 @@ | ||
error: comparison operators cannot be chained | ||
--> $DIR/issue-82566-1.rs:18:7 | ||
| | ||
LL | T1<1>::C; | ||
| ^ ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type or const arguments | ||
| | ||
LL | T1::<1>::C; | ||
| ^^ | ||
|
||
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `,` | ||
--> $DIR/issue-82566-1.rs:19:9 | ||
| | ||
LL | T2<1, 2>::C; | ||
| ^ expected one of `.`, `;`, `?`, `}`, or an operator | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type or const arguments | ||
| | ||
LL | T2::<1, 2>::C; | ||
| ^^ | ||
|
||
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `,` | ||
--> $DIR/issue-82566-1.rs:20:9 | ||
| | ||
LL | T3<1, 2, 3>::C; | ||
| ^ expected one of `.`, `;`, `?`, `}`, or an operator | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type or const arguments | ||
| | ||
LL | T3::<1, 2, 3>::C; | ||
| ^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
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,31 @@ | ||
struct Foo1<const N1: usize>; | ||
struct Foo2<const N1: usize, const N2: usize>; | ||
struct Foo3<const N1: usize, const N2: usize, const N3: usize>; | ||
|
||
impl<const N1: usize> Foo1<N1> { | ||
const SUM: usize = N1; | ||
} | ||
|
||
impl<const N1: usize, const N2: usize> Foo2<N1, N2> { | ||
const SUM: usize = N1 + N2; | ||
} | ||
|
||
impl<const N1: usize, const N2: usize, const N3: usize> Foo3<N1, N2, N3> { | ||
const SUM: usize = N1 + N2 + N3; | ||
} | ||
|
||
fn foo1() -> [(); Foo1<10>::SUM] { //~ ERROR: comparison operators cannot be chained | ||
todo!() | ||
} | ||
|
||
fn foo2() -> [(); Foo2<10, 20>::SUM] { | ||
//~^ ERROR: expected one of `.`, `?`, `]`, or an operator, found `,` | ||
todo!() | ||
} | ||
|
||
fn foo3() -> [(); Foo3<10, 20, 30>::SUM] { | ||
//~^ ERROR: expected one of `.`, `?`, `]`, or an operator, found `,` | ||
todo!() | ||
} | ||
|
||
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,35 @@ | ||
error: comparison operators cannot be chained | ||
--> $DIR/issue-82566-2.rs:17:23 | ||
| | ||
LL | fn foo1() -> [(); Foo1<10>::SUM] { | ||
| ^ ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type or const arguments | ||
| | ||
LL | fn foo1() -> [(); Foo1::<10>::SUM] { | ||
| ^^ | ||
|
||
error: expected one of `.`, `?`, `]`, or an operator, found `,` | ||
--> $DIR/issue-82566-2.rs:21:26 | ||
| | ||
LL | fn foo2() -> [(); Foo2<10, 20>::SUM] { | ||
| ^ expected one of `.`, `?`, `]`, or an operator | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type or const arguments | ||
| | ||
LL | fn foo2() -> [(); Foo2::<10, 20>::SUM] { | ||
| ^^ | ||
|
||
error: expected one of `.`, `?`, `]`, or an operator, found `,` | ||
--> $DIR/issue-82566-2.rs:26:26 | ||
| | ||
LL | fn foo3() -> [(); Foo3<10, 20, 30>::SUM] { | ||
| ^ expected one of `.`, `?`, `]`, or an operator | ||
| | ||
help: use `::<...>` instead of `<...>` to specify type or const arguments | ||
| | ||
LL | fn foo3() -> [(); Foo3::<10, 20, 30>::SUM] { | ||
| ^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|