Skip to content

Fix step_trait on recent nightly: implement forward/backward_overflowing - #112

Merged
danlehmann merged 2 commits into
danlehmann:mainfrom
bidord:fix/step-trait
Jul 31, 2026
Merged

Fix step_trait on recent nightly: implement forward/backward_overflowing#112
danlehmann merged 2 commits into
danlehmann:mainfrom
bidord:fix/step-trait

Conversation

@bidord

@bidord bidord commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Context

rust-lang/rust#155114 added two required methods to Step trait, so --features step_trait no longer builds on current nightly.

Change

  • Implement forward_overflowing / backward_overflowing. These wrap via the underlying type's *_overflowing plus masked_new. That's what the trait docs recommend.
  • Add tests
  • Add changelog entry

AI disclosure: Claude Code wrote the tests and changelog entry.

@bidord bidord mentioned this pull request Jul 28, 2026
@danlehmann

Copy link
Copy Markdown
Owner

thank you! I'll upload a patch to fix the check documentation error shortly - we can ignore that one. for the semantic versioning failure we probably have to update the compiler that's being used to perform the check?

@danlehmann

Copy link
Copy Markdown
Owner

doc fix: #112

@danlehmann

Copy link
Copy Markdown
Owner

let me know if you'd like to fix the semantic version issue yourself - if not, I'm happy to take over this patch

@bidord

bidord commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

I quickly ran 2 tests when I saw the failure with the 2 solutions I could think of:

  1. Run cargo-semver-checks on nightly toolchain: bidord@b43663c
    The job is still failing: https://github.com/bidord/arbitrary-int/actions/runs/30384093554/job/90358897787
    My understanding is that cargo-semver-checks-action is now also trying to build the latest release of this crate (v2.1.1) on the nightly toolchain so it can compare both. So, in theory, that failure should disappear as soon as you publish a new release on crates.io. Would that be acceptable?
    Also important to take into consideration: according to cargo-semver-checks's FAQ, support for nightly Rust versions is on a best-effort basis. So it might lead to other complications in the future. You might want to avoid that.

  2. Remove step_trait from cargo-semver-checks: bidord@9781e47
    This works right-away: https://github.com/bidord/arbitrary-int/actions/runs/30384165752/job/90359138721
    Of course, this means removing some checks from your CI. IMO that's okay if you consider step_trait to be a nightly-only feature.

You can take over this patch and decide what's best.

Or if you want me to push one of the above solutions to this PR's branch, let me know.

The new Step::forward_overflowing/backward_overflowing impls only exist
on recent nightly, so the crate no longer compiles with step_trait on
the stable toolchain cargo-semver-checks runs on. Semver-checking an
unstable, nightly-gated feature has little value anyway.
@danlehmann
danlehmann merged commit 5051988 into danlehmann:main Jul 31, 2026
15 checks passed
@danlehmann danlehmann mentioned this pull request Jul 31, 2026
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