Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
rust main
// this file is included when compiling src/bin/*.rs or tests
// maybe we shouldn't define 'main' here
extern crate radeco;
use std::env;
use radeco::frontend::esil;
fn parse_verbose<'a> (p: &mut esil::Parser, expression: &'a String) {
let expstr = expression.as_str();
println!("< {}", expression);
if let Err(e) = p.parse(expstr) {
panic!("Error: {:?}", e)
for inst in &p.emit_insts() {
println!("> {}", inst);
// attribute to ignore unused 'main' when running tests
#[cfg_attr(test, allow(dead_code))]
fn main() {
let mut p = esil::Parser::new();
let expression: String;
if env::args().count() > 1 {
expression = env::args().nth(1).unwrap();
} else {
expression = String::from_str("rax,rbx,+");
parse_verbose(&mut p, &expression);

This comment has been minimized.

Copy link
Owner Author

@radare radare commented Jun 21, 2015

$ make
cargo run
   Compiling radeco v0.1.0 (file:///Users/pancake/prg/radeco)
src/ 9:37 error: cannot infer an appropriate lifetime for autoref due to conflicting requirements
src/     let expstr = expression.as_str();
src/ 17:2 help: consider using an explicit lifetime parameter as shown: fn parse_verbose<'a>(p: &mut esil::Parser<'a>, expression: &'a String)
src/ fn parse_verbose<'a> (p: &mut esil::Parser, expression: &'a String) {
src/     let expstr = expression.as_str();
src/     println!("< {}", expression);
src/     if let Err(e) = p.parse(expstr) {
src/         panic!("Error: {:?}", e)
src/     }
error: aborting due to previous error
Could not compile `radeco`.

To learn more, run the command again with --verbose.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment