Before the experimental fn delegation (#118212,
F-fn_delegation
`#![feature(fn_delegation)]`
) was introduced, the following code used to compile:
fn main() {
let reuse = 0;
reuse < reuse;
}
Now however it leads to
error: expected one of `!`, `(`, `+`, `::`, `<`, `>`, or `as`, found `;`
--> src/main.rs:3:18
|
3 | reuse < reuse;
| ^ expected one of 7 possible tokens
despite reuse supposedly being a weak keyword only. Here, the parser likely treats the reuse < reuse as the start of a delegation item because the second reuse can begin a type in theory (it's looking to parse reuse <$type>::$pathtree; / reuse <$type as $traitref>::$pathtree).
Of course, this is very unlikely to be hit in practice. Moreover, I can't really see a good solution (unbounded look-ahead & backtracking is of course not on the table). In any case, the syntax is temporary.
Other example:
fn main() {
let reuse = 0;
reuse << reuse; //~ ERROR expected one of `!`, `(`, `+`, `::`, `<`, `>`, or `as`, found `;`
}
Before the experimental fn delegation (#118212, F-fn_delegation`#![feature(fn_delegation)]`
) was introduced, the following code used to compile:
Now however it leads to
despite
reusesupposedly being a weak keyword only. Here, the parser likely treats thereuse < reuseas the start of a delegation item because the secondreusecan begin a type in theory (it's looking to parsereuse <$type>::$pathtree;/reuse <$type as $traitref>::$pathtree).Of course, this is very unlikely to be hit in practice. Moreover, I can't really see a good solution (unbounded look-ahead & backtracking is of course not on the table). In any case, the syntax is temporary.
Other example: