posit-dev / posit-dev/positron

Add safeguard to ensure Rust version compatibility is declared correctly

Open
#922 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: kernels lang: r
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 11h
Merged PRs (30d)
206

Description

Today, it is easy to accidentally write Rust code that depends on new Rust features/compiler versions, if you have a newer compiler on your machine. After being committed, code that depends on new Rust features will generate errors when compiled with the older compilers used in the build process.

For example, we saw this one recently:

   Compiling ark v0.1.0 (/Users/user229818/actions-runner/_work/positron/positron/extensions/positron-r/amalthea/crates/ark)
error[E0658]: use of unstable library feature 'is_some_with'
   --> crates/ark/src/modules.rs:190:33
    |
190 |             if path.extension().is_some_and(|ext| ext == "R") {
    |                                 ^^^^^^^^^^^
    |
    = note: see issue #93050 <https://github.com/rust-lang/rust/issues/93050> for more information

Commits that bump the Rust version requirement should also update the Cargo.toml file for the crate, e.g.:

https://github.com/posit-dev/amalthea/blob/40274872b08cb5cee094bc78ac513e5bea217e3c/crates/ark/Cargo.toml#L5

This will cause those using older compilers to see a "you need a new version of Rust" error instead of a less scrutable compilation error.

We should have a system which ensures that the Cargo.toml files stay in sync with the version of Rust needed to compile the sources. One way to do this would be for the CI system to install exactly the version of Rust recommended in Cargo.toml, so that attempts to use features newer (or older) than are supported by that version will cause CI failures.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the crate Cargo.toml files, including crates/ark/Cargo.toml, and the repository's CI configuration. Determine how the Rust version declared in Cargo.toml can be used by CI, then verify that code requiring a newer compiler fails with a clear version error rather than a compiler feature error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
ci-cd
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.