123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- From b78145bfb6a6f81425dfd6fbacb9c03624e79b2c Mon Sep 17 00:00:00 2001
- From: Sven Neumann <sven@svenfoo.org>
- Date: Fri, 16 Oct 2020 18:03:24 +0200
- Subject: [PATCH] Port to recent versions of the quote, syn and proc_macro2
- crates
- Upstream: <https://github.com/frehberg/test-generator/pull/9>.
- Rebased locally for 0.3.
- ---
- Cargo.toml.orig | 6 +++---
- src/lib.rs | 16 ++++++++--------
- 2 files changed, 11 insertions(+), 11 deletions(-)
- diff --git a/Cargo.toml.orig b/Cargo.toml.orig
- index ac14d48..e7b45b0 100644
- --- a/Cargo.toml.orig
- +++ b/Cargo.toml.orig
- @@ -16,6 +16,6 @@ proc-macro = true
-
- [dependencies]
- glob = "^0.3"
- -quote = "0.6"
- -syn = { version="^0.15", features=["full"] }
- -proc-macro2 = "^0.4"
- +quote = "1.0"
- +syn = { version="1.0", features=["full"] }
- +proc-macro2 = "1.0"
- diff --git a/src/lib.rs b/src/lib.rs
- index 7428d02..176592c 100644
- --- a/src/lib.rs
- +++ b/src/lib.rs
- @@ -185,8 +185,8 @@ pub fn test_resources(attrs: TokenStream, func: TokenStream) -> TokenStream {
- Lit::Byte(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
- Lit::ByteStr(_) => panic!("expected string parameter, got byte-string"),
- Lit::Char(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
- - Lit::Int(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
- - Lit::Float(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
- + Lit::Int(l) => panic!(format!("expected string parameter, got '{}'", l)),
- + Lit::Float(l) => panic!(format!("expected string parameter, got '{}'", l)),
- _ => panic!("expected string parameter"),
- };
-
- @@ -195,7 +195,7 @@ pub fn test_resources(attrs: TokenStream, func: TokenStream) -> TokenStream {
- let func_ast: ItemFn = syn::parse(func)
- .expect("failed to parse tokens as a function");
-
- - let func_ident = func_ast.ident;
- + let func_ident = func_ast.sig.ident;
-
- let paths: Paths = glob(&pattern).expect(&format!("No such file or directory {}", &pattern));
-
- @@ -264,8 +264,8 @@ pub fn bench_resources(attrs: TokenStream, func: TokenStream) -> TokenStream {
- Lit::Byte(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
- Lit::ByteStr(_) => panic!("expected string parameter, got byte-string"),
- Lit::Char(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
- - Lit::Int(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
- - Lit::Float(l) => panic!(format!("expected string parameter, got '{}'", &l.value())),
- + Lit::Int(l) => panic!(format!("expected string parameter, got '{}'", l)),
- + Lit::Float(l) => panic!(format!("expected string parameter, got '{}'", l)),
- _ => panic!("expected string parameter"),
- };
-
- @@ -274,7 +274,7 @@ pub fn bench_resources(attrs: TokenStream, func: TokenStream) -> TokenStream {
- let func_ast: ItemFn = syn::parse(func)
- .expect("failed to parse tokens as a function");
-
- - let func_ident = func_ast.ident;
- + let func_ident = func_ast.sig.ident;
-
- let paths: Paths = glob(&pattern).expect(&format!("No such file or directory {}", &pattern));
-
- @@ -400,7 +400,7 @@ fn expr_stringified(expr: &Expr, int_as_hex: bool) -> String {
- attrs: _,
- } => match litval {
- Lit::Int(lit) => {
- - let val = lit.value();
- + let val: u64 = lit.base10_parse().unwrap();
- if int_as_hex {
- // if u8-range, use two digits, otherwise 16
- if val > 255 {
- @@ -422,7 +422,7 @@ fn expr_stringified(expr: &Expr, int_as_hex: bool) -> String {
- val
- }
- Lit::Float(lit) => {
- - let val = lit.value();
- + let val: f64 = lit.base10_parse().unwrap();
- format!("{}", val)
- }
- _ => panic!(),
|