From 9a8d94842044c5d91ce8ac09ed96c0e184d842b2 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 7 May 2020 12:01:27 -0400 Subject: [PATCH] Remove REPL/Windows hack (#5136) --- cli/repl.rs | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/cli/repl.rs b/cli/repl.rs index abc592c46e..614921d4d3 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 { - inner: rustyline::Editor, -} - -#[cfg(windows)] -unsafe impl Send for Editor {} - -#[cfg(windows)] -impl Editor { - pub fn new() -> Editor { - Editor { - inner: rustyline::Editor::::new(), - } - } -} - -#[cfg(windows)] -impl Deref for Editor { - type Target = rustyline::Editor; - - fn deref(&self) -> &rustyline::Editor { - &self.inner - } -} - -#[cfg(windows)] -impl DerefMut for Editor { - fn deref_mut(&mut self) -> &mut rustyline::Editor { - &mut self.inner - } -} - pub struct Repl { editor: Editor<()>, history_file: PathBuf,