Skip to content

Improve error from invalid syntax inside proc_macro::quote! #47315

Closed
@dtolnay

Description

@dtolnay

Ideally the `$` must be followed by an ident or `$` in `quote!` error message would not look like an ICE.

#![feature(proc_macro)]

extern crate proc_macro;
use proc_macro::{quote, TokenStream};

#[proc_macro]
pub fn p(input: TokenStream) -> TokenStream {
    quote! {
        $()*
    }
}
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

note: rustc 1.25.0-nightly (b5392f545 2018-01-08) running on x86_64-unknown-linux-gnu

thread 'rustc' panicked at '`$` must be followed by an ident or `$` in `quote!`', libproc_macro/quote.rs:105:26

@jseyfried

Metadata

Metadata

Assignees

Labels

A-decl-macros-2-0Area: Declarative macros 2.0 (#39412)A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-diagnosticsWorking group: Diagnostics

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions