mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
chore: update to Rust 1.72 (#20258)
<!-- Before submitting a PR, please read https://deno.com/manual/contributing 1. Give the PR a descriptive title. Examples of good title: - fix(std/http): Fix race condition in server - docs(console): Update docstrings - feat(doc): Handle nested reexports Examples of bad title: - fix #7123 - update docs - fix bugs 2. Ensure there is a related issue and it is referenced in the PR text. 3. Ensure there are tests that cover the changes. 4. Ensure `cargo test` passes. 5. Ensure `./tools/format.js` passes without changing files. 6. Ensure `./tools/lint.js` passes. 7. Open as a draft PR if your work is still in progress. The CI won't run all steps, but you can add '[ci]' to a commit message to force it to. 8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label. --> As the title. --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
This commit is contained in:
parent
669b6fd692
commit
51befb9bb5
28 changed files with 212 additions and 190 deletions
|
@ -476,7 +476,8 @@ impl FileFetcher {
|
|||
let Ok(cache_key) = self.http_cache.cache_item_key(specifier) else {
|
||||
return false;
|
||||
};
|
||||
let Ok(Some(metadata)) = self.http_cache.read_metadata(&cache_key) else {
|
||||
let Ok(Some(metadata)) = self.http_cache.read_metadata(&cache_key)
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
let cache_semantics = CacheSemantics::new(
|
||||
|
|
|
@ -1872,7 +1872,7 @@ impl Inner {
|
|||
}
|
||||
_ => false,
|
||||
},
|
||||
"deno-lint" => matches!(&d.code, Some(_)),
|
||||
"deno-lint" => d.code.is_some(),
|
||||
"deno" => diagnostics::DenoDiagnostic::is_fixable(d),
|
||||
_ => false,
|
||||
},
|
||||
|
|
|
@ -308,10 +308,9 @@ fn napi_coerce_to_number(
|
|||
check_env!(env);
|
||||
let env = unsafe { &mut *env };
|
||||
let value = napi_value_unchecked(value);
|
||||
let Some(coerced) = value
|
||||
.to_number(&mut env.scope()) else {
|
||||
return napi_number_expected;
|
||||
};
|
||||
let Some(coerced) = value.to_number(&mut env.scope()) else {
|
||||
return napi_number_expected;
|
||||
};
|
||||
let value: v8::Local<v8::Value> = coerced.into();
|
||||
*result = value.into();
|
||||
napi_ok
|
||||
|
@ -1352,10 +1351,9 @@ fn napi_call_function(
|
|||
|
||||
#[napi_sym::napi_sym]
|
||||
fn napi_close_escapable_handle_scope(
|
||||
env: *mut Env,
|
||||
_env: *mut Env,
|
||||
_scope: napi_escapable_handle_scope,
|
||||
) -> napi_status {
|
||||
let mut _env = &mut *(env as *mut Env);
|
||||
// TODO: do this properly
|
||||
napi_ok
|
||||
}
|
||||
|
@ -1365,7 +1363,7 @@ fn napi_close_handle_scope(
|
|||
env: *mut Env,
|
||||
scope: napi_handle_scope,
|
||||
) -> napi_status {
|
||||
let env = &mut *(env as *mut Env);
|
||||
let env = &mut *env;
|
||||
if env.open_handle_scopes == 0 {
|
||||
return napi_handle_scope_mismatch;
|
||||
}
|
||||
|
@ -1497,7 +1495,7 @@ fn napi_define_class(
|
|||
env_ptr,
|
||||
*result,
|
||||
static_descriptors.len(),
|
||||
static_descriptors.as_ptr() as *const napi_property_descriptor,
|
||||
static_descriptors.as_ptr(),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -1519,7 +1517,8 @@ fn napi_define_properties(
|
|||
|
||||
let scope = &mut env.scope();
|
||||
|
||||
let Ok(object) = v8::Local::<v8::Object>::try_from(napi_value_unchecked(obj)) else {
|
||||
let Ok(object) = v8::Local::<v8::Object>::try_from(napi_value_unchecked(obj))
|
||||
else {
|
||||
return napi_object_expected;
|
||||
};
|
||||
|
||||
|
@ -1614,11 +1613,9 @@ fn napi_delete_property(
|
|||
check_arg!(env, result);
|
||||
|
||||
let scope = &mut env.scope();
|
||||
let Some(object) = object
|
||||
.map(|o| o.to_object(scope))
|
||||
.flatten() else {
|
||||
return napi_invalid_arg;
|
||||
};
|
||||
let Some(object) = object.map(|o| o.to_object(scope)).flatten() else {
|
||||
return napi_invalid_arg;
|
||||
};
|
||||
|
||||
let Some(deleted) = object.delete(scope, key.unwrap_unchecked()) else {
|
||||
return napi_generic_failure;
|
||||
|
@ -1630,8 +1627,7 @@ fn napi_delete_property(
|
|||
|
||||
// TODO: properly implement ref counting stuff
|
||||
#[napi_sym::napi_sym]
|
||||
fn napi_delete_reference(env: *mut Env, _nref: napi_ref) -> napi_status {
|
||||
let mut _env = &mut *(env as *mut Env);
|
||||
fn napi_delete_reference(_env: *mut Env, _nref: napi_ref) -> napi_status {
|
||||
napi_ok
|
||||
}
|
||||
|
||||
|
@ -1869,7 +1865,7 @@ fn napi_get_instance_data(
|
|||
env: *mut Env,
|
||||
result: *mut *mut c_void,
|
||||
) -> napi_status {
|
||||
let env = &mut *(env as *mut Env);
|
||||
let env = &mut *env;
|
||||
let shared = env.shared();
|
||||
*result = shared.instance_data;
|
||||
napi_ok
|
||||
|
@ -2118,11 +2114,9 @@ fn napi_has_own_property(
|
|||
check_arg!(env, result);
|
||||
|
||||
let scope = &mut env.scope();
|
||||
let Some(object) = object
|
||||
.map(|o| o.to_object(scope))
|
||||
.flatten() else {
|
||||
return napi_invalid_arg;
|
||||
};
|
||||
let Some(object) = object.map(|o| o.to_object(scope)).flatten() else {
|
||||
return napi_invalid_arg;
|
||||
};
|
||||
|
||||
if key.is_none() {
|
||||
return napi_invalid_arg;
|
||||
|
@ -2131,7 +2125,7 @@ fn napi_has_own_property(
|
|||
return napi_name_expected;
|
||||
};
|
||||
|
||||
let Some(has_own) = object.has_own_property(scope, key) else {
|
||||
let Some(has_own) = object.has_own_property(scope, key) else {
|
||||
return napi_generic_failure;
|
||||
};
|
||||
|
||||
|
@ -2153,11 +2147,9 @@ fn napi_has_property(
|
|||
check_arg!(env, result);
|
||||
|
||||
let scope = &mut env.scope();
|
||||
let Some(object) = object
|
||||
.map(|o| o.to_object(scope))
|
||||
.flatten() else {
|
||||
return napi_invalid_arg;
|
||||
};
|
||||
let Some(object) = object.map(|o| o.to_object(scope)).flatten() else {
|
||||
return napi_invalid_arg;
|
||||
};
|
||||
|
||||
let Some(has) = object.has(scope, key.unwrap_unchecked()) else {
|
||||
return napi_generic_failure;
|
||||
|
@ -2180,10 +2172,9 @@ fn napi_instanceof(
|
|||
|
||||
let value = napi_value_unchecked(value);
|
||||
let constructor = napi_value_unchecked(constructor);
|
||||
let Some(ctor) = constructor
|
||||
.to_object(&mut env.scope()) else {
|
||||
return napi_object_expected;
|
||||
};
|
||||
let Some(ctor) = constructor.to_object(&mut env.scope()) else {
|
||||
return napi_object_expected;
|
||||
};
|
||||
if !ctor.is_function() {
|
||||
return napi_function_expected;
|
||||
}
|
||||
|
@ -2294,8 +2285,7 @@ fn napi_is_error(
|
|||
}
|
||||
|
||||
#[napi_sym::napi_sym]
|
||||
fn napi_is_exception_pending(env: *mut Env, result: *mut bool) -> napi_status {
|
||||
let mut _env = &mut *(env as *mut Env);
|
||||
fn napi_is_exception_pending(_env: *mut Env, result: *mut bool) -> napi_status {
|
||||
// TODO
|
||||
*result = false;
|
||||
napi_ok
|
||||
|
@ -2389,7 +2379,7 @@ fn napi_open_handle_scope(
|
|||
env: *mut Env,
|
||||
_result: *mut napi_handle_scope,
|
||||
) -> napi_status {
|
||||
let env = &mut *(env as *mut Env);
|
||||
let env = &mut *env;
|
||||
|
||||
// *result = &mut env.scope() as *mut _ as napi_handle_scope;
|
||||
env.open_handle_scopes += 1;
|
||||
|
@ -2525,7 +2515,7 @@ fn napi_set_instance_data(
|
|||
finalize_cb: Option<napi_finalize>,
|
||||
finalize_hint: *mut c_void,
|
||||
) -> napi_status {
|
||||
let env = &mut *(env as *mut Env);
|
||||
let env = &mut *env;
|
||||
let shared = env.shared_mut();
|
||||
shared.instance_data = data;
|
||||
shared.data_finalize = if finalize_cb.is_some() {
|
||||
|
@ -2567,11 +2557,9 @@ fn napi_set_property(
|
|||
check_arg_option!(env, value);
|
||||
|
||||
let scope = &mut env.scope();
|
||||
let Some(object) = object
|
||||
.map(|o| o.to_object(scope))
|
||||
.flatten() else {
|
||||
return napi_invalid_arg
|
||||
};
|
||||
let Some(object) = object.map(|o| o.to_object(scope)).flatten() else {
|
||||
return napi_invalid_arg;
|
||||
};
|
||||
|
||||
if object
|
||||
.set(scope, key.unwrap_unchecked(), value.unwrap_unchecked())
|
||||
|
@ -2759,10 +2747,9 @@ fn napi_unwrap(
|
|||
let shared = &*(env.shared as *const EnvShared);
|
||||
let napi_wrap = v8::Local::new(&mut env.scope(), &shared.napi_wrap);
|
||||
let ext = obj.get_private(&mut env.scope(), napi_wrap).unwrap();
|
||||
let Some(ext) = v8::Local::<v8::External>::try_from(ext)
|
||||
.ok() else {
|
||||
return napi_invalid_arg;
|
||||
};
|
||||
let Some(ext) = v8::Local::<v8::External>::try_from(ext).ok() else {
|
||||
return napi_invalid_arg;
|
||||
};
|
||||
*result = ext.value();
|
||||
napi_ok
|
||||
}
|
||||
|
|
|
@ -100,9 +100,10 @@ impl NpmPackageFsResolver for GlobalNpmPackageResolver {
|
|||
) -> Result<PathBuf, AnyError> {
|
||||
let Some(referrer_pkg_id) = self
|
||||
.cache
|
||||
.resolve_package_folder_id_from_specifier(referrer, &self.registry_url) else {
|
||||
bail!("could not find npm package for '{}'", referrer);
|
||||
};
|
||||
.resolve_package_folder_id_from_specifier(referrer, &self.registry_url)
|
||||
else {
|
||||
bail!("could not find npm package for '{}'", referrer);
|
||||
};
|
||||
let pkg = if mode.is_types() && !name.starts_with("@types/") {
|
||||
// attempt to resolve the types package first, then fallback to the regular package
|
||||
match self.resolve_types_package(name, &referrer_pkg_id) {
|
||||
|
@ -123,10 +124,10 @@ impl NpmPackageFsResolver for GlobalNpmPackageResolver {
|
|||
&self,
|
||||
specifier: &ModuleSpecifier,
|
||||
) -> Result<Option<PathBuf>, AnyError> {
|
||||
let Some(pkg_folder_id) = self.cache.resolve_package_folder_id_from_specifier(
|
||||
specifier,
|
||||
&self.registry_url,
|
||||
) else {
|
||||
let Some(pkg_folder_id) = self
|
||||
.cache
|
||||
.resolve_package_folder_id_from_specifier(specifier, &self.registry_url)
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
Ok(Some(
|
||||
|
|
|
@ -110,7 +110,9 @@ impl LocalNpmPackageResolver {
|
|||
&self,
|
||||
specifier: &ModuleSpecifier,
|
||||
) -> Result<Option<PathBuf>, AnyError> {
|
||||
let Some(relative_url) = self.root_node_modules_url.make_relative(specifier) else {
|
||||
let Some(relative_url) =
|
||||
self.root_node_modules_url.make_relative(specifier)
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
if relative_url.starts_with("../") {
|
||||
|
@ -230,7 +232,9 @@ impl NpmPackageFsResolver for LocalNpmPackageResolver {
|
|||
&self,
|
||||
specifier: &ModuleSpecifier,
|
||||
) -> Result<Option<NpmPackageCacheFolderId>, AnyError> {
|
||||
let Some(folder_path) = self.resolve_package_folder_from_specifier(specifier)? else {
|
||||
let Some(folder_path) =
|
||||
self.resolve_package_folder_from_specifier(specifier)?
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
let folder_name = folder_path.parent().unwrap().to_string_lossy();
|
||||
|
|
|
@ -135,9 +135,10 @@ impl CliNpmResolver {
|
|||
) -> Result<Option<PathBuf>, AnyError> {
|
||||
let Some(path) = self
|
||||
.fs_resolver
|
||||
.resolve_package_folder_from_specifier(specifier)? else {
|
||||
return Ok(None);
|
||||
};
|
||||
.resolve_package_folder_from_specifier(specifier)?
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
log::debug!(
|
||||
"Resolved package folder of {} to {}",
|
||||
specifier,
|
||||
|
@ -153,9 +154,10 @@ impl CliNpmResolver {
|
|||
) -> Result<Option<NpmPackageId>, AnyError> {
|
||||
let Some(cache_folder_id) = self
|
||||
.fs_resolver
|
||||
.resolve_package_cache_folder_id_from_specifier(specifier)? else {
|
||||
return Ok(None);
|
||||
};
|
||||
.resolve_package_cache_folder_id_from_specifier(specifier)?
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
Ok(Some(
|
||||
self
|
||||
.resolution
|
||||
|
|
|
@ -183,10 +183,12 @@ impl ModuleLoader for EmbeddedModuleLoader {
|
|||
};
|
||||
}
|
||||
|
||||
let Some(module) = self.shared.eszip.get_module(original_specifier.as_str()) else {
|
||||
let Some(module) =
|
||||
self.shared.eszip.get_module(original_specifier.as_str())
|
||||
else {
|
||||
return Box::pin(deno_core::futures::future::ready(Err(type_error(
|
||||
format!("Module not found: {}", original_specifier),
|
||||
))))
|
||||
))));
|
||||
};
|
||||
let original_specifier = original_specifier.clone();
|
||||
let found_specifier =
|
||||
|
|
|
@ -266,15 +266,15 @@ fn fmt_with_glob_config() {
|
|||
|
||||
let output = cmd_output.combined_output();
|
||||
if cfg!(windows) {
|
||||
assert_contains!(output, r#"glob\nested\fizz\fizz.ts"#);
|
||||
assert_contains!(output, r#"glob\pages\[id].ts"#);
|
||||
assert_contains!(output, r#"glob\nested\fizz\bar.ts"#);
|
||||
assert_contains!(output, r#"glob\nested\foo\foo.ts"#);
|
||||
assert_contains!(output, r#"glob\data\test1.js"#);
|
||||
assert_contains!(output, r#"glob\nested\foo\bar.ts"#);
|
||||
assert_contains!(output, r#"glob\nested\foo\fizz.ts"#);
|
||||
assert_contains!(output, r#"glob\nested\fizz\foo.ts"#);
|
||||
assert_contains!(output, r#"glob\data\test1.ts"#);
|
||||
assert_contains!(output, r"glob\nested\fizz\fizz.ts");
|
||||
assert_contains!(output, r"glob\pages\[id].ts");
|
||||
assert_contains!(output, r"glob\nested\fizz\bar.ts");
|
||||
assert_contains!(output, r"glob\nested\foo\foo.ts");
|
||||
assert_contains!(output, r"glob\data\test1.js");
|
||||
assert_contains!(output, r"glob\nested\foo\bar.ts");
|
||||
assert_contains!(output, r"glob\nested\foo\fizz.ts");
|
||||
assert_contains!(output, r"glob\nested\fizz\foo.ts");
|
||||
assert_contains!(output, r"glob\data\test1.ts");
|
||||
} else {
|
||||
assert_contains!(output, "glob/nested/fizz/fizz.ts");
|
||||
assert_contains!(output, "glob/pages/[id].ts");
|
||||
|
@ -303,15 +303,15 @@ fn fmt_with_glob_config_and_flags() {
|
|||
|
||||
let output = cmd_output.combined_output();
|
||||
if cfg!(windows) {
|
||||
assert_contains!(output, r#"glob\nested\fizz\fizz.ts"#);
|
||||
assert_contains!(output, r#"glob\pages\[id].ts"#);
|
||||
assert_contains!(output, r#"glob\nested\fizz\bazz.ts"#);
|
||||
assert_contains!(output, r#"glob\nested\foo\foo.ts"#);
|
||||
assert_contains!(output, r#"glob\data\test1.js"#);
|
||||
assert_contains!(output, r#"glob\nested\foo\bazz.ts"#);
|
||||
assert_contains!(output, r#"glob\nested\foo\fizz.ts"#);
|
||||
assert_contains!(output, r#"glob\nested\fizz\foo.ts"#);
|
||||
assert_contains!(output, r#"glob\data\test1.ts"#);
|
||||
assert_contains!(output, r"glob\nested\fizz\fizz.ts");
|
||||
assert_contains!(output, r"glob\pages\[id].ts");
|
||||
assert_contains!(output, r"glob\nested\fizz\bazz.ts");
|
||||
assert_contains!(output, r"glob\nested\foo\foo.ts");
|
||||
assert_contains!(output, r"glob\data\test1.js");
|
||||
assert_contains!(output, r"glob\nested\foo\bazz.ts");
|
||||
assert_contains!(output, r"glob\nested\foo\fizz.ts");
|
||||
assert_contains!(output, r"glob\nested\fizz\foo.ts");
|
||||
assert_contains!(output, r"glob\data\test1.ts");
|
||||
} else {
|
||||
assert_contains!(output, "glob/nested/fizz/fizz.ts");
|
||||
assert_contains!(output, "glob/pages/[id].ts");
|
||||
|
@ -333,8 +333,8 @@ fn fmt_with_glob_config_and_flags() {
|
|||
|
||||
let output = cmd_output.combined_output();
|
||||
if cfg!(windows) {
|
||||
assert_contains!(output, r#"glob\data\test1.js"#);
|
||||
assert_contains!(output, r#"glob\data\test1.ts"#);
|
||||
assert_contains!(output, r"glob\data\test1.js");
|
||||
assert_contains!(output, r"glob\data\test1.ts");
|
||||
} else {
|
||||
assert_contains!(output, "glob/data/test1.js");
|
||||
assert_contains!(output, "glob/data/test1.ts");
|
||||
|
|
|
@ -131,15 +131,15 @@ fn lint_with_glob_config() {
|
|||
|
||||
let output = cmd_output.combined_output();
|
||||
if cfg!(windows) {
|
||||
assert_contains!(output, r#"glob\nested\fizz\fizz.ts:1:10"#);
|
||||
assert_contains!(output, r#"glob\pages\[id].ts:1:10"#);
|
||||
assert_contains!(output, r#"glob\nested\fizz\bar.ts:1:10"#);
|
||||
assert_contains!(output, r#"glob\nested\foo\foo.ts:1:10"#);
|
||||
assert_contains!(output, r#"glob\data\test1.js:1:10"#);
|
||||
assert_contains!(output, r#"glob\nested\foo\bar.ts:1:10"#);
|
||||
assert_contains!(output, r#"glob\nested\foo\fizz.ts:1:10"#);
|
||||
assert_contains!(output, r#"glob\nested\fizz\foo.ts:1:10"#);
|
||||
assert_contains!(output, r#"glob\data\test1.ts:1:10"#);
|
||||
assert_contains!(output, r"glob\nested\fizz\fizz.ts:1:10");
|
||||
assert_contains!(output, r"glob\pages\[id].ts:1:10");
|
||||
assert_contains!(output, r"glob\nested\fizz\bar.ts:1:10");
|
||||
assert_contains!(output, r"glob\nested\foo\foo.ts:1:10");
|
||||
assert_contains!(output, r"glob\data\test1.js:1:10");
|
||||
assert_contains!(output, r"glob\nested\foo\bar.ts:1:10");
|
||||
assert_contains!(output, r"glob\nested\foo\fizz.ts:1:10");
|
||||
assert_contains!(output, r"glob\nested\fizz\foo.ts:1:10");
|
||||
assert_contains!(output, r"glob\data\test1.ts:1:10");
|
||||
} else {
|
||||
assert_contains!(output, "glob/nested/fizz/fizz.ts:1:10");
|
||||
assert_contains!(output, "glob/pages/[id].ts:1:10");
|
||||
|
@ -168,15 +168,15 @@ fn lint_with_glob_config_and_flags() {
|
|||
|
||||
let output = cmd_output.combined_output();
|
||||
if cfg!(windows) {
|
||||
assert_contains!(output, r#"glob\nested\fizz\fizz.ts:1:10"#);
|
||||
assert_contains!(output, r#"glob\pages\[id].ts:1:10"#);
|
||||
assert_contains!(output, r#"glob\nested\fizz\bazz.ts:1:10"#);
|
||||
assert_contains!(output, r#"glob\nested\foo\foo.ts:1:10"#);
|
||||
assert_contains!(output, r#"glob\data\test1.js:1:10"#);
|
||||
assert_contains!(output, r#"glob\nested\foo\bazz.ts:1:10"#);
|
||||
assert_contains!(output, r#"glob\nested\foo\fizz.ts:1:10"#);
|
||||
assert_contains!(output, r#"glob\nested\fizz\foo.ts:1:10"#);
|
||||
assert_contains!(output, r#"glob\data\test1.ts:1:10"#);
|
||||
assert_contains!(output, r"glob\nested\fizz\fizz.ts:1:10");
|
||||
assert_contains!(output, r"glob\pages\[id].ts:1:10");
|
||||
assert_contains!(output, r"glob\nested\fizz\bazz.ts:1:10");
|
||||
assert_contains!(output, r"glob\nested\foo\foo.ts:1:10");
|
||||
assert_contains!(output, r"glob\data\test1.js:1:10");
|
||||
assert_contains!(output, r"glob\nested\foo\bazz.ts:1:10");
|
||||
assert_contains!(output, r"glob\nested\foo\fizz.ts:1:10");
|
||||
assert_contains!(output, r"glob\nested\fizz\foo.ts:1:10");
|
||||
assert_contains!(output, r"glob\data\test1.ts:1:10");
|
||||
} else {
|
||||
assert_contains!(output, "glob/nested/fizz/fizz.ts:1:10");
|
||||
assert_contains!(output, "glob/pages/[id].ts:1:10");
|
||||
|
@ -200,8 +200,8 @@ fn lint_with_glob_config_and_flags() {
|
|||
|
||||
let output = cmd_output.combined_output();
|
||||
if cfg!(windows) {
|
||||
assert_contains!(output, r#"glob\data\test1.js:1:10"#);
|
||||
assert_contains!(output, r#"glob\data\test1.ts:1:10"#);
|
||||
assert_contains!(output, r"glob\data\test1.js:1:10");
|
||||
assert_contains!(output, r"glob\data\test1.ts:1:10");
|
||||
} else {
|
||||
assert_contains!(output, "glob/data/test1.js:1:10");
|
||||
assert_contains!(output, "glob/data/test1.ts:1:10");
|
||||
|
|
|
@ -3685,7 +3685,7 @@ fn lsp_find_references() {
|
|||
"uri": "file:///a/mod.ts",
|
||||
"languageId": "typescript",
|
||||
"version": 1,
|
||||
"text": r#"export const a = 1;\nconst b = 2;"#
|
||||
"text": r"export const a = 1;\nconst b = 2;"
|
||||
}
|
||||
}));
|
||||
client.did_open(json!({
|
||||
|
|
|
@ -242,7 +242,7 @@ fn pty_internal_repl() {
|
|||
fn pty_emoji() {
|
||||
// windows was having issues displaying this
|
||||
util::with_pty(&["repl"], |mut console| {
|
||||
console.write_line(r#"console.log('\u{1F995}');"#);
|
||||
console.write_line(r"console.log('\u{1F995}');");
|
||||
console.expect("🦕");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ impl<'a> Iterator for StartEventQueue<'a> {
|
|||
let mut result = self.queue.next().unwrap();
|
||||
if pending_offset == queue_offset {
|
||||
let pending_trees = self.pending.take().unwrap().trees;
|
||||
result.trees.extend(pending_trees.into_iter())
|
||||
result.trees.extend(pending_trees)
|
||||
}
|
||||
Some(result)
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ fn merge_range_tree_children<'a>(
|
|||
|
||||
let child_forests: Vec<Vec<&'a mut RangeTree<'a>>> = flat_children
|
||||
.into_iter()
|
||||
.zip(wrapped_children.into_iter())
|
||||
.zip(wrapped_children)
|
||||
.map(|(flat, wrapped)| merge_children_lists(flat, wrapped))
|
||||
.collect();
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ pub fn construct_v8_flags(
|
|||
) -> Vec<String> {
|
||||
std::iter::once("UNUSED_BUT_NECESSARY_ARG0".to_owned())
|
||||
.chain(default_v8_flags.iter().cloned())
|
||||
.chain(env_v8_flags.into_iter())
|
||||
.chain(env_v8_flags)
|
||||
.chain(v8_flags.iter().cloned())
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
|
|
@ -507,11 +507,13 @@ impl CliMainWorkerFactory {
|
|||
return Ok(None);
|
||||
}
|
||||
|
||||
let Some(resolution) = self.shared.node_resolver.resolve_npm_req_reference(
|
||||
package_ref,
|
||||
NodeResolutionMode::Execution,
|
||||
permissions,
|
||||
)? else {
|
||||
let Some(resolution) =
|
||||
self.shared.node_resolver.resolve_npm_req_reference(
|
||||
package_ref,
|
||||
NodeResolutionMode::Execution,
|
||||
permissions,
|
||||
)?
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
match &resolution {
|
||||
|
|
|
@ -377,7 +377,7 @@ pub(crate) fn format_error(e: dlopen::Error, path: String) -> String {
|
|||
|
||||
let path = OsStr::new(&path)
|
||||
.encode_wide()
|
||||
.chain(Some(0).into_iter())
|
||||
.chain(Some(0))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let arguments = [path.as_ptr()];
|
||||
|
|
|
@ -10,7 +10,6 @@ use deno_core::op;
|
|||
use deno_core::serde_v8;
|
||||
use deno_core::v8;
|
||||
use deno_core::ResourceId;
|
||||
use std::ffi::c_void;
|
||||
use std::ptr;
|
||||
|
||||
#[op(v8)]
|
||||
|
@ -147,7 +146,7 @@ pub fn op_ffi_get_static<'scope>(
|
|||
}
|
||||
NativeType::Pointer | NativeType::Function | NativeType::Buffer => {
|
||||
let external: v8::Local<v8::Value> =
|
||||
v8::External::new(scope, data_ptr as *mut c_void).into();
|
||||
v8::External::new(scope, data_ptr).into();
|
||||
external.into()
|
||||
}
|
||||
NativeType::Struct(_) => {
|
||||
|
|
|
@ -962,14 +962,14 @@ where
|
|||
#[smi]
|
||||
pub fn op_http_try_wait(state: &mut OpState, #[smi] rid: ResourceId) -> SlabId {
|
||||
// The resource needs to exist.
|
||||
let Ok(join_handle) = state
|
||||
.resource_table
|
||||
.get::<HttpJoinHandle>(rid) else {
|
||||
return SlabId::MAX;
|
||||
let Ok(join_handle) = state.resource_table.get::<HttpJoinHandle>(rid) else {
|
||||
return SlabId::MAX;
|
||||
};
|
||||
|
||||
// If join handle is somehow locked, just abort.
|
||||
let Some(mut handle) = RcRef::map(&join_handle, |this| &this.2).try_borrow_mut() else {
|
||||
let Some(mut handle) =
|
||||
RcRef::map(&join_handle, |this| &this.2).try_borrow_mut()
|
||||
else {
|
||||
return SlabId::MAX;
|
||||
};
|
||||
|
||||
|
|
|
@ -290,7 +290,9 @@ impl Body for ResponseBytes {
|
|||
unreachable!()
|
||||
}
|
||||
ResponseBytesInner::Bytes(..) => {
|
||||
let ResponseBytesInner::Bytes(data) = self.complete(true) else { unreachable!(); };
|
||||
let ResponseBytesInner::Bytes(data) = self.complete(true) else {
|
||||
unreachable!();
|
||||
};
|
||||
return std::task::Poll::Ready(Some(Ok(Frame::data(data))));
|
||||
}
|
||||
ResponseBytesInner::UncompressedStream(stm) => {
|
||||
|
|
|
@ -494,9 +494,15 @@ async fn call_remote<
|
|||
// `unwrap()` never fails because `tx` is owned by the task held by `refresher`.
|
||||
metadata_rx.changed().await.unwrap();
|
||||
};
|
||||
let Some(sc_endpoint) = metadata.endpoints.iter().find(|x| x.consistency == "strong") else {
|
||||
return Err(type_error("No strong consistency endpoint is available for this database"));
|
||||
};
|
||||
let Some(sc_endpoint) = metadata
|
||||
.endpoints
|
||||
.iter()
|
||||
.find(|x| x.consistency == "strong")
|
||||
else {
|
||||
return Err(type_error(
|
||||
"No strong consistency endpoint is available for this database",
|
||||
));
|
||||
};
|
||||
|
||||
let full_url = format!("{}/{}", sc_endpoint.url, method);
|
||||
{
|
||||
|
|
|
@ -355,7 +355,7 @@ impl SqliteDb {
|
|||
spawn_blocking(move || {
|
||||
let mut db = db.try_lock().ok();
|
||||
let Some(db) = db.as_mut().and_then(|x| x.as_mut()) else {
|
||||
return Err(type_error(ERROR_USING_CLOSED_DATABASE))
|
||||
return Err(type_error(ERROR_USING_CLOSED_DATABASE));
|
||||
};
|
||||
let result = match db.transaction() {
|
||||
Ok(tx) => f(tx),
|
||||
|
@ -626,16 +626,17 @@ impl SqliteQueue {
|
|||
tx: &rusqlite::Transaction<'_>,
|
||||
) -> Result<bool, AnyError> {
|
||||
let Some((_, id, data, backoff_schedule, keys_if_undelivered)) = tx
|
||||
.prepare_cached(STATEMENT_QUEUE_GET_RUNNING_BY_ID)?
|
||||
.query_row([id], |row| {
|
||||
let deadline: u64 = row.get(0)?;
|
||||
let id: String = row.get(1)?;
|
||||
let data: Vec<u8> = row.get(2)?;
|
||||
let backoff_schedule: String = row.get(3)?;
|
||||
let keys_if_undelivered: String = row.get(4)?;
|
||||
Ok((deadline, id, data, backoff_schedule, keys_if_undelivered))
|
||||
})
|
||||
.optional()? else {
|
||||
.prepare_cached(STATEMENT_QUEUE_GET_RUNNING_BY_ID)?
|
||||
.query_row([id], |row| {
|
||||
let deadline: u64 = row.get(0)?;
|
||||
let id: String = row.get(1)?;
|
||||
let data: Vec<u8> = row.get(2)?;
|
||||
let backoff_schedule: String = row.get(3)?;
|
||||
let keys_if_undelivered: String = row.get(4)?;
|
||||
Ok((deadline, id, data, backoff_schedule, keys_if_undelivered))
|
||||
})
|
||||
.optional()?
|
||||
else {
|
||||
return Ok(false);
|
||||
};
|
||||
|
||||
|
@ -926,7 +927,9 @@ fn mutate_le64(
|
|||
mutate: impl FnOnce(u64, u64) -> u64,
|
||||
) -> Result<(), AnyError> {
|
||||
let Value::U64(operand) = *operand else {
|
||||
return Err(type_error(format!("Failed to perform '{op_name}' mutation on a non-U64 operand")));
|
||||
return Err(type_error(format!(
|
||||
"Failed to perform '{op_name}' mutation on a non-U64 operand"
|
||||
)));
|
||||
};
|
||||
|
||||
let old_value = tx
|
||||
|
|
|
@ -264,7 +264,9 @@ fn is_managed_key(
|
|||
}
|
||||
|
||||
fn current_mode(scope: &mut v8::HandleScope) -> Mode {
|
||||
let Some(v8_string) = v8::StackTrace::current_script_name_or_source_url(scope) else {
|
||||
let Some(v8_string) =
|
||||
v8::StackTrace::current_script_name_or_source_url(scope)
|
||||
else {
|
||||
return Mode::Deno;
|
||||
};
|
||||
let op_state = deno_core::JsRuntime::op_state_from(scope);
|
||||
|
@ -375,7 +377,8 @@ pub fn query<'s>(
|
|||
return;
|
||||
};
|
||||
|
||||
let Some(attributes) = inner.get_property_attributes(scope, key.into()) else {
|
||||
let Some(attributes) = inner.get_property_attributes(scope, key.into())
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -429,7 +432,9 @@ pub fn enumerator<'s>(
|
|||
};
|
||||
let inner = v8::Local::new(scope, inner);
|
||||
|
||||
let Some(array) = inner.get_property_names(scope, GetPropertyNamesArgs::default()) else {
|
||||
let Some(array) =
|
||||
inner.get_property_names(scope, GetPropertyNamesArgs::default())
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
|
|
|
@ -230,31 +230,27 @@ fn x509name_to_string(
|
|||
) -> Result<String, x509_parser::error::X509Error> {
|
||||
// Lifted from https://github.com/rusticata/x509-parser/blob/4d618c2ed6b1fc102df16797545895f7c67ee0fe/src/x509.rs#L543-L566
|
||||
// since it's a private function (Copyright 2017 Pierre Chifflier)
|
||||
name.iter_rdn().fold(Ok(String::new()), |acc, rdn| {
|
||||
acc.and_then(|mut _vec| {
|
||||
rdn
|
||||
.iter()
|
||||
.fold(Ok(String::new()), |acc2, attr| {
|
||||
acc2.and_then(|mut _vec2| {
|
||||
let val_str =
|
||||
attribute_value_to_string(attr.attr_value(), attr.attr_type())?;
|
||||
// look ABBREV, and if not found, use shortname
|
||||
let abbrev = match oid2abbrev(attr.attr_type(), oid_registry) {
|
||||
Ok(s) => String::from(s),
|
||||
_ => format!("{:?}", attr.attr_type()),
|
||||
};
|
||||
let rdn = format!("{}={}", abbrev, val_str);
|
||||
match _vec2.len() {
|
||||
0 => Ok(rdn),
|
||||
_ => Ok(_vec2 + " + " + rdn.as_str()),
|
||||
}
|
||||
})
|
||||
})
|
||||
.map(|v| match _vec.len() {
|
||||
0 => v,
|
||||
_ => _vec + "\n" + v.as_str(),
|
||||
})
|
||||
})
|
||||
name.iter_rdn().try_fold(String::new(), |acc, rdn| {
|
||||
rdn
|
||||
.iter()
|
||||
.try_fold(String::new(), |acc2, attr| {
|
||||
let val_str =
|
||||
attribute_value_to_string(attr.attr_value(), attr.attr_type())?;
|
||||
// look ABBREV, and if not found, use shortname
|
||||
let abbrev = match oid2abbrev(attr.attr_type(), oid_registry) {
|
||||
Ok(s) => String::from(s),
|
||||
_ => format!("{:?}", attr.attr_type()),
|
||||
};
|
||||
let rdn = format!("{}={}", abbrev, val_str);
|
||||
match acc2.len() {
|
||||
0 => Ok(rdn),
|
||||
_ => Ok(acc2 + " + " + rdn.as_str()),
|
||||
}
|
||||
})
|
||||
.map(|v| match acc.len() {
|
||||
0 => v,
|
||||
_ => acc + "\n" + v.as_str(),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -1053,9 +1053,10 @@ impl NodeResolver {
|
|||
|
||||
// ResolveSelf
|
||||
let Some(package_config) =
|
||||
self.get_package_scope_config(referrer, permissions)? else {
|
||||
return Ok(None);
|
||||
};
|
||||
self.get_package_scope_config(referrer, permissions)?
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
if package_config.exists
|
||||
&& package_config.name.as_ref() == Some(&package_name)
|
||||
{
|
||||
|
@ -1132,9 +1133,10 @@ impl NodeResolver {
|
|||
) -> Result<Option<PackageJson>, AnyError> {
|
||||
let Some(root_folder) = self
|
||||
.npm_resolver
|
||||
.resolve_package_folder_from_path(&referrer.to_file_path().unwrap())? else {
|
||||
return Ok(None);
|
||||
};
|
||||
.resolve_package_folder_from_path(&referrer.to_file_path().unwrap())?
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
let package_json_path = root_folder.join("package.json");
|
||||
self
|
||||
.load_package_json(permissions, package_json_path)
|
||||
|
@ -1146,7 +1148,8 @@ impl NodeResolver {
|
|||
url: &ModuleSpecifier,
|
||||
permissions: &dyn NodePermissions,
|
||||
) -> Result<Option<PackageJson>, AnyError> {
|
||||
let Some(package_json_path) = self.get_closest_package_json_path(url)? else {
|
||||
let Some(package_json_path) = self.get_closest_package_json_path(url)?
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
self
|
||||
|
@ -1169,9 +1172,10 @@ impl NodeResolver {
|
|||
}
|
||||
let Some(root_pkg_folder) = self
|
||||
.npm_resolver
|
||||
.resolve_package_folder_from_path(current_dir)? else {
|
||||
return Ok(None);
|
||||
};
|
||||
.resolve_package_folder_from_path(current_dir)?
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
while current_dir.starts_with(&root_pkg_folder) {
|
||||
current_dir = current_dir.parent().unwrap();
|
||||
let package_json_path = current_dir.join("package.json");
|
||||
|
|
|
@ -183,7 +183,8 @@ pub fn op_readable_stream_resource_get_sink(
|
|||
state: &mut OpState,
|
||||
#[smi] rid: ResourceId,
|
||||
) -> *const c_void {
|
||||
let Ok(resource) = state.resource_table.get::<ReadableStreamResource>(rid) else {
|
||||
let Ok(resource) = state.resource_table.get::<ReadableStreamResource>(rid)
|
||||
else {
|
||||
return std::ptr::null();
|
||||
};
|
||||
resource.data.tx as _
|
||||
|
|
|
@ -581,7 +581,8 @@ pub async fn op_ws_next_event(
|
|||
let Ok(resource) = state
|
||||
.borrow_mut()
|
||||
.resource_table
|
||||
.get::<ServerWebSocket>(rid) else {
|
||||
.get::<ServerWebSocket>(rid)
|
||||
else {
|
||||
// op_ws_get_error will correctly handle a bad resource
|
||||
return MessageKind::Error as u16;
|
||||
};
|
||||
|
|
|
@ -579,7 +579,7 @@ mod deprecated {
|
|||
#[cfg(unix)]
|
||||
let signal = run_status.signal();
|
||||
#[cfg(not(unix))]
|
||||
let signal = None;
|
||||
let signal = Default::default();
|
||||
|
||||
code
|
||||
.or(signal)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[toolchain]
|
||||
channel = "1.71.0"
|
||||
channel = "1.72.0"
|
||||
components = ["rustfmt", "clippy"]
|
||||
|
|
|
@ -1228,11 +1228,14 @@ async fn main_server(
|
|||
let body = hyper::body::to_bytes(req.into_body())
|
||||
.await
|
||||
.unwrap_or_default();
|
||||
let Ok(body): Result<SnapshotRead, _> = prost::Message::decode(&body[..]) else {
|
||||
return Ok(Response::builder()
|
||||
.status(StatusCode::BAD_REQUEST)
|
||||
.body(Body::empty())
|
||||
.unwrap());
|
||||
let Ok(body): Result<SnapshotRead, _> = prost::Message::decode(&body[..])
|
||||
else {
|
||||
return Ok(
|
||||
Response::builder()
|
||||
.status(StatusCode::BAD_REQUEST)
|
||||
.body(Body::empty())
|
||||
.unwrap(),
|
||||
);
|
||||
};
|
||||
if body.ranges.is_empty() {
|
||||
return Ok(
|
||||
|
@ -1280,11 +1283,14 @@ async fn main_server(
|
|||
let body = hyper::body::to_bytes(req.into_body())
|
||||
.await
|
||||
.unwrap_or_default();
|
||||
let Ok(_body): Result<AtomicWrite, _> = prost::Message::decode(&body[..]) else {
|
||||
return Ok(Response::builder()
|
||||
.status(StatusCode::BAD_REQUEST)
|
||||
.body(Body::empty())
|
||||
.unwrap());
|
||||
let Ok(_body): Result<AtomicWrite, _> = prost::Message::decode(&body[..])
|
||||
else {
|
||||
return Ok(
|
||||
Response::builder()
|
||||
.status(StatusCode::BAD_REQUEST)
|
||||
.body(Body::empty())
|
||||
.unwrap(),
|
||||
);
|
||||
};
|
||||
Ok(
|
||||
Response::builder()
|
||||
|
|
Loading…
Reference in a new issue