mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
chore: upgrade to rust 1.80 (#24778)
This commit is contained in:
parent
8bab761bcc
commit
8c2f1f5a55
18 changed files with 34 additions and 44 deletions
|
@ -17,7 +17,6 @@ use deno_graph::ModuleGraphError;
|
||||||
use deno_graph::ModuleLoadError;
|
use deno_graph::ModuleLoadError;
|
||||||
use deno_graph::ResolutionError;
|
use deno_graph::ResolutionError;
|
||||||
use import_map::ImportMapError;
|
use import_map::ImportMapError;
|
||||||
use std::fmt::Write;
|
|
||||||
|
|
||||||
fn get_import_map_error_class(_: &ImportMapError) -> &'static str {
|
fn get_import_map_error_class(_: &ImportMapError) -> &'static str {
|
||||||
"URIError"
|
"URIError"
|
||||||
|
@ -112,17 +111,5 @@ pub fn get_error_class_name(e: &AnyError) -> &'static str {
|
||||||
e.downcast_ref::<ResolutionError>()
|
e.downcast_ref::<ResolutionError>()
|
||||||
.map(get_resolution_error_class)
|
.map(get_resolution_error_class)
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or("Error")
|
||||||
if cfg!(debug) {
|
|
||||||
log::warn!(
|
|
||||||
"Error '{}' contains boxed error of unknown type:{}",
|
|
||||||
e,
|
|
||||||
e.chain().fold(String::new(), |mut output, e| {
|
|
||||||
let _ = write!(output, "\n {e:?}");
|
|
||||||
output
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
"Error"
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,6 +215,8 @@ pub enum SemicolonPreference {
|
||||||
Remove,
|
Remove,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allow due to false positive https://github.com/rust-lang/rust-clippy/issues/13170
|
||||||
|
#[allow(clippy::needless_borrows_for_generic_args)]
|
||||||
fn normalize_diagnostic(
|
fn normalize_diagnostic(
|
||||||
diagnostic: &mut crate::tsc::Diagnostic,
|
diagnostic: &mut crate::tsc::Diagnostic,
|
||||||
specifier_map: &TscSpecifierMap,
|
specifier_map: &TscSpecifierMap,
|
||||||
|
|
|
@ -1048,7 +1048,7 @@ fn junction_or_symlink_dir(
|
||||||
match junction::create(old_path, new_path) {
|
match junction::create(old_path, new_path) {
|
||||||
Ok(()) => Ok(()),
|
Ok(()) => Ok(()),
|
||||||
Err(junction_err) => {
|
Err(junction_err) => {
|
||||||
if cfg!(debug) {
|
if cfg!(debug_assertions) {
|
||||||
// When running the tests, junctions should be created, but if not then
|
// When running the tests, junctions should be created, but if not then
|
||||||
// surface this error.
|
// surface this error.
|
||||||
log::warn!("Error creating junction. {:#}", junction_err);
|
log::warn!("Error creating junction. {:#}", junction_err);
|
||||||
|
|
|
@ -1653,7 +1653,7 @@ fn is_supported_test_ext(path: &Path) -> bool {
|
||||||
/// input order.
|
/// input order.
|
||||||
///
|
///
|
||||||
/// - Specifiers matching the `is_supported_test_ext` predicate are marked as
|
/// - Specifiers matching the `is_supported_test_ext` predicate are marked as
|
||||||
/// `TestMode::Documentation`.
|
/// `TestMode::Documentation`.
|
||||||
/// - Specifiers matching the `is_supported_test_path` are marked as `TestMode::Executable`.
|
/// - Specifiers matching the `is_supported_test_path` are marked as `TestMode::Executable`.
|
||||||
/// - Specifiers matching both predicates are marked as `TestMode::Both`
|
/// - Specifiers matching both predicates are marked as `TestMode::Both`
|
||||||
fn collect_specifiers_with_test_mode(
|
fn collect_specifiers_with_test_mode(
|
||||||
|
|
|
@ -195,8 +195,8 @@ impl WatcherCommunicator {
|
||||||
/// Creates a file watcher.
|
/// Creates a file watcher.
|
||||||
///
|
///
|
||||||
/// - `operation` is the actual operation we want to run every time the watcher detects file
|
/// - `operation` is the actual operation we want to run every time the watcher detects file
|
||||||
/// changes. For example, in the case where we would like to bundle, then `operation` would
|
/// changes. For example, in the case where we would like to bundle, then `operation` would
|
||||||
/// have the logic for it like bundling the code.
|
/// have the logic for it like bundling the code.
|
||||||
pub async fn watch_func<O, F>(
|
pub async fn watch_func<O, F>(
|
||||||
flags: Arc<Flags>,
|
flags: Arc<Flags>,
|
||||||
print_config: PrintConfig,
|
print_config: PrintConfig,
|
||||||
|
@ -234,8 +234,8 @@ pub enum WatcherRestartMode {
|
||||||
/// Creates a file watcher.
|
/// Creates a file watcher.
|
||||||
///
|
///
|
||||||
/// - `operation` is the actual operation we want to run every time the watcher detects file
|
/// - `operation` is the actual operation we want to run every time the watcher detects file
|
||||||
/// changes. For example, in the case where we would like to bundle, then `operation` would
|
/// changes. For example, in the case where we would like to bundle, then `operation` would
|
||||||
/// have the logic for it like bundling the code.
|
/// have the logic for it like bundling the code.
|
||||||
pub async fn watch_recv<O, F>(
|
pub async fn watch_recv<O, F>(
|
||||||
mut flags: Arc<Flags>,
|
mut flags: Arc<Flags>,
|
||||||
print_config: PrintConfig,
|
print_config: PrintConfig,
|
||||||
|
|
|
@ -269,10 +269,10 @@ impl NoProxy {
|
||||||
/// * If neither environment variable is set, `None` is returned
|
/// * If neither environment variable is set, `None` is returned
|
||||||
/// * Entries are expected to be comma-separated (whitespace between entries is ignored)
|
/// * Entries are expected to be comma-separated (whitespace between entries is ignored)
|
||||||
/// * IP addresses (both IPv4 and IPv6) are allowed, as are optional subnet masks (by adding /size,
|
/// * IP addresses (both IPv4 and IPv6) are allowed, as are optional subnet masks (by adding /size,
|
||||||
/// for example "`192.168.1.0/24`").
|
/// for example "`192.168.1.0/24`").
|
||||||
/// * An entry "`*`" matches all hostnames (this is the only wildcard allowed)
|
/// * An entry "`*`" matches all hostnames (this is the only wildcard allowed)
|
||||||
/// * Any other entry is considered a domain name (and may contain a leading dot, for example `google.com`
|
/// * Any other entry is considered a domain name (and may contain a leading dot, for example `google.com`
|
||||||
/// and `.google.com` are equivalent) and would match both that domain AND all subdomains.
|
/// and `.google.com` are equivalent) and would match both that domain AND all subdomains.
|
||||||
///
|
///
|
||||||
/// For example, if `"NO_PROXY=google.com, 192.168.1.0/24"` was set, all of the following would match
|
/// For example, if `"NO_PROXY=google.com, 192.168.1.0/24"` was set, all of the following would match
|
||||||
/// (and therefore would bypass the proxy):
|
/// (and therefore would bypass the proxy):
|
||||||
|
|
|
@ -27,3 +27,6 @@ serde_json = "1.0"
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
winapi = { workspace = true, features = ["errhandlingapi", "minwindef", "ntdef", "winbase", "winnt"] }
|
winapi = { workspace = true, features = ["errhandlingapi", "minwindef", "ntdef", "winbase", "winnt"] }
|
||||||
|
|
||||||
|
[lints.rust]
|
||||||
|
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_aarch, values("x86_64", "aarch64"))'] }
|
||||||
|
|
|
@ -13,6 +13,10 @@ description = "WebGPU implementation for Deno"
|
||||||
[lib]
|
[lib]
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
angle = []
|
||||||
|
vulkan-portability = []
|
||||||
|
|
||||||
# We make all dependencies conditional on not being wasm,
|
# We make all dependencies conditional on not being wasm,
|
||||||
# so the whole workspace can built as wasm.
|
# so the whole workspace can built as wasm.
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
|
|
|
@ -28,6 +28,9 @@ hmr = ["include_js_files_for_snapshotting"]
|
||||||
# assertion that a snapshot is provided.
|
# assertion that a snapshot is provided.
|
||||||
only_snapshotted_js_sources = ["include_js_files_for_snapshotting"]
|
only_snapshotted_js_sources = ["include_js_files_for_snapshotting"]
|
||||||
|
|
||||||
|
[lints.rust]
|
||||||
|
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)'] }
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "deno_runtime"
|
name = "deno_runtime"
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
|
|
@ -8,11 +8,9 @@ use deno_core::error::AnyError;
|
||||||
use deno_core::op2;
|
use deno_core::op2;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::ResourceId;
|
use deno_core::ResourceId;
|
||||||
use deno_core::ToJsBuffer;
|
|
||||||
use deno_http::http_create_conn_resource;
|
use deno_http::http_create_conn_resource;
|
||||||
use deno_net::io::TcpStreamResource;
|
use deno_net::io::TcpStreamResource;
|
||||||
use deno_net::ops_tls::TlsStreamResource;
|
use deno_net::ops_tls::TlsStreamResource;
|
||||||
use serde::Serialize;
|
|
||||||
|
|
||||||
pub const UNSTABLE_FEATURE_NAME: &str = "http";
|
pub const UNSTABLE_FEATURE_NAME: &str = "http";
|
||||||
|
|
||||||
|
@ -74,11 +72,3 @@ fn op_http_start(
|
||||||
|
|
||||||
Err(bad_resource_id())
|
Err(bad_resource_id())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct HttpUpgradeResult {
|
|
||||||
conn_rid: ResourceId,
|
|
||||||
conn_type: &'static str,
|
|
||||||
read_buf: ToJsBuffer,
|
|
||||||
}
|
|
||||||
|
|
|
@ -514,7 +514,7 @@ impl WebWorker {
|
||||||
ops::web_worker::deno_web_worker::init_ops_and_esm(),
|
ops::web_worker::deno_web_worker::init_ops_and_esm(),
|
||||||
];
|
];
|
||||||
|
|
||||||
#[cfg(hmr)]
|
#[cfg(feature = "hmr")]
|
||||||
assert!(
|
assert!(
|
||||||
cfg!(not(feature = "only_snapshotted_js_sources")),
|
cfg!(not(feature = "only_snapshotted_js_sources")),
|
||||||
"'hmr' is incompatible with 'only_snapshotted_js_sources'."
|
"'hmr' is incompatible with 'only_snapshotted_js_sources'."
|
||||||
|
|
|
@ -448,7 +448,7 @@ impl MainWorker {
|
||||||
ops::web_worker::deno_web_worker::init_ops_and_esm().disable(),
|
ops::web_worker::deno_web_worker::init_ops_and_esm().disable(),
|
||||||
];
|
];
|
||||||
|
|
||||||
#[cfg(hmr)]
|
#[cfg(feature = "hmr")]
|
||||||
assert!(
|
assert!(
|
||||||
cfg!(not(feature = "only_snapshotted_js_sources")),
|
cfg!(not(feature = "only_snapshotted_js_sources")),
|
||||||
"'hmr' is incompatible with 'only_snapshotted_js_sources'."
|
"'hmr' is incompatible with 'only_snapshotted_js_sources'."
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.79.0"
|
channel = "1.80.0"
|
||||||
components = ["rustfmt", "clippy"]
|
components = ["rustfmt", "clippy"]
|
||||||
|
|
|
@ -14,6 +14,7 @@ path = "lib.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
run = []
|
run = []
|
||||||
|
upgrade = []
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
name = "integration_tests"
|
name = "integration_tests"
|
||||||
|
|
|
@ -2621,7 +2621,7 @@ mod permissions {
|
||||||
fn with_allow() {
|
fn with_allow() {
|
||||||
for permission in &util::PERMISSION_VARIANTS {
|
for permission in &util::PERMISSION_VARIANTS {
|
||||||
let status = util::deno_cmd()
|
let status = util::deno_cmd()
|
||||||
.current_dir(&util::testdata_path())
|
.current_dir(util::testdata_path())
|
||||||
.arg("run")
|
.arg("run")
|
||||||
.arg("--unstable")
|
.arg("--unstable")
|
||||||
.arg(format!("--allow-{permission}"))
|
.arg(format!("--allow-{permission}"))
|
||||||
|
@ -2655,7 +2655,7 @@ mod permissions {
|
||||||
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
|
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
|
||||||
for permission in &PERMISSION_VARIANTS {
|
for permission in &PERMISSION_VARIANTS {
|
||||||
let status = util::deno_cmd()
|
let status = util::deno_cmd()
|
||||||
.current_dir(&util::testdata_path())
|
.current_dir(util::testdata_path())
|
||||||
.arg("run")
|
.arg("run")
|
||||||
.arg(format!(
|
.arg(format!(
|
||||||
"--allow-{0}={1}",
|
"--allow-{0}={1}",
|
||||||
|
@ -2698,7 +2698,7 @@ mod permissions {
|
||||||
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
|
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
|
||||||
for permission in &PERMISSION_VARIANTS {
|
for permission in &PERMISSION_VARIANTS {
|
||||||
let status = util::deno_cmd()
|
let status = util::deno_cmd()
|
||||||
.current_dir(&util::testdata_path())
|
.current_dir(util::testdata_path())
|
||||||
.arg("run")
|
.arg("run")
|
||||||
.arg(format!(
|
.arg(format!(
|
||||||
"--allow-{0}={1}",
|
"--allow-{0}={1}",
|
||||||
|
@ -2746,7 +2746,7 @@ mod permissions {
|
||||||
let js_dir = util::root_path().join("js");
|
let js_dir = util::root_path().join("js");
|
||||||
for permission in &PERMISSION_VARIANTS {
|
for permission in &PERMISSION_VARIANTS {
|
||||||
let status = util::deno_cmd()
|
let status = util::deno_cmd()
|
||||||
.current_dir(&util::testdata_path())
|
.current_dir(util::testdata_path())
|
||||||
.arg("run")
|
.arg("run")
|
||||||
.arg(format!("--allow-{permission}={test_dir},{js_dir}"))
|
.arg(format!("--allow-{permission}={test_dir},{js_dir}"))
|
||||||
.arg("run/complex_permissions_test.ts")
|
.arg("run/complex_permissions_test.ts")
|
||||||
|
@ -2765,7 +2765,7 @@ mod permissions {
|
||||||
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
|
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
|
||||||
for permission in &PERMISSION_VARIANTS {
|
for permission in &PERMISSION_VARIANTS {
|
||||||
let status = util::deno_cmd()
|
let status = util::deno_cmd()
|
||||||
.current_dir(&util::testdata_path())
|
.current_dir(util::testdata_path())
|
||||||
.arg("run")
|
.arg("run")
|
||||||
.arg(format!("--allow-{permission}=."))
|
.arg(format!("--allow-{permission}=."))
|
||||||
.arg("run/complex_permissions_test.ts")
|
.arg("run/complex_permissions_test.ts")
|
||||||
|
@ -2784,7 +2784,7 @@ mod permissions {
|
||||||
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
|
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
|
||||||
for permission in &PERMISSION_VARIANTS {
|
for permission in &PERMISSION_VARIANTS {
|
||||||
let status = util::deno_cmd()
|
let status = util::deno_cmd()
|
||||||
.current_dir(&util::testdata_path())
|
.current_dir(util::testdata_path())
|
||||||
.arg("run")
|
.arg("run")
|
||||||
.arg(format!("--allow-{permission}=tls/../"))
|
.arg(format!("--allow-{permission}=tls/../"))
|
||||||
.arg("run/complex_permissions_test.ts")
|
.arg("run/complex_permissions_test.ts")
|
||||||
|
|
|
@ -153,7 +153,7 @@ async fn registry_server_handler(
|
||||||
// serve the registry package files
|
// serve the registry package files
|
||||||
let mut file_path = tests_path().join("registry").join("jsr").to_path_buf();
|
let mut file_path = tests_path().join("registry").join("jsr").to_path_buf();
|
||||||
file_path.push(
|
file_path.push(
|
||||||
&req.uri().path()[1..]
|
req.uri().path()[1..]
|
||||||
.replace("%2f", "/")
|
.replace("%2f", "/")
|
||||||
.replace("%2F", "/"),
|
.replace("%2F", "/"),
|
||||||
);
|
);
|
||||||
|
|
|
@ -1135,7 +1135,7 @@ async fn main_server(
|
||||||
_ => {
|
_ => {
|
||||||
let uri_path = req.uri().path();
|
let uri_path = req.uri().path();
|
||||||
let mut file_path = testdata_path().to_path_buf();
|
let mut file_path = testdata_path().to_path_buf();
|
||||||
file_path.push(&uri_path[1..].replace("%2f", "/"));
|
file_path.push(uri_path[1..].replace("%2f", "/"));
|
||||||
if let Ok(file) = tokio::fs::read(&file_path).await {
|
if let Ok(file) = tokio::fs::read(&file_path).await {
|
||||||
let file_resp = custom_headers(uri_path, file);
|
let file_resp = custom_headers(uri_path, file);
|
||||||
return Ok(file_resp);
|
return Ok(file_resp);
|
||||||
|
|
|
@ -150,7 +150,7 @@ async fn handle_req_for_registry(
|
||||||
// serve the registry package files
|
// serve the registry package files
|
||||||
let uri_path = req.uri().path();
|
let uri_path = req.uri().path();
|
||||||
let mut file_path = root_dir.to_path_buf();
|
let mut file_path = root_dir.to_path_buf();
|
||||||
file_path.push(&uri_path[1..].replace("%2f", "/").replace("%2F", "/"));
|
file_path.push(uri_path[1..].replace("%2f", "/").replace("%2F", "/"));
|
||||||
|
|
||||||
// serve if the filepath exists
|
// serve if the filepath exists
|
||||||
if let Ok(file) = tokio::fs::read(&file_path).await {
|
if let Ok(file) = tokio::fs::read(&file_path).await {
|
||||||
|
|
Loading…
Reference in a new issue