未验证 提交 526fdac0 编写于 作者: A Andy Hayden 提交者: Bert Belder

Update to rust 2018 edition

上级 7d08db21
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
[package] [package]
name = "deno" name = "deno"
version = "0.2.6" version = "0.2.6"
edition = "2018"
[dependencies] [dependencies]
atty = "0.2.11" atty = "0.2.11"
......
此差异已折叠。
...@@ -50,6 +50,7 @@ template("rust_crate") { ...@@ -50,6 +50,7 @@ template("rust_crate") {
"crate_type", "crate_type",
"crate_version", "crate_version",
"deps", "deps",
"edition",
"inputs", "inputs",
"features", "features",
"is_test", "is_test",
...@@ -68,6 +69,9 @@ template("rust_crate") { ...@@ -68,6 +69,9 @@ template("rust_crate") {
if (!defined(deps)) { if (!defined(deps)) {
deps = [] deps = []
} }
if (!defined(edition)) {
edition = "2018"
}
if (!defined(is_test)) { if (!defined(is_test)) {
is_test = false is_test = false
} }
...@@ -175,6 +179,7 @@ template("rust_crate") { ...@@ -175,6 +179,7 @@ template("rust_crate") {
"--crate-name=$crate_name", "--crate-name=$crate_name",
"--crate-type=$crate_type", "--crate-type=$crate_type",
"--emit=$emit_type,dep-info", "--emit=$emit_type,dep-info",
"--edition=$edition",
"--out-dir=" + rebase_path(out_dir, root_build_dir), "--out-dir=" + rebase_path(out_dir, root_build_dir),
# This is to disambiguate multiple versions of the same crate. # This is to disambiguate multiple versions of the same crate.
......
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use isolate::Buf; use crate::isolate::Buf;
use isolate::IsolateState; use crate::isolate::IsolateState;
use msg; use crate::msg;
use resources; use crate::resources;
use resources::Resource; use crate::resources::Resource;
use resources::ResourceId; use crate::resources::ResourceId;
use workers; use crate::workers;
use futures::Future; use futures::Future;
use serde_json; use serde_json;
......
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use compiler::CodeFetchOutput; use crate::compiler::CodeFetchOutput;
use dirs; use crate::errors;
use errors; use crate::errors::DenoError;
use errors::DenoError; use crate::errors::DenoResult;
use errors::DenoResult; use crate::errors::ErrorKind;
use errors::ErrorKind; use crate::fs as deno_fs;
use fs as deno_fs; use crate::http_util;
use http_util; use crate::js_errors::SourceMapGetter;
use js_errors::SourceMapGetter; use crate::msg;
use msg;
use dirs;
use ring; use ring;
use std; use std;
use std::fmt::Write; use std::fmt::Write;
...@@ -395,7 +395,7 @@ impl DenoDir { ...@@ -395,7 +395,7 @@ impl DenoDir {
match j.scheme() { match j.scheme() {
"file" => { "file" => {
let mut p = deno_fs::normalize_path(j.to_file_path().unwrap().as_ref()); let p = deno_fs::normalize_path(j.to_file_path().unwrap().as_ref());
module_name = p.clone(); module_name = p.clone();
filename = p; filename = p;
} }
...@@ -540,8 +540,8 @@ fn filter_shebang(code: String) -> String { ...@@ -540,8 +540,8 @@ fn filter_shebang(code: String) -> String {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::tokio_util;
use tempfile::TempDir; use tempfile::TempDir;
use tokio_util;
fn test_setup() -> (TempDir, DenoDir) { fn test_setup() -> (TempDir, DenoDir) {
let temp_dir = TempDir::new().expect("tempdir fail"); let temp_dir = TempDir::new().expect("tempdir fail");
...@@ -751,7 +751,7 @@ mod tests { ...@@ -751,7 +751,7 @@ mod tests {
#[test] #[test]
fn test_fetch_source_1() { fn test_fetch_source_1() {
use tokio_util; use crate::tokio_util;
// http_util::fetch_sync_string requires tokio // http_util::fetch_sync_string requires tokio
tokio_util::init(|| { tokio_util::init(|| {
let (_temp_dir, deno_dir) = test_setup(); let (_temp_dir, deno_dir) = test_setup();
...@@ -786,7 +786,7 @@ mod tests { ...@@ -786,7 +786,7 @@ mod tests {
#[test] #[test]
fn test_fetch_source_2() { fn test_fetch_source_2() {
use tokio_util; use crate::tokio_util;
// http_util::fetch_sync_string requires tokio // http_util::fetch_sync_string requires tokio
tokio_util::init(|| { tokio_util::init(|| {
let (_temp_dir, deno_dir) = test_setup(); let (_temp_dir, deno_dir) = test_setup();
......
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use crate::resources::{EagerAccept, EagerRead, EagerWrite, Resource};
use resources::{EagerAccept, EagerRead, EagerWrite, Resource}; use crate::tokio_util;
use tokio_util; use crate::tokio_write;
use tokio_write;
use futures::future::{self, Either}; use futures::future::{self, Either};
use std; use std;
......
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
pub use msg::ErrorKind; pub use crate::msg::ErrorKind;
use resolve_addr::ResolveAddrError; use crate::resolve_addr::ResolveAddrError;
use hyper; use hyper;
use std; use std;
...@@ -95,7 +95,7 @@ impl DenoError { ...@@ -95,7 +95,7 @@ impl DenoError {
} }
impl fmt::Display for DenoError { impl fmt::Display for DenoError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.repr { match self.repr {
Repr::Simple(_kind, ref err_str) => f.pad(err_str), Repr::Simple(_kind, ref err_str) => f.pad(err_str),
Repr::IoErr(ref err) => err.fmt(f), Repr::IoErr(ref err) => err.fmt(f),
...@@ -115,7 +115,7 @@ impl std::error::Error for DenoError { ...@@ -115,7 +115,7 @@ impl std::error::Error for DenoError {
} }
} }
fn cause(&self) -> Option<&std::error::Error> { fn cause(&self) -> Option<&dyn std::error::Error> {
match self.repr { match self.repr {
Repr::Simple(_kind, ref _msg) => None, Repr::Simple(_kind, ref _msg) => None,
Repr::IoErr(ref err) => Some(err), Repr::IoErr(ref err) => Some(err),
......
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use crate::libdeno;
use getopts; use getopts;
use getopts::Options; use getopts::Options;
use libc::c_int; use libc::c_int;
use libdeno;
use std::ffi::CStr; use std::ffi::CStr;
use std::ffi::CString; use std::ffi::CString;
use std::mem; use std::mem;
...@@ -258,7 +259,7 @@ fn v8_set_flags_preprocess(args: Vec<String>) -> (Vec<String>, Vec<String>) { ...@@ -258,7 +259,7 @@ fn v8_set_flags_preprocess(args: Vec<String>) -> (Vec<String>, Vec<String>) {
args.into_iter().partition(|ref a| a.as_str() == "--help"); args.into_iter().partition(|ref a| a.as_str() == "--help");
// Replace args being sent to V8 // Replace args being sent to V8
for mut a in &mut v8_args { for a in &mut v8_args {
if a == "--v8-options" { if a == "--v8-options" {
mem::swap(a, &mut String::from("--help")); mem::swap(a, &mut String::from("--help"));
} }
......
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use errors; use crate::errors;
use errors::{DenoError, DenoResult}; use crate::errors::{DenoError, DenoResult};
use tokio_util; use crate::tokio_util;
use futures::future::{loop_fn, Loop}; use futures::future::{loop_fn, Loop};
use futures::{future, Future, Stream}; use futures::{future, Future, Stream};
......
...@@ -3,16 +3,17 @@ ...@@ -3,16 +3,17 @@
// TODO Currently this module uses Tokio, but it would be nice if they were // TODO Currently this module uses Tokio, but it would be nice if they were
// decoupled. // decoupled.
use compiler::compile_sync; use crate::compiler::compile_sync;
use compiler::CodeFetchOutput; use crate::compiler::CodeFetchOutput;
use deno_dir; use crate::deno_dir;
use errors::DenoError; use crate::errors::DenoError;
use errors::DenoResult; use crate::errors::DenoResult;
use flags; use crate::flags;
use js_errors::JSError; use crate::js_errors::JSError;
use libdeno; use crate::libdeno;
use msg; use crate::msg;
use permissions::DenoPermissions; use crate::permissions::DenoPermissions;
use crate::tokio_util;
use futures::sync::mpsc as async_mpsc; use futures::sync::mpsc as async_mpsc;
use futures::Future; use futures::Future;
...@@ -30,7 +31,6 @@ use std::sync::Mutex; ...@@ -30,7 +31,6 @@ use std::sync::Mutex;
use std::time::Duration; use std::time::Duration;
use std::time::Instant; use std::time::Instant;
use tokio; use tokio;
use tokio_util;
// Buf represents a byte array returned from a "Op". // Buf represents a byte array returned from a "Op".
// The message might be empty (which will be translated into a null object on // The message might be empty (which will be translated into a null object on
...@@ -40,7 +40,7 @@ pub type Buf = Box<[u8]>; ...@@ -40,7 +40,7 @@ pub type Buf = Box<[u8]>;
// JS promises in Deno map onto a specific Future // JS promises in Deno map onto a specific Future
// which yields either a DenoError or a byte array. // which yields either a DenoError or a byte array.
pub type Op = Future<Item = Buf, Error = DenoError> + Send; pub type Op = dyn Future<Item = Buf, Error = DenoError> + Send;
// Returns (is_sync, op) // Returns (is_sync, op)
pub type Dispatch = pub type Dispatch =
......
...@@ -184,7 +184,7 @@ impl StackFrame { ...@@ -184,7 +184,7 @@ impl StackFrame {
fn apply_source_map( fn apply_source_map(
&self, &self,
mappings_map: &mut CachedMaps, mappings_map: &mut CachedMaps,
getter: &SourceMapGetter, getter: &dyn SourceMapGetter,
) -> StackFrame { ) -> StackFrame {
let maybe_sm = let maybe_sm =
get_mappings(self.script_name.as_ref(), mappings_map, getter); get_mappings(self.script_name.as_ref(), mappings_map, getter);
...@@ -319,7 +319,7 @@ impl JSError { ...@@ -319,7 +319,7 @@ impl JSError {
}) })
} }
pub fn apply_source_map(&self, getter: &SourceMapGetter) -> Self { pub fn apply_source_map(&self, getter: &dyn SourceMapGetter) -> Self {
let mut mappings_map: CachedMaps = HashMap::new(); let mut mappings_map: CachedMaps = HashMap::new();
let mut frames = Vec::<StackFrame>::new(); let mut frames = Vec::<StackFrame>::new();
for frame in &self.frames { for frame in &self.frames {
...@@ -344,7 +344,7 @@ impl JSError { ...@@ -344,7 +344,7 @@ impl JSError {
fn parse_map_string( fn parse_map_string(
script_name: &str, script_name: &str,
getter: &SourceMapGetter, getter: &dyn SourceMapGetter,
) -> Option<SourceMap> { ) -> Option<SourceMap> {
match script_name { match script_name {
// The bundle does not get built for 'cargo check', so we don't embed the // The bundle does not get built for 'cargo check', so we don't embed the
...@@ -365,7 +365,7 @@ fn parse_map_string( ...@@ -365,7 +365,7 @@ fn parse_map_string(
fn get_mappings<'a>( fn get_mappings<'a>(
script_name: &str, script_name: &str,
mappings_map: &'a mut CachedMaps, mappings_map: &'a mut CachedMaps,
getter: &SourceMapGetter, getter: &dyn SourceMapGetter,
) -> &'a Option<SourceMap> { ) -> &'a Option<SourceMap> {
mappings_map mappings_map
.entry(script_name.to_string()) .entry(script_name.to_string())
......
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
extern crate dirs; use dirs;
extern crate flatbuffers; use flatbuffers;
extern crate getopts; use getopts;
extern crate http; use http;
extern crate hyper; use hyper;
extern crate hyper_rustls; use hyper_rustls;
extern crate libc; use libc;
extern crate rand; use rand;
extern crate remove_dir_all; use remove_dir_all;
extern crate ring; use ring;
extern crate rustyline; use rustyline;
extern crate source_map_mappings; use source_map_mappings;
extern crate tempfile; use tempfile;
extern crate tokio; use tokio;
extern crate tokio_executor; use tokio_executor;
extern crate tokio_fs; use tokio_fs;
extern crate tokio_io; use tokio_io;
extern crate tokio_process; use tokio_process;
extern crate tokio_threadpool; use tokio_threadpool;
extern crate url; use url;
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;
...@@ -63,11 +63,11 @@ static LOGGER: Logger = Logger; ...@@ -63,11 +63,11 @@ static LOGGER: Logger = Logger;
struct Logger; struct Logger;
impl log::Log for Logger { impl log::Log for Logger {
fn enabled(&self, metadata: &log::Metadata) -> bool { fn enabled(&self, metadata: &log::Metadata<'_>) -> bool {
metadata.level() <= log::max_level() metadata.level() <= log::max_level()
} }
fn log(&self, record: &log::Record) { fn log(&self, record: &log::Record<'_>) {
if self.enabled(record.metadata()) { if self.enabled(record.metadata()) {
println!("{} RS - {}", record.level(), record.args()); println!("{} RS - {}", record.level(), record.args());
} }
......
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
// Helpers for serialization. // Helpers for serialization.
use errors; use crate::errors;
use errors::DenoResult; use crate::errors::DenoResult;
use crate::msg;
use flatbuffers; use flatbuffers;
use http::header::HeaderName; use http::header::HeaderName;
use http::uri::Uri; use http::uri::Uri;
...@@ -11,7 +13,6 @@ use hyper::header::HeaderValue; ...@@ -11,7 +13,6 @@ use hyper::header::HeaderValue;
use hyper::Body; use hyper::Body;
use hyper::Request; use hyper::Request;
use hyper::Response; use hyper::Response;
use msg;
use std::str::FromStr; use std::str::FromStr;
type Headers = HeaderMap<HeaderValue>; type Headers = HeaderMap<HeaderValue>;
...@@ -94,7 +95,7 @@ pub fn serialize_http_response<'bldr>( ...@@ -94,7 +95,7 @@ pub fn serialize_http_response<'bldr>(
} }
pub fn deserialize_request( pub fn deserialize_request(
header_msg: msg::HttpHeader, header_msg: msg::HttpHeader<'_>,
body: Body, body: Body,
) -> DenoResult<Request<Body>> { ) -> DenoResult<Request<Body>> {
let mut r = Request::new(body); let mut r = Request::new(body);
......
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use errors; use crate::errors;
use errors::{DenoError, DenoResult, ErrorKind}; use crate::errors::{DenoError, DenoResult, ErrorKind};
use fs as deno_fs; use crate::fs as deno_fs;
use http_util; use crate::http_util;
use isolate::Buf; use crate::isolate::Buf;
use isolate::Isolate; use crate::isolate::Isolate;
use isolate::IsolateState; use crate::isolate::IsolateState;
use isolate::Op; use crate::isolate::Op;
use libdeno; use crate::libdeno;
use msg; use crate::msg;
use msg_util; use crate::msg_util;
use resolve_addr::resolve_addr; use crate::repl;
use resources; use crate::resolve_addr::resolve_addr;
use resources::Resource; use crate::resources;
use version; use crate::resources::table_entries;
use crate::resources::Resource;
use crate::tokio_util;
use crate::version;
use flatbuffers::FlatBufferBuilder; use flatbuffers::FlatBufferBuilder;
use futures; use futures;
...@@ -24,8 +27,6 @@ use futures::Stream; ...@@ -24,8 +27,6 @@ use futures::Stream;
use hyper; use hyper;
use hyper::rt::Future; use hyper::rt::Future;
use remove_dir_all::remove_dir_all; use remove_dir_all::remove_dir_all;
use repl;
use resources::table_entries;
use std; use std;
use std::convert::From; use std::convert::From;
use std::fs; use std::fs;
...@@ -45,14 +46,13 @@ use tokio::net::TcpListener; ...@@ -45,14 +46,13 @@ use tokio::net::TcpListener;
use tokio::net::TcpStream; use tokio::net::TcpStream;
use tokio_process::CommandExt; use tokio_process::CommandExt;
use tokio_threadpool; use tokio_threadpool;
use tokio_util;
type OpResult = DenoResult<Buf>; type OpResult = DenoResult<Buf>;
// TODO Ideally we wouldn't have to box the Op being returned. // TODO Ideally we wouldn't have to box the Op being returned.
// The box is just to make it easier to get a prototype refactor working. // The box is just to make it easier to get a prototype refactor working.
type OpCreator = type OpCreator =
fn(state: &Arc<IsolateState>, base: &msg::Base, data: libdeno::deno_buf) fn(state: &Arc<IsolateState>, base: &msg::Base<'_>, data: libdeno::deno_buf)
-> Box<Op>; -> Box<Op>;
#[inline] #[inline]
...@@ -175,7 +175,7 @@ pub fn dispatch( ...@@ -175,7 +175,7 @@ pub fn dispatch(
fn op_exit( fn op_exit(
_config: &Arc<IsolateState>, _config: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
_data: libdeno::deno_buf, _data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
let inner = base.inner_as_exit().unwrap(); let inner = base.inner_as_exit().unwrap();
...@@ -184,7 +184,7 @@ fn op_exit( ...@@ -184,7 +184,7 @@ fn op_exit(
fn op_start( fn op_start(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -232,8 +232,8 @@ fn op_start( ...@@ -232,8 +232,8 @@ fn op_start(
fn serialize_response( fn serialize_response(
cmd_id: u32, cmd_id: u32,
builder: &mut FlatBufferBuilder, builder: &mut FlatBufferBuilder<'_>,
mut args: msg::BaseArgs, mut args: msg::BaseArgs<'_>,
) -> Buf { ) -> Buf {
args.cmd_id = cmd_id; args.cmd_id = cmd_id;
let base = msg::Base::create(builder, &args); let base = msg::Base::create(builder, &args);
...@@ -257,7 +257,7 @@ pub fn odd_future(err: DenoError) -> Box<Op> { ...@@ -257,7 +257,7 @@ pub fn odd_future(err: DenoError) -> Box<Op> {
// https://github.com/denoland/deno/blob/golang/os.go#L100-L154 // https://github.com/denoland/deno/blob/golang/os.go#L100-L154
fn op_code_fetch( fn op_code_fetch(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -300,7 +300,7 @@ fn op_code_fetch( ...@@ -300,7 +300,7 @@ fn op_code_fetch(
// https://github.com/denoland/deno/blob/golang/os.go#L156-L169 // https://github.com/denoland/deno/blob/golang/os.go#L156-L169
fn op_code_cache( fn op_code_cache(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -319,7 +319,7 @@ fn op_code_cache( ...@@ -319,7 +319,7 @@ fn op_code_cache(
fn op_chdir( fn op_chdir(
_state: &Arc<IsolateState>, _state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -333,7 +333,7 @@ fn op_chdir( ...@@ -333,7 +333,7 @@ fn op_chdir(
fn op_set_timeout( fn op_set_timeout(
isolate: &Isolate, isolate: &Isolate,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -351,7 +351,7 @@ fn op_set_timeout( ...@@ -351,7 +351,7 @@ fn op_set_timeout(
fn op_set_env( fn op_set_env(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -367,7 +367,7 @@ fn op_set_env( ...@@ -367,7 +367,7 @@ fn op_set_env(
fn op_env( fn op_env(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -399,7 +399,7 @@ fn op_env( ...@@ -399,7 +399,7 @@ fn op_env(
fn op_fetch( fn op_fetch(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
let inner = base.inner_as_fetch().unwrap(); let inner = base.inner_as_fetch().unwrap();
...@@ -486,7 +486,7 @@ where ...@@ -486,7 +486,7 @@ where
fn op_make_temp_dir( fn op_make_temp_dir(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -535,7 +535,7 @@ fn op_make_temp_dir( ...@@ -535,7 +535,7 @@ fn op_make_temp_dir(
fn op_mkdir( fn op_mkdir(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -555,7 +555,7 @@ fn op_mkdir( ...@@ -555,7 +555,7 @@ fn op_mkdir(
fn op_chmod( fn op_chmod(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -588,7 +588,7 @@ fn op_chmod( ...@@ -588,7 +588,7 @@ fn op_chmod(
fn op_open( fn op_open(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -664,7 +664,7 @@ fn op_open( ...@@ -664,7 +664,7 @@ fn op_open(
fn op_close( fn op_close(
_state: &Arc<IsolateState>, _state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -681,7 +681,7 @@ fn op_close( ...@@ -681,7 +681,7 @@ fn op_close(
fn op_shutdown( fn op_shutdown(
_state: &Arc<IsolateState>, _state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -707,7 +707,7 @@ fn op_shutdown( ...@@ -707,7 +707,7 @@ fn op_shutdown(
fn op_read( fn op_read(
_state: &Arc<IsolateState>, _state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
let cmd_id = base.cmd_id(); let cmd_id = base.cmd_id();
...@@ -745,7 +745,7 @@ fn op_read( ...@@ -745,7 +745,7 @@ fn op_read(
fn op_write( fn op_write(
_state: &Arc<IsolateState>, _state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
let cmd_id = base.cmd_id(); let cmd_id = base.cmd_id();
...@@ -782,7 +782,7 @@ fn op_write( ...@@ -782,7 +782,7 @@ fn op_write(
fn op_remove( fn op_remove(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -812,7 +812,7 @@ fn op_remove( ...@@ -812,7 +812,7 @@ fn op_remove(
// Prototype https://github.com/denoland/deno/blob/golang/os.go#L171-L184 // Prototype https://github.com/denoland/deno/blob/golang/os.go#L171-L184
fn op_read_file( fn op_read_file(
_state: &Arc<IsolateState>, _state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -846,7 +846,7 @@ fn op_read_file( ...@@ -846,7 +846,7 @@ fn op_read_file(
fn op_copy_file( fn op_copy_file(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -898,7 +898,7 @@ fn get_mode(_perm: &fs::Permissions) -> u32 { ...@@ -898,7 +898,7 @@ fn get_mode(_perm: &fs::Permissions) -> u32 {
fn op_cwd( fn op_cwd(
_state: &Arc<IsolateState>, _state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -924,7 +924,7 @@ fn op_cwd( ...@@ -924,7 +924,7 @@ fn op_cwd(
fn op_stat( fn op_stat(
_state: &Arc<IsolateState>, _state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -971,7 +971,7 @@ fn op_stat( ...@@ -971,7 +971,7 @@ fn op_stat(
fn op_read_dir( fn op_read_dir(
_state: &Arc<IsolateState>, _state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -1029,7 +1029,7 @@ fn op_read_dir( ...@@ -1029,7 +1029,7 @@ fn op_read_dir(
fn op_write_file( fn op_write_file(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
let inner = base.inner_as_write_file().unwrap(); let inner = base.inner_as_write_file().unwrap();
...@@ -1049,7 +1049,7 @@ fn op_write_file( ...@@ -1049,7 +1049,7 @@ fn op_write_file(
fn op_rename( fn op_rename(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -1069,7 +1069,7 @@ fn op_rename( ...@@ -1069,7 +1069,7 @@ fn op_rename(
fn op_symlink( fn op_symlink(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -1098,7 +1098,7 @@ fn op_symlink( ...@@ -1098,7 +1098,7 @@ fn op_symlink(
fn op_read_link( fn op_read_link(
_state: &Arc<IsolateState>, _state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -1131,7 +1131,7 @@ fn op_read_link( ...@@ -1131,7 +1131,7 @@ fn op_read_link(
fn op_repl_start( fn op_repl_start(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -1162,7 +1162,7 @@ fn op_repl_start( ...@@ -1162,7 +1162,7 @@ fn op_repl_start(
fn op_repl_readline( fn op_repl_readline(
_state: &Arc<IsolateState>, _state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -1200,7 +1200,7 @@ fn op_repl_readline( ...@@ -1200,7 +1200,7 @@ fn op_repl_readline(
fn op_truncate( fn op_truncate(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -1223,7 +1223,7 @@ fn op_truncate( ...@@ -1223,7 +1223,7 @@ fn op_truncate(
fn op_listen( fn op_listen(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -1288,7 +1288,7 @@ fn new_conn(cmd_id: u32, tcp_stream: TcpStream) -> OpResult { ...@@ -1288,7 +1288,7 @@ fn new_conn(cmd_id: u32, tcp_stream: TcpStream) -> OpResult {
fn op_accept( fn op_accept(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -1314,7 +1314,7 @@ fn op_accept( ...@@ -1314,7 +1314,7 @@ fn op_accept(
fn op_dial( fn op_dial(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -1340,7 +1340,7 @@ fn op_dial( ...@@ -1340,7 +1340,7 @@ fn op_dial(
fn op_metrics( fn op_metrics(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -1364,7 +1364,7 @@ fn op_metrics( ...@@ -1364,7 +1364,7 @@ fn op_metrics(
fn op_resources( fn op_resources(
_state: &Arc<IsolateState>, _state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -1416,7 +1416,7 @@ fn subprocess_stdio_map(v: msg::ProcessStdio) -> std::process::Stdio { ...@@ -1416,7 +1416,7 @@ fn subprocess_stdio_map(v: msg::ProcessStdio) -> std::process::Stdio {
fn op_run( fn op_run(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert!(base.sync()); assert!(base.sync());
...@@ -1484,7 +1484,7 @@ fn op_run( ...@@ -1484,7 +1484,7 @@ fn op_run(
fn op_run_status( fn op_run_status(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -1560,7 +1560,7 @@ impl Future for GetMessageFuture { ...@@ -1560,7 +1560,7 @@ impl Future for GetMessageFuture {
fn op_worker_get_message( fn op_worker_get_message(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
assert_eq!(data.len(), 0); assert_eq!(data.len(), 0);
...@@ -1594,7 +1594,7 @@ fn op_worker_get_message( ...@@ -1594,7 +1594,7 @@ fn op_worker_get_message(
fn op_worker_post_message( fn op_worker_post_message(
state: &Arc<IsolateState>, state: &Arc<IsolateState>,
base: &msg::Base, base: &msg::Base<'_>,
data: libdeno::deno_buf, data: libdeno::deno_buf,
) -> Box<Op> { ) -> Box<Op> {
let cmd_id = base.cmd_id(); let cmd_id = base.cmd_id();
...@@ -1605,7 +1605,7 @@ fn op_worker_post_message( ...@@ -1605,7 +1605,7 @@ fn op_worker_post_message(
let tx = match state.worker_channels { let tx = match state.worker_channels {
None => panic!("expected worker_channels"), None => panic!("expected worker_channels"),
Some(ref wc) => { Some(ref wc) => {
let mut wc = wc.lock().unwrap(); let wc = wc.lock().unwrap();
wc.0.clone() wc.0.clone()
} }
}; };
......
extern crate atty; use atty;
use flags::DenoFlags; use crate::flags::DenoFlags;
use errors::permission_denied; use crate::errors::permission_denied;
use errors::DenoResult; use crate::errors::DenoResult;
use std::io; use std::io;
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
......
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
extern crate rustyline; use rustyline;
use rustyline::error::ReadlineError::Interrupted; use rustyline::error::ReadlineError::Interrupted;
use msg::ErrorKind; use crate::msg::ErrorKind;
use std::error::Error; use std::error::Error;
use deno_dir::DenoDir; use crate::deno_dir::DenoDir;
use errors::new as deno_error; use crate::errors::new as deno_error;
use errors::DenoResult; use crate::errors::DenoResult;
use std::path::PathBuf; use std::path::PathBuf;
use std::process::exit; use std::process::exit;
......
...@@ -28,7 +28,7 @@ pub enum ResolveAddrError { ...@@ -28,7 +28,7 @@ pub enum ResolveAddrError {
} }
impl fmt::Display for ResolveAddrError { impl fmt::Display for ResolveAddrError {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.write_str(self.description()) fmt.write_str(self.description())
} }
} }
......
...@@ -9,16 +9,17 @@ ...@@ -9,16 +9,17 @@
// handlers) look up resources by their integer id here. // handlers) look up resources by their integer id here.
#[cfg(unix)] #[cfg(unix)]
use eager_unix as eager; use crate::eager_unix as eager;
use errors; use crate::errors;
use errors::bad_resource; use crate::errors::bad_resource;
use errors::DenoError; use crate::errors::DenoError;
use errors::DenoResult; use crate::errors::DenoResult;
use http_body::HttpBody; use crate::http_body::HttpBody;
use isolate::WorkerChannels; use crate::isolate::Buf;
use repl::Repl; use crate::isolate::WorkerChannels;
use tokio_util; use crate::repl::Repl;
use tokio_write; use crate::tokio_util;
use crate::tokio_write;
use futures; use futures;
use futures::future::{Either, FutureResult}; use futures::future::{Either, FutureResult};
...@@ -27,7 +28,6 @@ use futures::Poll; ...@@ -27,7 +28,6 @@ use futures::Poll;
use futures::Sink; use futures::Sink;
use futures::Stream; use futures::Stream;
use hyper; use hyper;
use isolate::Buf;
use std; use std;
use std::collections::HashMap; use std::collections::HashMap;
use std::io::{Error, Read, Write}; use std::io::{Error, Read, Write};
......
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use libdeno::deno_buf; use crate::libdeno::deno_buf;
pub fn deno_snapshot() -> deno_buf { pub fn deno_snapshot() -> deno_buf {
#[cfg(not(feature = "check-only"))] #[cfg(not(feature = "check-only"))]
......
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use resources::Resource; use crate::resources::Resource;
use futures; use futures;
use futures::Future; use futures::Future;
......
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use libdeno; use crate::libdeno;
use std::ffi::CStr; use std::ffi::CStr;
pub const DENO: &str = env!("CARGO_PKG_VERSION"); pub const DENO: &str = env!("CARGO_PKG_VERSION");
......
// Copyright 2018 the Deno authors. All rights reserved. MIT license. // Copyright 2018 the Deno authors. All rights reserved. MIT license.
use isolate::Buf; use crate::isolate::Buf;
use isolate::Isolate; use crate::isolate::Isolate;
use isolate::IsolateState; use crate::isolate::IsolateState;
use isolate::WorkerChannels; use crate::isolate::WorkerChannels;
use js_errors::JSError; use crate::js_errors::JSError;
use ops; use crate::ops;
use resources; use crate::resources;
use snapshot; use crate::snapshot;
use tokio_util; use crate::tokio_util;
use futures::sync::mpsc; use futures::sync::mpsc;
use futures::sync::oneshot; use futures::sync::oneshot;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册