posit-dev / posit-dev/positron
Add safeguard to ensure Rust version compatibility is declared correctly
Nobody has claimed this yet.
- 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.:
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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