diff --git a/Cargo.lock b/Cargo.lock index 478d60420..73353e1ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,9 +53,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android_log-sys" @@ -120,9 +120,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" +checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" [[package]] name = "as-any" @@ -231,9 +231,9 @@ dependencies = [ "parking_lot", "priority-queue", "rand", - "rustc-hash 2.0.0", + "rustc-hash 2.1.0", "serde", - "thiserror 2.0.3", + "thiserror 2.0.5", "tokio", "tracing", "uuid", @@ -253,7 +253,7 @@ dependencies = [ "rsa", "serde", "serde_json", - "thiserror 2.0.3", + "thiserror 2.0.5", "tokio", "tracing", "uuid", @@ -296,7 +296,7 @@ dependencies = [ "byteorder", "serde_json", "simdnbt", - "thiserror 2.0.3", + "thiserror 2.0.5", "tracing", "uuid", ] @@ -351,7 +351,7 @@ dependencies = [ "regex", "reqwest", "simdnbt", - "thiserror 2.0.3", + "thiserror 2.0.5", "tokio", "tracing", "uuid", @@ -406,7 +406,7 @@ dependencies = [ "nohash-hasher", "parking_lot", "simdnbt", - "thiserror 2.0.3", + "thiserror 2.0.5", "tracing", "uuid", ] @@ -485,7 +485,7 @@ dependencies = [ "serde_json", "simdnbt", "socks5-impl", - "thiserror 2.0.3", + "thiserror 2.0.5", "tokio", "tokio-util", "tracing", @@ -535,9 +535,9 @@ dependencies = [ "derive_more", "nohash-hasher", "parking_lot", - "rustc-hash 2.0.0", + "rustc-hash 2.1.0", "simdnbt", - "thiserror 2.0.3", + "thiserror 2.0.5", "tracing", ] @@ -812,9 +812,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.2" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" +checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" dependencies = [ "shlex", ] @@ -915,18 +915,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" +checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" +checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ "anstyle", "clap_lex", @@ -934,9 +934,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "colorchoice" @@ -1245,9 +1245,9 @@ dependencies = [ [[package]] name = "event-listener-strategy" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" dependencies = [ "event-listener", "pin-project-lite", @@ -1474,9 +1474,9 @@ checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] name = "http" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" dependencies = [ "bytes", "fnv", @@ -1725,9 +1725,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", "hashbrown 0.15.2", @@ -1791,10 +1791,11 @@ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "js-sys" -version = "0.3.73" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb15147158e79fd8b8afd0252522769c4f48725460b37338544d8379d94fc8f9" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -2278,10 +2279,10 @@ dependencies = [ "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash 2.0.0", + "rustc-hash 2.1.0", "rustls", "socket2", - "thiserror 2.0.3", + "thiserror 2.0.5", "tokio", "tracing", ] @@ -2296,11 +2297,11 @@ dependencies = [ "getrandom", "rand", "ring", - "rustc-hash 2.0.0", + "rustc-hash 2.1.0", "rustls", "rustls-pki-types", "slab", - "thiserror 2.0.3", + "thiserror 2.0.5", "tinyvec", "tracing", "web-time", @@ -2535,9 +2536,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-hash" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" [[package]] name = "rustc_version" @@ -2817,7 +2818,7 @@ dependencies = [ "bytes", "percent-encoding", "serde", - "thiserror 2.0.3", + "thiserror 2.0.5", "tokio", ] @@ -2891,11 +2892,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.3" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +checksum = "643caef17e3128658ff44d85923ef2d28af81bb71e0d67bbfe1d76f19a73e053" dependencies = [ - "thiserror-impl 2.0.3", + "thiserror-impl 2.0.5", ] [[package]] @@ -2911,9 +2912,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.3" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +checksum = "995d0bbc9995d1f19d28b7215a9352b0fc3cd3a2d2ec95c2cadc485cdedbcdde" dependencies = [ "proc-macro2", "quote", @@ -2986,9 +2987,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.1" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", @@ -3015,20 +3016,19 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.26.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" dependencies = [ "rustls", - "rustls-pki-types", "tokio", ] [[package]] name = "tokio-util" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -3331,9 +3331,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.96" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21d3b25c3ea1126a2ad5f4f9068483c2af1e64168f847abe863a526b8dbfe00b" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", "once_cell", @@ -3342,13 +3342,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.96" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52857d4c32e496dc6537646b5b117081e71fd2ff06de792e3577a150627db283" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn", @@ -3357,9 +3356,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.46" +version = "0.4.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "951fe82312ed48443ac78b66fa43eded9999f738f6022e67aead7b708659e49a" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" dependencies = [ "cfg-if", "js-sys", @@ -3370,9 +3369,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.96" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "920b0ffe069571ebbfc9ddc0b36ba305ef65577c94b06262ed793716a1afd981" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3380,9 +3379,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.96" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf59002391099644be3524e23b781fa43d2be0c5aa0719a18c0731b9d195cab6" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", @@ -3393,15 +3392,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.96" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5047c5392700766601942795a436d7d2599af60dcc3cc1248c9120bfb0827b0" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "web-sys" -version = "0.3.73" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476364ff87d0ae6bfb661053a9104ab312542658c3d8f963b7ace80b6f9b26b9" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index 7ea37cf5e..166a0c447 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ repository = "https://github.com/azalea-rs/azalea" [workspace.dependencies] aes = "0.8.4" -anyhow = "1.0.93" +anyhow = "1.0.94" async-recursion = "1.1.1" async-trait = "0.1.83" base64 = "0.22.1" @@ -65,7 +65,7 @@ regex = "1.11.1" reqwest = { version = "0.12.9", default-features = false } rsa = "0.9.7" rsa_public_encrypt_pkcs1 = "0.4.0" -rustc-hash = "2.0.0" +rustc-hash = "2.1.0" serde = "1.0.215" serde_json = "1.0.133" sha-1 = "0.10.1" @@ -73,9 +73,9 @@ sha2 = "0.10.8" simdnbt = "0.6" socks5-impl = "0.5.17" syn = "2.0.90" -thiserror = "2.0.3" -tokio = "1.41.1" -tokio-util = "0.7.12" +thiserror = "2.0.5" +tokio = "1.42.0" +tokio-util = "0.7.13" tracing = "0.1.41" tracing-subscriber = "0.3.19" trust-dns-resolver = { version = "0.23.2", default-features = false } diff --git a/azalea-protocol/build.rs b/azalea-protocol/build.rs new file mode 100644 index 000000000..e3bb9c3cd --- /dev/null +++ b/azalea-protocol/build.rs @@ -0,0 +1,53 @@ +use std::env; +use std::process::Command; + +/// The maximum recommended toolchain version, as a triple. +const TOOLCHAIN_MAX: (u32, u32, u32) = (2024, 11, 11); + +fn main() { + if let Some(toolchain) = toolchain_version() { + // If the toolchain is not nightly, do nothing + if !toolchain.contains("nightly") { + return; + } + + // Warn if the toolchain may cause issues + if !recommended_toolchain(&toolchain).unwrap_or_default() { + println!("cargo::warning=The current Rust version may cause issues, try using: \"nightly-{}-{}-{}\"", TOOLCHAIN_MAX.0, TOOLCHAIN_MAX.1, TOOLCHAIN_MAX.2); + } + } +} + +/// Attempt to get the current toolchain version +fn toolchain_version() -> Option { + // Use the `RUSTUP_TOOLCHAIN` environment variable + if let Ok(toolchain) = env::var("RUSTUP_TOOLCHAIN") { + return Some(toolchain); + } + + // Fallback to running `rustc -V` + let rustc_path = env::var("RUSTC") + .or_else(|_| env::var("CARGO_BUILD_RUSTC")) + .unwrap_or(String::from("rustc")); + + let rustc_command = Command::new(&rustc_path).arg("-V").output().unwrap(); + if rustc_command.status.success() { + String::from_utf8(rustc_command.stdout).ok() + } else { + None + } +} + + +/// Attempt to parse the version of the toolchain, +/// returning `Some(true)` if the toolchain should be fine. +fn recommended_toolchain(toolchain: &str) -> Option { + let mut split = toolchain.split('-'); + while split.next() != Some("nightly") {} + + let year = split.next()?.parse().ok()?; + let month = split.next()?.parse().ok()?; + let day = split.next()?.parse().ok()?; + + Some((year, month, day) <= TOOLCHAIN_MAX) +}