Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid stack overflow when checking sealing on cyclic trait bounds. #1103

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

obi1kenobi
Copy link
Owner

Fixes #1076.

@obi1kenobi obi1kenobi enabled auto-merge (squash) February 5, 2025 00:13
@obi1kenobi
Copy link
Owner Author

Proof of fix:

$ cargo run --release -- semver-checks --manifest-path /tmp/zproto/Cargo.toml 
    Finished `release` profile [optimized] target(s) in 0.23s
     Running `target/release/cargo-semver-checks semver-checks --manifest-path /tmp/zproto/Cargo.toml`
    Building zproto v0.4.1-pre (current)
       Built [   1.163s] (current)
     Parsing zproto v0.4.1-pre (current)
      Parsed [   0.059s] (current)
     Parsing zproto v0.4.0 (baseline, cached)
      Parsed [   0.061s] (baseline)
    Checking zproto v0.4.0 -> v0.4.1-pre (minor change)
     Checked [   0.080s] 121 checks: 119 pass, 2 fail, 0 warn, 13 skip

--- failure auto_trait_impl_removed: auto trait no longer implemented ---

Description:
A public type has stopped implementing one or more auto traits. This can break downstream code that depends on the traits being implemented.
        ref: https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.39.0/src/lints/auto_trait_impl_removed.ron

Failed in:
  type Mock is no longer Send, in /tmp/zproto/src/backend.rs:131
  type Mock is no longer Sync, in /tmp/zproto/src/backend.rs:131

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.39.0/src/lints/struct_missing.ron

Failed in:
  struct zproto::ascii::port::OpenSerialOptions, previously in file /home/predrag/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zproto-0.4.0/src/ascii/port/options.rs:31
  struct zproto::ascii::port::OpenTcpOptions, previously in file /home/predrag/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/zproto-0.4.0/src/ascii/port/options.rs:171

     Summary semver requires new major version: 2 major and 0 minor checks failed
    Finished [   1.739s] zproto

whereas previously running this command resulted in a stack overflow and crash.

@obi1kenobi obi1kenobi merged commit e7ec008 into main Feb 5, 2025
29 checks passed
@obi1kenobi obi1kenobi deleted the avoid_overflow_on_cyclic_traits branch February 5, 2025 00:22
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.

Stack overflow
1 participant