Skip to content

Make code compile and lint cleanly under all relevant versions of rust #196

Description

We need to have more reliable CI for all relevant versions of the rust toolchain. Is there a way to make this happen? I'd prefer to not to commit Cargo.lock.

In our GH CI, this is what runs with the default Rust version (is it maybe the latest stable?)

- name: Clippy
run: cargo clippy --all-targets -- -D warnings -D clippy::dbg_macro
- name: Run tests
run: cargo test --verbose -- --skip sourcegen_ast --skip sourcegen_ast_nodes

But for the MSRV, we do not run clippy in CI, and the command for running tests is slightly different.

- name: Build
run: cargo build --release --verbose
- name: Run tests
run: cargo test --verbose --lib --tests -- --skip sourcegen_ast --skip sourcegen_ast_nodes

I found that occasionally upon pushing a PR, CI would fail because some component or dep is upgraded.

I tried some conditional compilation. For example here:

impl<N: AstNode> Clone for AstPtr<N> {
#[rustversion::before(1.74)]
fn clone(&self) -> AstPtr<N> {
AstPtr {
raw: self.raw.clone(),
_ty: PhantomData,
}
}
#[rustversion::since(1.74)]
fn clone(&self) -> AstPtr<N> {
AstPtr {
raw: self.raw,
_ty: PhantomData,
}
}
}

I think it helped, but I don't recall why I was not able to solve the problem completely.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions