diff --git a/Cargo.lock b/Cargo.lock index 777ddb1001e..25518831983 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,15 +53,6 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -177,6 +168,17 @@ dependencies = [ "tracing-tree", ] +[[package]] +name = "clipboard-win" +version = "4.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362" +dependencies = [ + "error-code", + "str-buf", + "winapi", +] + [[package]] name = "crossbeam-utils" version = "0.8.16" @@ -268,6 +270,16 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "error-code" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21" +dependencies = [ + "libc", + "str-buf", +] + [[package]] name = "expect-test" version = "1.4.1" @@ -284,16 +296,6 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" -[[package]] -name = "fs2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "getrandom" version = "0.2.11" @@ -490,12 +492,11 @@ checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" [[package]] name = "nix" -version = "0.19.1" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" dependencies = [ "bitflags 1.3.2", - "cc", "cfg-if", "libc", ] @@ -747,13 +748,13 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "rustyline" -version = "7.1.0" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8227301bfc717136f0ecbd3d064ba8199e44497a0bdd46bb01ede4387cfd2cec" +checksum = "994eca4bca05c87e86e15d90fc7a91d1be64b4482b38cb2d27474568fe7c9db9" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.1", "cfg-if", - "fs2", + "clipboard-win", "libc", "log", "memchr", @@ -841,6 +842,12 @@ version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +[[package]] +name = "str-buf" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" + [[package]] name = "string_cache" version = "0.8.7" diff --git a/Cargo.toml b/Cargo.toml index 18a99fc1103..c12f64da1b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ bench = [] [dependencies] docopt = "1.1.0" itertools = "0.12.0" -rustyline = { version = "7.1.0", default-features = false } +rustyline = { version = "12.0.0", default-features = false } salsa = "0.16.0" serde = "1.0" serde_derive = "1.0" diff --git a/src/main.rs b/src/main.rs index 577835bc017..0b900bbbd96 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,7 +63,7 @@ impl LoadedProgram { /// Parse a goal and attempt to solve it, using the specified solver. fn goal( &self, - mut rl: Option<&mut rustyline::Editor<()>>, + mut rl: Option<&mut rustyline::DefaultEditor>, text: &str, multiple_answers: bool, ) -> Result<()> { @@ -134,7 +134,7 @@ fn run() -> Result<()> { if args.flag_goal.is_empty() { // The user specified no goal. Enter interactive mode. - readline_loop(&mut rustyline::Editor::new(), "?- ", |rl, line| { + readline_loop(&mut rustyline::Editor::new()?, "?- ", |rl, line| { if let Err(e) = process(args, line, rl, &mut prog) { eprintln!("error: {}", e); } @@ -167,15 +167,15 @@ fn run() -> Result<()> { /// /// The loop terminates (and the program ends) when EOF is reached or if an error /// occurs while reading the next line. -fn readline_loop(rl: &mut rustyline::Editor<()>, prompt: &str, mut f: F) -> Result<()> +fn readline_loop(rl: &mut rustyline::DefaultEditor, prompt: &str, mut f: F) -> Result<()> where - F: FnMut(&mut rustyline::Editor<()>, &str), + F: FnMut(&mut rustyline::DefaultEditor, &str), { loop { match rl.readline(prompt) { Ok(line) => { // Save the line to the history list. - rl.add_history_entry(&line); + let _ = rl.add_history_entry(&line); // Process the line. f(rl, &line); @@ -199,7 +199,7 @@ where fn process( args: &Args, command: &str, - rl: &mut rustyline::Editor<()>, + rl: &mut rustyline::DefaultEditor, prog: &mut Option, ) -> Result<()> { if command.is_empty() { @@ -279,7 +279,7 @@ fn help() { /// Read a program from the command-line. Stop reading when EOF is read. If /// an error occurs while reading, a `Err` is returned. -fn read_program(rl: &mut rustyline::Editor<()>) -> Result { +fn read_program(rl: &mut rustyline::DefaultEditor) -> Result { println!("Enter a program; press Ctrl-D when finished"); let mut text = String::new(); readline_loop(rl, "| ", |_, line| {