Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`&..`: unexpected token .. #25119

Closed
huonw opened this Issue May 5, 2015 · 3 comments

Comments

Projects
None yet
4 participants
@huonw
Copy link
Member

huonw commented May 5, 2015

fn main() { &..; }
<anon>:1:14: 1:16 error: unexpected token: `..`
<anon>:1 fn main() { &..; }
                      ^~

This may be on purpose, but if not, this is useful for passing .. into generic APIs that take references.

@klutzy

This comment has been minimized.

Copy link
Contributor

klutzy commented May 5, 2015

parser-lalr accepts &..; well: (ExprAddrOf (ExprRange <none> <none>)), so at least one of them is buggy.

@dgrunwald

This comment has been minimized.

Copy link
Contributor

dgrunwald commented Nov 4, 2015

This is intentional in rustc. .. is only accepted as expression in locations where a..b would also be accepted.

That is, because the parentheses in &(a..b) are required, they are also required in &(..).

@brson

This comment has been minimized.

Copy link
Contributor

brson commented Apr 11, 2017

Seems like expected behavior to me.

@brson brson closed this Apr 11, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.