Skip to content

Commit 503b998

Browse files
committed
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.
1 parent 1a26964 commit 503b998

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

peg-syntax-ext/lib.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
1-
#![feature(proc_macro_span)]
2-
31
extern crate peg_codegen;
42
extern crate proc_macro;
53

6-
use std::iter;
7-
84
use proc_macro::{ TokenStream, TokenTree, Span };
95

106
#[proc_macro]
117
pub fn peg(input: TokenStream) -> TokenStream {
12-
let (name, source, span) = parse_peg_args(input);
13-
14-
let line = span.start().line;
15-
let fname = span.source_file().path().display().to_string();
16-
17-
// Make PEG line numbers match source line numbers
18-
let source = iter::repeat('\n').take(line - 1).collect::<String>() + &source;
8+
let (name, source, _) = parse_peg_args(input);
199

20-
expand_peg(name, fname, source)
10+
expand_peg(name, "<peg>".into(), source)
2111
}
2212

2313
/// Parse a TokenStream of the form `name r#""#`

0 commit comments

Comments
 (0)