Skip to content

Test in CI that we have the same MSRV in all source files #39

Closed

Description

@joshlf

Our MSRV is used in a number of places:

  • Doc comment in src/lib.rs
  • .github/workflows/ci.yml
  • tests/trybuild.rs (added in Make Unalign::into_inner const #60, which hasn't merged as of this writing)
  • zerocopy-derive/tests/trybuild.rs

Since they all need to be updated manually, it's easy for them to get out of sync. We should add a CI test that does some basic grep'ing to verify that they're in sync.

Appendix: Other approaches

I also tried to keep a single source of truth - an MSRV.txt file in the repository root that was sourced by other files. I ran into a few problems:

  • I was able to do the following to use that file to generate the crate-level doc comment:
    //! # Minimum Supported Rust Version (MSRV)
    //! 
    #![doc = concat!("zerocopy's MSRV is ", include_str!("../MSRV.txt"), ".")]
    ...unfortunately, the cargo readme tool we use to generate our README.md is not able to parse this, and so simply stops parsing the doc comment as soon as it encounters the #![doc = ...] line.
  • In zerocopy-derive/tests/trybuild.rs, I wasn't able to replace #[rustversion::stable(1.61.0)] with an equivalent which used MSRV.txt

Activity

  1. added
    experience-medium
    on Oct 12, 2022
  2. memark commented on Oct 16, 2022

    @memark
    Contributor

    I'll have a go at this!

  3. joshlf commented on Oct 16, 2022

    @joshlf
    MemberAuthor

    Awesome, thanks @memark ! Welcome to zerocopy 😃

  4. added a commit that references this issue on Oct 19, 2022
    9f79f0c
  5. added a commit that references this issue on Aug 3, 2023
    0b6c4e1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

experience-medium

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions