Skip to content

Make RcOrArc a documented type alias instead of a direct reexport#875

Merged
tyt2y3 merged 1 commit intoSeaQL:masterfrom
Expurple:rc-or-arc-type-alias
Apr 17, 2025
Merged

Make RcOrArc a documented type alias instead of a direct reexport#875
tyt2y3 merged 1 commit intoSeaQL:masterfrom
Expurple:rc-or-arc-type-alias

Conversation

@Expurple
Copy link
Member

@Expurple Expurple commented Apr 2, 2025

PR Info

  • Closes: none
  • Dependencies: none
  • Dependents: none

New Features

Bug Fixes

Breaking Changes

Changes

(probably not changelog-worthy)

  • Made RcOrArc a documented type alias instead of a direct reexport.

It used to show full documentation for Rc/Arc. I find it weird.

Now, it documents what RcOrArc actually is and how to control the representation.

@tyt2y3
Copy link
Member

tyt2y3 commented Apr 16, 2025

nice. but apart from the docs, is there any functional difference between an alias and re-export? I am asking so as to not unknowingly introduced a breaking change

@Expurple
Copy link
Member Author

Expurple commented Apr 17, 2025

cargo-semver-checks doesn't report anything:

sea-query$ git status
On branch rc-or-arc-type-alias
Your branch is up to date with 'origin/rc-or-arc-type-alias'.

nothing to commit, working tree clean
sea-query$ cargo semver-checks --version
cargo-semver-checks 0.40.0
sea-query$ cargo semver-checks --release-type patch --baseline-rev master --all-features
     Cloning master
    Building sea-query v0.32.3 (current)
       Built [   2.118s] (current)
     Parsing sea-query v0.32.3 (current)
      Parsed [   0.065s] (current)
    Building sea-query v0.32.3 (baseline)
       Built [   2.105s] (baseline)
     Parsing sea-query v0.32.3 (baseline)
      Parsed [   0.062s] (baseline)
    Checking sea-query v0.32.3 -> v0.32.3 (assume patch change)
     Checked [   0.224s] 148 checks: 148 pass, 0 skip
     Summary no semver update required
    Finished [  13.238s] sea-query

A quick Google search found a few gotchas with type aliases (1, 2), apparently not applicable here.

I think, technically this is a breaking change on nightly Rust, because my type alias doesn't have the second type parameter (A = Global). That type parameter is unstable, so it's inaccessible on stable Rust. It means that there's no breaking change for stable Rust users. But it also means that I can't forward it by default, because it wouldn't compile on stable. It would have to be gated behind an opt-in #[cfg(feature = "nightly")], or something like that. Which is still breaking, because it's opt-in.

However, I wouldn't worry about this, because this breakage is really niche:

  • It affects only nightly Rust users who use custom allocators with RcOrArc.
  • Which doesn't make sense, because the rest of sea_query assumes the global allocator and doesn't allow to change it. E.g., these two types wrap RcOrArc and hardcode it to use the global allocator:
    pub struct SeaRc<I>(pub(crate) RcOrArc<I>)
    where
        I: ?Sized;
    pub enum ColumnType {
        Array(RcOrArc<ColumnType>),
        // ..
    }
  • So, this only affects nightly Rust users who use custom allocators with RcOrArc, but only for their own purposes, without passing custom-allocated RcOrArc into sea_query???

Copy link
Member

@tyt2y3 tyt2y3 left a comment

Choose a reason for hiding this comment

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

thank you. I trust your judgement!

@tyt2y3 tyt2y3 merged commit aff77e8 into SeaQL:master Apr 17, 2025
20 checks passed
@tyt2y3
Copy link
Member

tyt2y3 commented Apr 17, 2025

sorry I forgot to click merge.

@github-actions
Copy link

github-actions bot commented May 7, 2025

🎉 Released In 0.32.5 🎉

Thank you everyone for the contribution!
This feature is now available in the latest release. Now is a good time to upgrade!
Your participation is what makes us unique; your adoption is what drives us forward.
You can support SeaQL 🌊 by starring our repos, sharing our libraries and becoming a sponsor ⭐.

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