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

Commitf1c5c4f

Browse files
authored
Merge pull request#1205 from kristof-mattei/fix-rand-0.9-deprecations
fix rand 0.9 deprecations
2 parentsc104b23 +0d18b95 commitf1c5c4f

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ jobs:
7373
path:target
7474
key:check-wasm32-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
7575
-run:cargo check --target wasm32-unknown-unknown --manifest-path tokio-postgres/Cargo.toml --no-default-features --features js
76+
env:
77+
RUSTFLAGS:--cfg getrandom_backend="wasm_js"
7678

7779
test:
7880
name:test

‎postgres-protocol/Cargo.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ readme = "../README.md"
1010

1111
[features]
1212
default = []
13-
js = ["getrandom/js"]
13+
js = ["getrandom/wasm_js"]
1414

1515
[dependencies]
1616
base64 ="0.22"
@@ -20,7 +20,7 @@ fallible-iterator = "0.2"
2020
hmac ="0.12"
2121
md-5 ="0.10"
2222
memchr ="2.0"
23-
rand ="0.8"
23+
rand ="0.9"
2424
sha2 ="0.10"
2525
stringprep ="0.1"
26-
getrandom = {version ="0.2",optional =true }
26+
getrandom = {version ="0.3",optional =true }

‎postgres-protocol/src/authentication/sasl.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ impl ScramSha256 {
136136
/// Constructs a new instance which will use the provided password for authentication.
137137
pubfnnew(password:&[u8],channel_binding:ChannelBinding) ->ScramSha256{
138138
// rand 0.5's ThreadRng is cryptographically secure
139-
letmut rng = rand::thread_rng();
139+
letmut rng = rand::rng();
140140
let nonce =(0..NONCE_LENGTH)
141141
.map(|_|{
142-
letmut v = rng.gen_range(0x21u8..0x7e);
142+
letmut v = rng.random_range(0x21u8..0x7e);
143143
if v ==0x2c{
144144
v =0x7e
145145
}

‎postgres-protocol/src/password/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const SCRAM_DEFAULT_SALT_LEN: usize = 16;
2828
/// special characters that would require escaping in an SQL command.
2929
pubfnscram_sha_256(password:&[u8]) ->String{
3030
letmut salt:[u8;SCRAM_DEFAULT_SALT_LEN] =[0;SCRAM_DEFAULT_SALT_LEN];
31-
letmut rng = rand::thread_rng();
31+
letmut rng = rand::rng();
3232
rng.fill_bytes(&mut salt);
3333
scram_sha_256_salt(password, salt)
3434
}

‎tokio-postgres/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ postgres-protocol = { version = "0.6.7", path = "../postgres-protocol" }
5959
postgres-types = {version ="0.2.8",path ="../postgres-types" }
6060
tokio = {version ="1.27",features = ["io-util"] }
6161
tokio-util = {version ="0.7",features = ["codec"] }
62-
rand ="0.8.5"
62+
rand ="0.9.0"
6363
whoami ="1.4.1"
6464

6565
[target.'cfg(not(target_arch="wasm32"))'.dependencies]

‎tokio-postgres/src/connect.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ where
4444

4545
letmut indices =(0..num_hosts).collect::<Vec<_>>();
4646
if config.load_balance_hosts ==LoadBalanceHosts::Random{
47-
indices.shuffle(&mut rand::thread_rng());
47+
indices.shuffle(&mut rand::rng());
4848
}
4949

5050
letmut error =None;
@@ -101,7 +101,7 @@ where
101101
.collect::<Vec<_>>();
102102

103103
if config.load_balance_hosts ==LoadBalanceHosts::Random{
104-
addrs.shuffle(&mut rand::thread_rng());
104+
addrs.shuffle(&mut rand::rng());
105105
}
106106

107107
letmut last_err =None;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp