Skip to content

fix(crypto): update RngCore import path for rand 0.10 - #275

Merged
harumaki4649 merged 3 commits into
renovate/rand-0.xfrom
copilot/sub-pr-264
Mar 3, 2026
Merged

harumaki4649 merged 3 commits into
renovate/rand-0.xfrom
copilot/sub-pr-264

Conversation

Copilot AI commented Mar 3, 2026 •

Copy link
Copy Markdown
Contributor

rand 0.10 no longer re-exports RngCore at the crate root, breaking the build when crypto.rs imported it as rand::RngCore.

Changes

  • src/crypto.rs: import RngCore via aes_gcm::aead::rand_core and consolidate it into the existing use aes_gcm::{ ... } block, removing the split import
  • Cargo.toml: remove the now-unused rand = "0.10" direct dependency — RngCore is sourced from aes_gcm's re-exported rand_core, so the top-level rand crate is no longer needed
// before
use aes_gcm::{
    aead::{Aead, KeyInit, OsRng},
    Aes256Gcm, Nonce,
};
use rand::RngCore;

// after
use aes_gcm::{
    aead::{rand_core::RngCore, Aead, KeyInit, OsRng},
    Aes256Gcm, Nonce,
};

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Mar 3, 2026
Co-authored-by: harumaki4649 <83683593+harumaki4649@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix dependencies: update rust crate rand to 0.10 fix(crypto): update RngCore import path for rand 0.10 Mar 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the RngCore import in crypto.rs to account for rand 0.10 no longer providing RngCore via rand::RngCore, restoring build compatibility for nonce generation in the AES-GCM encryption module.

Changes:

  • Switch RngCore import from rand::RngCore to aes_gcm::aead::rand_core::RngCore.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dictsqlite_v2/dictsqlite/src/crypto.rs Outdated
Comment on lines +12 to +13
use pbkdf2::pbkdf2_hmac;
use rand::RngCore;
use aes_gcm::aead::rand_core::RngCore;

Copilot AI Mar 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this change, the crate no longer appears to use the rand dependency anywhere (no remaining rand::... imports/usages across the Rust sources), but Cargo.toml still declares rand = "0.10". Consider removing the unused dependency (or switching to a direct rand_core dependency) to reduce dependency surface and avoid carrying extra rand/rand_core versions.

Copilot uses AI. Check for mistakes.
Comment on lines 8 to 14
use aes_gcm::{
aead::{Aead, KeyInit, OsRng},
Aes256Gcm, Nonce,
};
use pbkdf2::pbkdf2_hmac;
use rand::RngCore;
use aes_gcm::aead::rand_core::RngCore;
use sha2::Sha256;

Copilot AI Mar 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RngCore is now imported from aes_gcm::aead::rand_core, but OsRng is still imported separately from aes_gcm::aead above, resulting in split/duplicated aes_gcm imports. Consider grouping these together (e.g., bring rand_core::RngCore into the existing use aes_gcm::{ ... } block) to keep imports consistent and easier to scan.

Copilot uses AI. Check for mistakes.
…ency

Co-authored-by: harumaki4649 <83683593+harumaki4649@users.noreply.github.com>

Copilot AI commented Mar 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot コメントの確認と対応を日本語で提案してください

レビューコメントを踏まえて以下の2点を修正しました(コミット 7fc7606):

  1. インポートの統合:aes_gcm::aead::rand_core::RngCore を独立した use 文にするのではなく、既存の use aes_gcm::{ aead::{...} } ブロック内にまとめました。
  2. 未使用依存関係の削除:RngCore は aes_gcm 経由で取得するようになったため、Cargo.toml から rand = "0.10" を削除しました。

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@harumaki4649
harumaki4649 merged commit 4c0e645 into renovate/rand-0.x Mar 3, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants