Skip to content

proc_macro does not support type macros #38706

Closed
@dtolnay

Description

@dtolnay
#![feature(proc_macro, proc_macro_lib)]

extern crate proc_macro;
use proc_macro::TokenStream;

#[proc_macro_derive(Nothing)]
pub fn nothing(_: TokenStream) -> TokenStream {
    "".parse().unwrap()
}
#[macro_use]
extern crate nothing_derive;

macro_rules! int {
    () => { i32 }
}

#[derive(Nothing)]
struct S {
    x: int!(),
}
error: internal compiler error: unexpected panic

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 'visit_mac disabled by default', /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/visit.rs:102
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Metadata

Metadata

Assignees

Labels

A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions