Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix rand 0.9 deprecations#1205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions.github/workflows/ci.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -73,6 +73,8 @@ jobs:
path: target
key: check-wasm32-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
- run: cargo check --target wasm32-unknown-unknown --manifest-path tokio-postgres/Cargo.toml --no-default-features --features js
env:
RUSTFLAGS: --cfg getrandom_backend="wasm_js"

test:
name: test
Expand Down
6 changes: 3 additions & 3 deletionspostgres-protocol/Cargo.toml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,7 @@ readme = "../README.md"

[features]
default = []
js = ["getrandom/js"]
js = ["getrandom/wasm_js"]

[dependencies]
base64 = "0.22"
Expand All@@ -20,7 +20,7 @@ fallible-iterator = "0.2"
hmac = "0.12"
md-5 = "0.10"
memchr = "2.0"
rand = "0.8"
rand = "0.9"
sha2 = "0.10"
stringprep = "0.1"
getrandom = { version = "0.2", optional = true }
getrandom = { version = "0.3", optional = true }
4 changes: 2 additions & 2 deletionspostgres-protocol/src/authentication/sasl.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -136,10 +136,10 @@ impl ScramSha256 {
/// Constructs a new instance which will use the provided password for authentication.
pub fn new(password: &[u8], channel_binding: ChannelBinding) -> ScramSha256 {
// rand 0.5's ThreadRng is cryptographically secure
let mut rng = rand::thread_rng();
let mut rng = rand::rng();
let nonce = (0..NONCE_LENGTH)
.map(|_| {
let mut v = rng.gen_range(0x21u8..0x7e);
let mut v = rng.random_range(0x21u8..0x7e);
if v == 0x2c {
v = 0x7e
}
Expand Down
2 changes: 1 addition & 1 deletionpostgres-protocol/src/password/mod.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,7 +28,7 @@ const SCRAM_DEFAULT_SALT_LEN: usize = 16;
/// special characters that would require escaping in an SQL command.
pub fn scram_sha_256(password: &[u8]) -> String {
let mut salt: [u8; SCRAM_DEFAULT_SALT_LEN] = [0; SCRAM_DEFAULT_SALT_LEN];
let mut rng = rand::thread_rng();
let mut rng = rand::rng();
rng.fill_bytes(&mut salt);
scram_sha_256_salt(password, salt)
}
Expand Down
2 changes: 1 addition & 1 deletiontokio-postgres/Cargo.toml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,7 +59,7 @@ postgres-protocol = { version = "0.6.7", path = "../postgres-protocol" }
postgres-types = { version = "0.2.8", path = "../postgres-types" }
tokio = { version = "1.27", features = ["io-util"] }
tokio-util = { version = "0.7", features = ["codec"] }
rand = "0.8.5"
rand = "0.9.0"
whoami = "1.4.1"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
Expand Down
4 changes: 2 additions & 2 deletionstokio-postgres/src/connect.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,7 @@ where

let mut indices = (0..num_hosts).collect::<Vec<_>>();
if config.load_balance_hosts == LoadBalanceHosts::Random {
indices.shuffle(&mut rand::thread_rng());
indices.shuffle(&mut rand::rng());
}

let mut error = None;
Expand DownExpand Up@@ -101,7 +101,7 @@ where
.collect::<Vec<_>>();

if config.load_balance_hosts == LoadBalanceHosts::Random {
addrs.shuffle(&mut rand::thread_rng());
addrs.shuffle(&mut rand::rng());
}

let mut last_err = None;
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp