Ensure all precedence rules are covered.

Open
#577 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Stale
Tech stack
rust
Domain
documentation

Research direction

Start by comparing expressions.md and patterns.md with the precedence behavior described in RFC 16 and the linked issues 55851 and 34511. Use the grammar as a possible completeness check, then identify and document the missing attribute, closure, impl-in-type, and other type-expression rules. Done means the reference clearly covers all precedence cases found.

Written by the indexing model from the issue text.

Description

A-grammar

I think there are various bits of precedence rules that are not covered in the reference. expressions.md covers most of them, and patterns.md has one precedence rule noted.

I'm not sure what is missing, some that I can think of:

Attribute precedence. #[attr] x = 1; the attribute (I think) goes to the place expression, not the statement. RFC 16 says "Attributes bind tighter than any operator".

I think the way let _ = ||{}(); fails to parse isn't clear to me. The precedence rules just say "closures", but doesn't specify what that encompasses. See https://github.com/rust-lang/rust/issues/55851.

impl precedence in types. This is briefly mentioned in https://github.com/rust-lang/rust/issues/34511. I think there are other various precedence rules in type expressions.

I feel like there are various other precedence rules that are missing, but I can't think of any others right now. Perhaps at some point the gll grammar could inform all the rules?

Dominant language
Rust
Stars
1.6k
Forks
607
Avg merge
1d 1h
Merged PRs (30d)
12

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-lang/reference

All issues in rust-lang/reference

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.