mirror of
https://github.com/denoland/deno.git
synced 2024-12-25 16:49:18 -05:00
chore: upgrade Rust to 1.53.0 (#11021)
This commit is contained in:
parent
2a66d5de01
commit
8031644e65
12 changed files with 26 additions and 33 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -77,7 +77,7 @@ jobs:
|
||||||
- name: Install rust
|
- name: Install rust
|
||||||
uses: hecrj/setup-rust-action@v1
|
uses: hecrj/setup-rust-action@v1
|
||||||
with:
|
with:
|
||||||
rust-version: 1.52.1
|
rust-version: 1.53.0
|
||||||
|
|
||||||
- name: Install clippy and rustfmt
|
- name: Install clippy and rustfmt
|
||||||
if: matrix.kind == 'lint'
|
if: matrix.kind == 'lint'
|
||||||
|
|
|
@ -439,7 +439,7 @@ struct BenchResult {
|
||||||
we replace the harness with our own runner here.
|
we replace the harness with our own runner here.
|
||||||
*/
|
*/
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
if env::args().find(|s| s == "--bench").is_none() {
|
if !env::args().any(|s| s == "--bench") {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,12 +170,12 @@ mod tests {
|
||||||
let mut cache_location = temp_dir.path().to_owned();
|
let mut cache_location = temp_dir.path().to_owned();
|
||||||
assert!(fs::remove_dir(&cache_location).is_ok());
|
assert!(fs::remove_dir(&cache_location).is_ok());
|
||||||
cache_location.push("foo");
|
cache_location.push("foo");
|
||||||
assert_eq!(cache_location.is_dir(), false);
|
assert!(!cache_location.is_dir());
|
||||||
let cache = DiskCache::new(&cache_location);
|
let cache = DiskCache::new(&cache_location);
|
||||||
cache
|
cache
|
||||||
.ensure_dir_exists(&cache.location)
|
.ensure_dir_exists(&cache.location)
|
||||||
.expect("Testing expect:");
|
.expect("Testing expect:");
|
||||||
assert_eq!(cache_location.is_dir(), true);
|
assert!(cache_location.is_dir());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -504,7 +504,7 @@ impl Inner {
|
||||||
specifier: &ModuleSpecifier,
|
specifier: &ModuleSpecifier,
|
||||||
) -> Result<Option<AssetDocument>, AnyError> {
|
) -> Result<Option<AssetDocument>, AnyError> {
|
||||||
if let Some(maybe_asset) = self.assets.get(specifier) {
|
if let Some(maybe_asset) = self.assets.get(specifier) {
|
||||||
return Ok(maybe_asset.clone());
|
Ok(maybe_asset.clone())
|
||||||
} else {
|
} else {
|
||||||
let maybe_asset =
|
let maybe_asset =
|
||||||
tsc::get_asset(&specifier, &self.ts_server, self.snapshot()?).await?;
|
tsc::get_asset(&specifier, &self.ts_server, self.snapshot()?).await?;
|
||||||
|
|
|
@ -670,7 +670,7 @@ pub mod tests {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let cached_module: CachedModule =
|
let cached_module: CachedModule =
|
||||||
file_fetcher.fetch(specifier, None, false).await.unwrap();
|
file_fetcher.fetch(specifier, None, false).await.unwrap();
|
||||||
assert_eq!(cached_module.is_remote, true);
|
assert!(cached_module.is_remote);
|
||||||
let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
|
let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
|
||||||
let specifier = resolve_url_or_path(
|
let specifier = resolve_url_or_path(
|
||||||
c.join("tests/subdir/mod1.ts").as_os_str().to_str().unwrap(),
|
c.join("tests/subdir/mod1.ts").as_os_str().to_str().unwrap(),
|
||||||
|
@ -678,7 +678,7 @@ pub mod tests {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let cached_module: CachedModule =
|
let cached_module: CachedModule =
|
||||||
file_fetcher.fetch(specifier, None, false).await.unwrap();
|
file_fetcher.fetch(specifier, None, false).await.unwrap();
|
||||||
assert_eq!(cached_module.is_remote, false);
|
assert!(!cached_module.is_remote);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
@ -716,7 +716,7 @@ pub mod tests {
|
||||||
assert_eq!(actual.requested_specifier, specifier);
|
assert_eq!(actual.requested_specifier, specifier);
|
||||||
assert_eq!(actual.specifier, specifier);
|
assert_eq!(actual.specifier, specifier);
|
||||||
assert_eq!(actual.media_type, MediaType::TypeScript);
|
assert_eq!(actual.media_type, MediaType::TypeScript);
|
||||||
assert_eq!(actual.is_remote, false);
|
assert!(!actual.is_remote);
|
||||||
|
|
||||||
let specifier = resolve_url_or_path("file:///b.ts").unwrap();
|
let specifier = resolve_url_or_path("file:///b.ts").unwrap();
|
||||||
let actual: CachedModule = handler
|
let actual: CachedModule = handler
|
||||||
|
@ -727,7 +727,7 @@ pub mod tests {
|
||||||
assert_eq!(actual.requested_specifier, specifier);
|
assert_eq!(actual.requested_specifier, specifier);
|
||||||
assert_eq!(actual.specifier, specifier);
|
assert_eq!(actual.specifier, specifier);
|
||||||
assert_eq!(actual.media_type, MediaType::TypeScript);
|
assert_eq!(actual.media_type, MediaType::TypeScript);
|
||||||
assert_eq!(actual.is_remote, false);
|
assert!(!actual.is_remote);
|
||||||
|
|
||||||
let specifier = resolve_url_or_path("https://deno.land/x/c.js").unwrap();
|
let specifier = resolve_url_or_path("https://deno.land/x/c.js").unwrap();
|
||||||
let actual: CachedModule = handler
|
let actual: CachedModule = handler
|
||||||
|
@ -738,7 +738,7 @@ pub mod tests {
|
||||||
assert_eq!(actual.requested_specifier, specifier);
|
assert_eq!(actual.requested_specifier, specifier);
|
||||||
assert_eq!(actual.specifier, specifier);
|
assert_eq!(actual.specifier, specifier);
|
||||||
assert_eq!(actual.media_type, MediaType::JavaScript);
|
assert_eq!(actual.media_type, MediaType::JavaScript);
|
||||||
assert_eq!(actual.is_remote, true);
|
assert!(actual.is_remote);
|
||||||
|
|
||||||
let specifier = resolve_url_or_path("https://deno.land/x/d.d.ts").unwrap();
|
let specifier = resolve_url_or_path("https://deno.land/x/d.d.ts").unwrap();
|
||||||
let actual: CachedModule = handler
|
let actual: CachedModule = handler
|
||||||
|
@ -749,7 +749,7 @@ pub mod tests {
|
||||||
assert_eq!(actual.requested_specifier, specifier);
|
assert_eq!(actual.requested_specifier, specifier);
|
||||||
assert_eq!(actual.specifier, specifier);
|
assert_eq!(actual.specifier, specifier);
|
||||||
assert_eq!(actual.media_type, MediaType::Dts);
|
assert_eq!(actual.media_type, MediaType::Dts);
|
||||||
assert_eq!(actual.is_remote, true);
|
assert!(actual.is_remote);
|
||||||
|
|
||||||
let specifier =
|
let specifier =
|
||||||
resolve_url_or_path("https://deno.land/x/missing.ts").unwrap();
|
resolve_url_or_path("https://deno.land/x/missing.ts").unwrap();
|
||||||
|
@ -767,7 +767,7 @@ pub mod tests {
|
||||||
assert_eq!(actual.requested_specifier, specifier);
|
assert_eq!(actual.requested_specifier, specifier);
|
||||||
assert_eq!(actual.specifier, specifier);
|
assert_eq!(actual.specifier, specifier);
|
||||||
assert_eq!(actual.media_type, MediaType::TypeScript);
|
assert_eq!(actual.media_type, MediaType::TypeScript);
|
||||||
assert_eq!(actual.is_remote, false);
|
assert!(!actual.is_remote);
|
||||||
|
|
||||||
let specifier = resolve_url_or_path("file:///C:/a.ts").unwrap();
|
let specifier = resolve_url_or_path("file:///C:/a.ts").unwrap();
|
||||||
let actual: CachedModule = handler
|
let actual: CachedModule = handler
|
||||||
|
@ -778,6 +778,6 @@ pub mod tests {
|
||||||
assert_eq!(actual.requested_specifier, specifier);
|
assert_eq!(actual.requested_specifier, specifier);
|
||||||
assert_eq!(actual.specifier, specifier);
|
assert_eq!(actual.specifier, specifier);
|
||||||
assert_eq!(actual.media_type, MediaType::TypeScript);
|
assert_eq!(actual.media_type, MediaType::TypeScript);
|
||||||
assert_eq!(actual.is_remote, false);
|
assert!(!actual.is_remote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -644,10 +644,10 @@ mod tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(futures.into_iter().any(|fut| !fut.is_terminated()), false);
|
assert!(!futures.into_iter().any(|fut| !fut.is_terminated()));
|
||||||
|
|
||||||
let cancel_handles = [cancel_now, cancel_at_0, cancel_at_1, cancel_at_4];
|
let cancel_handles = [cancel_now, cancel_at_0, cancel_at_1, cancel_at_4];
|
||||||
assert_eq!(cancel_handles.iter().any(|c| !c.is_canceled()), false);
|
assert!(!cancel_handles.iter().any(|c| !c.is_canceled()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
|
@ -206,7 +206,7 @@ pub extern "C" fn host_import_module_dynamically_callback(
|
||||||
if arg.is_native_error() {
|
if arg.is_native_error() {
|
||||||
let message = v8::Exception::create_message(scope, arg);
|
let message = v8::Exception::create_message(scope, arg);
|
||||||
if message.get_stack_trace(scope).unwrap().get_frame_count() == 0 {
|
if message.get_stack_trace(scope).unwrap().get_frame_count() == 0 {
|
||||||
let arg: v8::Local<v8::Object> = arg.clone().try_into().unwrap();
|
let arg: v8::Local<v8::Object> = arg.try_into().unwrap();
|
||||||
let message_key = v8::String::new(scope, "message").unwrap();
|
let message_key = v8::String::new(scope, "message").unwrap();
|
||||||
let message = arg.get(scope, message_key.into()).unwrap();
|
let message = arg.get(scope, message_key.into()).unwrap();
|
||||||
let exception =
|
let exception =
|
||||||
|
|
|
@ -191,8 +191,7 @@ impl JsError {
|
||||||
|
|
||||||
let (message, frames, stack) = if exception.is_native_error() {
|
let (message, frames, stack) = if exception.is_native_error() {
|
||||||
// The exception is a JS Error object.
|
// The exception is a JS Error object.
|
||||||
let exception: v8::Local<v8::Object> =
|
let exception: v8::Local<v8::Object> = exception.try_into().unwrap();
|
||||||
exception.clone().try_into().unwrap();
|
|
||||||
|
|
||||||
let e: NativeJsError =
|
let e: NativeJsError =
|
||||||
serde_v8::from_v8(scope, exception.into()).unwrap();
|
serde_v8::from_v8(scope, exception.into()).unwrap();
|
||||||
|
|
|
@ -429,7 +429,7 @@ impl StdFileResource {
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.await;
|
.await;
|
||||||
let nwritten = fs_file.0.as_mut().unwrap().read(buf).await?;
|
let nwritten = fs_file.0.as_mut().unwrap().read(buf).await?;
|
||||||
return Ok(nwritten);
|
Ok(nwritten)
|
||||||
} else {
|
} else {
|
||||||
Err(resource_unavailable())
|
Err(resource_unavailable())
|
||||||
}
|
}
|
||||||
|
@ -442,7 +442,7 @@ impl StdFileResource {
|
||||||
.await;
|
.await;
|
||||||
let nwritten = fs_file.0.as_mut().unwrap().write(buf).await?;
|
let nwritten = fs_file.0.as_mut().unwrap().write(buf).await?;
|
||||||
fs_file.0.as_mut().unwrap().flush().await?;
|
fs_file.0.as_mut().unwrap().flush().await?;
|
||||||
return Ok(nwritten);
|
Ok(nwritten)
|
||||||
} else {
|
} else {
|
||||||
Err(resource_unavailable())
|
Err(resource_unavailable())
|
||||||
}
|
}
|
||||||
|
|
|
@ -408,8 +408,7 @@ impl WebWorker {
|
||||||
// If `None` is returned it means that runtime was destroyed before
|
// If `None` is returned it means that runtime was destroyed before
|
||||||
// evaluation was complete. This can happen in Web Worker when `self.close()`
|
// evaluation was complete. This can happen in Web Worker when `self.close()`
|
||||||
// is called at top level.
|
// is called at top level.
|
||||||
let result = maybe_result.unwrap_or(Ok(()));
|
maybe_result.unwrap_or(Ok(()))
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event_loop_result = self.run_event_loop(false) => {
|
event_loop_result = self.run_event_loop(false) => {
|
||||||
|
@ -418,8 +417,7 @@ impl WebWorker {
|
||||||
}
|
}
|
||||||
event_loop_result?;
|
event_loop_result?;
|
||||||
let maybe_result = receiver.next().await;
|
let maybe_result = receiver.next().await;
|
||||||
let result = maybe_result.unwrap_or(Ok(()));
|
maybe_result.unwrap_or(Ok(()))
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,15 +215,13 @@ impl MainWorker {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
maybe_result = receiver.next() => {
|
maybe_result = receiver.next() => {
|
||||||
debug!("received module evaluate {:#?}", maybe_result);
|
debug!("received module evaluate {:#?}", maybe_result);
|
||||||
let result = maybe_result.expect("Module evaluation result not provided.");
|
maybe_result.expect("Module evaluation result not provided.")
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event_loop_result = self.run_event_loop(false) => {
|
event_loop_result = self.run_event_loop(false) => {
|
||||||
event_loop_result?;
|
event_loop_result?;
|
||||||
let maybe_result = receiver.next().await;
|
let maybe_result = receiver.next().await;
|
||||||
let result = maybe_result.expect("Module evaluation result not provided.");
|
maybe_result.expect("Module evaluation result not provided.")
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,11 +298,9 @@ async fn get_tls_config(
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
return Ok(Arc::new(config));
|
Ok(Arc::new(config))
|
||||||
}
|
|
||||||
None => {
|
|
||||||
return Err(io::Error::new(io::ErrorKind::Other, "Cannot find key"));
|
|
||||||
}
|
}
|
||||||
|
None => Err(io::Error::new(io::ErrorKind::Other, "Cannot find key")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +367,7 @@ async fn absolute_redirect(
|
||||||
|
|
||||||
let file = tokio::fs::read(file_path).await.unwrap();
|
let file = tokio::fs::read(file_path).await.unwrap();
|
||||||
let file_resp = custom_headers(req.uri().path(), file);
|
let file_resp = custom_headers(req.uri().path(), file);
|
||||||
return Ok(file_resp);
|
Ok(file_resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn main_server(req: Request<Body>) -> hyper::Result<Response<Body>> {
|
async fn main_server(req: Request<Body>) -> hyper::Result<Response<Body>> {
|
||||||
|
|
Loading…
Reference in a new issue