diff --git a/rrust-macro/src/reverse.rs b/rrust-macro/src/reverse.rs index bc950f8..db875ab 100644 --- a/rrust-macro/src/reverse.rs +++ b/rrust-macro/src/reverse.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream; use quote::ToTokens; -use syn::{fold::Fold, parse::Parser, ExprBinary, StmtMacro}; +use syn::{fold::Fold, parse::Parser, ExprBinary, ExprMethodCall, StmtMacro}; use crate::utils::{delocal_ident_stmt, local_ident}; @@ -278,7 +278,29 @@ fn reverse_expr(e: Expr) -> Expr { } } Expr::Match(_) => panic!("Not yet implemented {}", line!()), - Expr::MethodCall(_) => panic!("Not yet implemented {}", line!()), + Expr::MethodCall(ExprMethodCall { + attrs, + receiver, + dot_token, + method, + turbofish, + paren_token, + args, + }) => { + //std::slice::swap + if method.to_string() == "swap" { + return Expr::MethodCall(ExprMethodCall { + attrs, + receiver, + dot_token, + method, + turbofish, + paren_token, + args, + }); + } + panic!("Not yet implemented {}", line!()) + } Expr::Paren(_) => panic!("Not yet implemented {}", line!()), Expr::Path(_) => panic!("Not yet implemented {}", line!()), Expr::Range(_) => panic!("Not yet implemented {}", line!()), diff --git a/rrust/src/lib.rs b/rrust/src/lib.rs index 1fc1fa5..2e9d60c 100644 --- a/rrust/src/lib.rs +++ b/rrust/src/lib.rs @@ -425,7 +425,7 @@ pub use rrust_macro::{forward, reverse}; macro_rules! delocal { ($name:ident, $e:expr) => { if $name != $e { - panic!("Delocal failed {} != {}", $name, $e); + panic!("Delocal failed {:?} != {:?}", $name, $e); } drop($name); };