From 503b9981c6666d51af516978b7df1cb2aa600778 Mon Sep 17 00:00:00 2001 From: Kevin Mehall Date: Sat, 27 Oct 2018 21:47:05 -0700 Subject: [PATCH] Drop dependency on #![feature(proc_macro_span)] This unstable feature (rust-lang/rust#54725) is the last thing that we require in Nightly. Removing it will cause a significant regression in error messages, but that can be improved after switching to parsing the grammar as tokens rather than as a string literal. --- peg-syntax-ext/lib.rs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/peg-syntax-ext/lib.rs b/peg-syntax-ext/lib.rs index 500dc7d..d89709f 100644 --- a/peg-syntax-ext/lib.rs +++ b/peg-syntax-ext/lib.rs @@ -1,23 +1,13 @@ -#![feature(proc_macro_span)] - extern crate peg_codegen; extern crate proc_macro; -use std::iter; - use proc_macro::{ TokenStream, TokenTree, Span }; #[proc_macro] pub fn peg(input: TokenStream) -> TokenStream { - let (name, source, span) = parse_peg_args(input); - - let line = span.start().line; - let fname = span.source_file().path().display().to_string(); - - // Make PEG line numbers match source line numbers - let source = iter::repeat('\n').take(line - 1).collect::() + &source; + let (name, source, _) = parse_peg_args(input); - expand_peg(name, fname, source) + expand_peg(name, "".into(), source) } /// Parse a TokenStream of the form `name r#""#`