Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 4, 2026

Rust edition 2024 reserves gen as a keyword, breaking compilation of the gen module and any variables named gen.

Changes

  • Cargo.toml: Updated edition from 2021 to 2024
  • Module rename: src/gen.rssrc/generator.rs
  • Import updates: All references to crate::gen and flakeid::gen changed to use generator
  • Variable renames: gen variables renamed to generator in tests, examples, and doc comments

Example

// Before (edition 2021)
use flakeid::gen::FlakeGen;
let mut gen = FlakeGen::with_mac_addr()?;

// After (edition 2024)
use flakeid::generator::FlakeGen;
let mut generator = FlakeGen::with_mac_addr()?;

The API surface remains unchanged—only the module path and variable naming patterns differ.

Original prompt

Update this crate to use Rust edition 2024 instead of 2021. This requires renaming the gen module since gen becomes a reserved keyword in Rust edition 2024.

Required Changes

  1. Update Cargo.toml

    • Change edition = "2021" to edition = "2024" on line 5
  2. Rename the module file

    • Rename src/gen.rs to src/generator.rs
  3. Update module declaration in src/lib.rs

    • Change pub mod gen; to pub mod generator; on line 10
  4. Update imports throughout the codebase

    • In src/seq.rs: Change use crate::gen::FlakeErr; to use crate::generator::FlakeErr;
    • In examples/generate.rs: Change use flakeid::gen::FlakeGen; to use flakeid::generator::FlakeGen;
  5. Update documentation references

    • In the renamed src/generator.rs file, update any doc comments that reference the gen module to reference generator instead
    • Specifically in the doc examples around lines 18-22 and 32-37 that show use flakeid::gen::FlakeGen; should be changed to use flakeid::generator::FlakeGen;

The module functionality remains unchanged - this is purely a renaming to avoid the gen keyword conflict introduced in Rust edition 2024.

This pull request was created from Copilot chat.


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

Co-authored-by: mantono <7093365+mantono@users.noreply.github.com>
Copilot AI changed the title [WIP] Update crate to use Rust edition 2024 and rename gen module Migrate to Rust edition 2024 by renaming gen module to generator Jan 4, 2026
Copilot AI requested a review from mantono January 4, 2026 20:45
@mantono mantono marked this pull request as ready for review January 5, 2026 19:33
@mantono mantono merged commit cfd301b into master Jan 6, 2026
5 checks passed
@mantono mantono deleted the copilot/update-rust-edition-2024 branch January 6, 2026 21:45
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