diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2020-05-07 12:01:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-07 12:01:27 -0400 |
commit | 9a8d94842044c5d91ce8ac09ed96c0e184d842b2 (patch) | |
tree | 83e90d0bb453831d2746bd1ffc626853094596af /cli/repl.rs | |
parent | 53265fb6dbe1d1676d68b7060ba33e4ba79b9144 (diff) |
Remove REPL/Windows hack (#5136)
Diffstat (limited to 'cli/repl.rs')
-rw-r--r-- | cli/repl.rs | 44 |
1 files changed, 1 insertions, 43 deletions
diff --git a/cli/repl.rs b/cli/repl.rs index abc592c46..614921d4d 100644 --- a/cli/repl.rs +++ b/cli/repl.rs @@ -2,52 +2,10 @@ use crate::deno_dir::DenoDir; use crate::op_error::OpError; use deno_core::ErrBox; +use rustyline::Editor; use std::fs; use std::path::PathBuf; -#[cfg(not(windows))] -use rustyline::Editor; - -// Work around the issue that on Windows, `struct Editor` does not implement the -// `Send` trait, because it embeds a windows HANDLE which is a type alias for -// *mut c_void. This value isn't actually a pointer and there's nothing that -// can be mutated through it, so hack around it. TODO: a prettier solution. -#[cfg(windows)] -use std::ops::{Deref, DerefMut}; - -#[cfg(windows)] -struct Editor<T: rustyline::Helper> { - inner: rustyline::Editor<T>, -} - -#[cfg(windows)] -unsafe impl<T: rustyline::Helper> Send for Editor<T> {} - -#[cfg(windows)] -impl<T: rustyline::Helper> Editor<T> { - pub fn new() -> Editor<T> { - Editor { - inner: rustyline::Editor::<T>::new(), - } - } -} - -#[cfg(windows)] -impl<T: rustyline::Helper> Deref for Editor<T> { - type Target = rustyline::Editor<T>; - - fn deref(&self) -> &rustyline::Editor<T> { - &self.inner - } -} - -#[cfg(windows)] -impl<T: rustyline::Helper> DerefMut for Editor<T> { - fn deref_mut(&mut self) -> &mut rustyline::Editor<T> { - &mut self.inner - } -} - pub struct Repl { editor: Editor<()>, history_file: PathBuf, |