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

Handle parsing unseparated right angle brackets in generics #199

Merged
merged 3 commits into from Nov 27, 2021
Merged

Conversation

@dtolnay
Copy link
Owner

@dtolnay dtolnay commented Nov 27, 2021

Rustc parses S::<>>v as an expression but it's harder for macro_rules, which have to know that a single incoming >> token serves as both the generic argument list terminator and the comparison operator.

dtolnay added 3 commits Nov 27, 2021
Currently these aren't being parsed successfully so this fails with:

    ---- test_path stdout ----
    thread 'test_path' panicked at 'assertion failed: `(left == right)`
      left: `"Condition failed: `E::U::<> > E::U::<u8>`"`,
     right: `"Condition failed: `E::U::<> > E::U::<u8>` (U vs U)"`', tests/test_ensure.rs:332:5

    thread 'test_path' panicked at 'assertion failed: `(left == right)`
      left: `"Condition failed: `E::U::<u8> > E::U`"`,
     right: `"Condition failed: `E::U::<u8> > E::U` (U vs U)"`', tests/test_ensure.rs:336:5

    thread 'test_path' panicked at 'assertion failed: `(left == right)`
      left: `"Condition failed: `E::U::<u8> > E::U`"`,
     right: `"Condition failed: `E::U::<u8> > E::U` (U vs U)"`', tests/test_ensure.rs:340:5
    error: adding items after statements is confusing, since items exist from the start of the scope
       --> tests/test_ensure.rs:324:5
        |
    324 | /     enum E<'a, T> {
    325 | |         #[allow(dead_code)]
    326 | |         T(&'a T),
    327 | |         U,
    328 | |     }
        | |_____^
        |
        = note: `-D clippy::items-after-statements` implied by `-D clippy::pedantic`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
@dtolnay dtolnay merged commit 3f33b89 into master Nov 27, 2021
26 checks passed
@dtolnay dtolnay deleted the bracket branch Nov 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant