chore: upgrade to rust 1.80 (#24778)

This commit is contained in:
Satya Rohith 2024-07-29 22:28:04 +05:30 committed by GitHub
parent 8bab761bcc
commit 8c2f1f5a55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 34 additions and 44 deletions

View File

@ -17,7 +17,6 @@ use deno_graph::ModuleGraphError;
use deno_graph::ModuleLoadError;
use deno_graph::ResolutionError;
use import_map::ImportMapError;
use std::fmt::Write;
fn get_import_map_error_class(_: &ImportMapError) -> &'static str {
"URIError"
@ -112,17 +111,5 @@ pub fn get_error_class_name(e: &AnyError) -> &'static str {
e.downcast_ref::<ResolutionError>()
.map(get_resolution_error_class)
})
.unwrap_or_else(|| {
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"
})
.unwrap_or("Error")
}

View File

@ -215,6 +215,8 @@ pub enum SemicolonPreference {
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(
diagnostic: &mut crate::tsc::Diagnostic,
specifier_map: &TscSpecifierMap,

View File

@ -1048,7 +1048,7 @@ fn junction_or_symlink_dir(
match junction::create(old_path, new_path) {
Ok(()) => Ok(()),
Err(junction_err) => {
if cfg!(debug) {
if cfg!(debug_assertions) {
// When running the tests, junctions should be created, but if not then
// surface this error.
log::warn!("Error creating junction. {:#}", junction_err);

View File

@ -1653,7 +1653,7 @@ fn is_supported_test_ext(path: &Path) -> bool {
/// input order.
///
/// - 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 both predicates are marked as `TestMode::Both`
fn collect_specifiers_with_test_mode(

View File

@ -195,8 +195,8 @@ impl WatcherCommunicator {
/// Creates a file watcher.
///
/// - `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
/// have the logic for it like bundling the code.
/// changes. For example, in the case where we would like to bundle, then `operation` would
/// have the logic for it like bundling the code.
pub async fn watch_func<O, F>(
flags: Arc<Flags>,
print_config: PrintConfig,
@ -234,8 +234,8 @@ pub enum WatcherRestartMode {
/// Creates a file watcher.
///
/// - `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
/// have the logic for it like bundling the code.
/// changes. For example, in the case where we would like to bundle, then `operation` would
/// have the logic for it like bundling the code.
pub async fn watch_recv<O, F>(
mut flags: Arc<Flags>,
print_config: PrintConfig,

View File

@ -269,10 +269,10 @@ impl NoProxy {
/// * If neither environment variable is set, `None` is returned
/// * 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,
/// 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)
/// * 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
/// (and therefore would bypass the proxy):

View File

@ -27,3 +27,6 @@ serde_json = "1.0"
[target.'cfg(windows)'.dependencies]
winapi = { workspace = true, features = ["errhandlingapi", "minwindef", "ntdef", "winbase", "winnt"] }
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_aarch, values("x86_64", "aarch64"))'] }

View File

@ -13,6 +13,10 @@ description = "WebGPU implementation for Deno"
[lib]
path = "lib.rs"
[features]
angle = []
vulkan-portability = []
# We make all dependencies conditional on not being wasm,
# so the whole workspace can built as wasm.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]

View File

@ -28,6 +28,9 @@ hmr = ["include_js_files_for_snapshotting"]
# assertion that a snapshot is provided.
only_snapshotted_js_sources = ["include_js_files_for_snapshotting"]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)'] }
[lib]
name = "deno_runtime"
path = "lib.rs"

View File

@ -8,11 +8,9 @@ use deno_core::error::AnyError;
use deno_core::op2;
use deno_core::OpState;
use deno_core::ResourceId;
use deno_core::ToJsBuffer;
use deno_http::http_create_conn_resource;
use deno_net::io::TcpStreamResource;
use deno_net::ops_tls::TlsStreamResource;
use serde::Serialize;
pub const UNSTABLE_FEATURE_NAME: &str = "http";
@ -74,11 +72,3 @@ fn op_http_start(
Err(bad_resource_id())
}
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct HttpUpgradeResult {
conn_rid: ResourceId,
conn_type: &'static str,
read_buf: ToJsBuffer,
}

View File

@ -514,7 +514,7 @@ impl WebWorker {
ops::web_worker::deno_web_worker::init_ops_and_esm(),
];
#[cfg(hmr)]
#[cfg(feature = "hmr")]
assert!(
cfg!(not(feature = "only_snapshotted_js_sources")),
"'hmr' is incompatible with 'only_snapshotted_js_sources'."

View File

@ -448,7 +448,7 @@ impl MainWorker {
ops::web_worker::deno_web_worker::init_ops_and_esm().disable(),
];
#[cfg(hmr)]
#[cfg(feature = "hmr")]
assert!(
cfg!(not(feature = "only_snapshotted_js_sources")),
"'hmr' is incompatible with 'only_snapshotted_js_sources'."

View File

@ -1,3 +1,3 @@
[toolchain]
channel = "1.79.0"
channel = "1.80.0"
components = ["rustfmt", "clippy"]

View File

@ -14,6 +14,7 @@ path = "lib.rs"
[features]
run = []
upgrade = []
[[test]]
name = "integration_tests"

View File

@ -2621,7 +2621,7 @@ mod permissions {
fn with_allow() {
for permission in &util::PERMISSION_VARIANTS {
let status = util::deno_cmd()
.current_dir(&util::testdata_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("--unstable")
.arg(format!("--allow-{permission}"))
@ -2655,7 +2655,7 @@ mod permissions {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let status = util::deno_cmd()
.current_dir(&util::testdata_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(format!(
"--allow-{0}={1}",
@ -2698,7 +2698,7 @@ mod permissions {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let status = util::deno_cmd()
.current_dir(&util::testdata_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(format!(
"--allow-{0}={1}",
@ -2746,7 +2746,7 @@ mod permissions {
let js_dir = util::root_path().join("js");
for permission in &PERMISSION_VARIANTS {
let status = util::deno_cmd()
.current_dir(&util::testdata_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(format!("--allow-{permission}={test_dir},{js_dir}"))
.arg("run/complex_permissions_test.ts")
@ -2765,7 +2765,7 @@ mod permissions {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let status = util::deno_cmd()
.current_dir(&util::testdata_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(format!("--allow-{permission}=."))
.arg("run/complex_permissions_test.ts")
@ -2784,7 +2784,7 @@ mod permissions {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let status = util::deno_cmd()
.current_dir(&util::testdata_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(format!("--allow-{permission}=tls/../"))
.arg("run/complex_permissions_test.ts")

View File

@ -153,7 +153,7 @@ async fn registry_server_handler(
// serve the registry package files
let mut file_path = tests_path().join("registry").join("jsr").to_path_buf();
file_path.push(
&req.uri().path()[1..]
req.uri().path()[1..]
.replace("%2f", "/")
.replace("%2F", "/"),
);

View File

@ -1135,7 +1135,7 @@ async fn main_server(
_ => {
let uri_path = req.uri().path();
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 {
let file_resp = custom_headers(uri_path, file);
return Ok(file_resp);

View File

@ -150,7 +150,7 @@ async fn handle_req_for_registry(
// serve the registry package files
let uri_path = req.uri().path();
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
if let Ok(file) = tokio::fs::read(&file_path).await {