Skip to content

assert! allows invalid trailing tokens in expression #60024

Closed
@adlerd

Description

@adlerd
fn main() {
    assert!(true some extra junk, "whatever");  
    assert!(true some extra junk);                    
}

(Playground)

Output:

   Compiling playground v0.0.1 (/playground)
    Finished dev [unoptimized + debuginfo] target(s) in 0.54s
     Running `target/debug/playground`

Version:

  • 1.34.0
  • 1.35.0 2019-04-15 nightly (2975a3c)

Expected:

error: expected one of `.`, `;`, `?`, or an operator, found `some`
 --> src/main.rs:2:18
  |
2 |     assert!(true some extra junk, "whatever");
  |                  ^^^^ expected one of `.`, `;`, `?`, or an operator here

Original report:
https://www.reddit.com/r/rust/comments/bdbtpr/hey_rustaceans_got_an_easy_question_ask_here/el1gm0h/

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions