Skip to content

ICE: parenthesized parameters cannot appear in ExprPath #39749

@matt36

Description

@matt36

Code

https://play.rust-lang.org/?gist=2eb5e614583b7612d132678938efd615&version=nightly&backtrace=0

enum Foo {
    X,
}

enum Bar {
    Y(Foo),
}

struct Entry {
    op: Bar,
}

macro_rules! entry {
    ($op:path) => (
        Entry { op: $op }
    )
}

static TABLE: [Entry; 1] = [
    entry!(Bar::Y(Foo::X)),
];

Result

error[E0573]: expected type, found variant `Foo::X`
  --> <anon>:20:19
   |
20 |     entry!(Bar::Y(Foo::X)),
   |     --------------^^^^^^--
   |     |             |
   |     |             not a type
   |     in this macro invocation

error: internal compiler error: /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_typeck/check/mod.rs:4507: parenthesized parameters cannot appear in ExprPath
  --> <anon>:15:25
   |
15 |         Entry { op: $op }
   |                         ^
...
20 |     entry!(Bar::Y(Foo::X)),
   |     ---------------------- in this macro invocation

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

thread 'rustc' panicked at 'Box<Any>', /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc_errors/lib.rs:376
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Meta

Same result on these versions of rust currently available on play.rust-lang.org

rustc 1.15.1 (021bd294c 2017-02-08)
rustc 1.16.0-beta.1 (5276ba72e 2017-01-31)
rustc 1.17.0-nightly (24a70eb59 2017-02-09)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions