From 3f96a77cb5c63ca3106784b0c4287c8f11b21b78 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 16 Jul 2023 11:41:24 -0700 Subject: [PATCH] Delete no_ident_new_raw config for rustc older than 1.47 --- build.rs | 4 ---- src/wrapper.rs | 20 -------------------- 2 files changed, 24 deletions(-) diff --git a/build.rs b/build.rs index 5c61765..738031d 100644 --- a/build.rs +++ b/build.rs @@ -58,10 +58,6 @@ fn main() { println!("cargo:rustc-cfg=span_locations"); } - if version.minor < 47 { - println!("cargo:rustc-cfg=no_ident_new_raw"); - } - if version.minor < 54 { println!("cargo:rustc-cfg=no_literal_from_str"); } diff --git a/src/wrapper.rs b/src/wrapper.rs index 69376fc..1cf99fc 100644 --- a/src/wrapper.rs +++ b/src/wrapper.rs @@ -654,27 +654,7 @@ impl Ident { pub fn new_raw(string: &str, span: Span) -> Self { match span { - #[cfg(not(no_ident_new_raw))] Span::Compiler(s) => Ident::Compiler(proc_macro::Ident::new_raw(string, s)), - #[cfg(no_ident_new_raw)] - Span::Compiler(s) => { - let _ = proc_macro::Ident::new(string, s); - // At this point the un-r#-prefixed string is known to be a - // valid identifier. Try to produce a valid raw identifier by - // running the `TokenStream` parser, and unwrapping the first - // token as an `Ident`. - let raw_prefixed = format!("r#{}", string); - if let Ok(ts) = raw_prefixed.parse::() { - let mut iter = ts.into_iter(); - if let (Some(proc_macro::TokenTree::Ident(mut id)), None) = - (iter.next(), iter.next()) - { - id.set_span(s); - return Ident::Compiler(id); - } - } - panic!("not allowed as a raw identifier: `{}`", raw_prefixed) - } Span::Fallback(s) => Ident::Fallback(fallback::Ident::new_raw(string, s)), } }