Date: 2024.04.16
In the past two weeks I was struggling with the MSRV - Minimum Supported Rust Version numbers, but finally I think I got it right.
First of all I had to realized that because roughly 20% of the crates don't indicate their repository, it would be better to collect this information from the Cargo.toml file of the already released crates. For this I had to copy all the crates from Crates.io and I had to make sure that I remove the old downloads once a new version of the crate appears.
Then I had to write some code that will read the Cargo.toml file. I could not figure out how to use the source code of Cargo for this. I found the cargo_toml crate which is used by lib.rs, but it panicked on the Cargo.toml files I threw at it. This was probably due to the fact that back then I was still using the Cargo.toml files that came from the cloned repositories. I files some issues but I figured it is a good opportunity for me to understand TOML better so I wrote my own little code.
The last major issue that drove me crazy was the fact that some crates had a rust-version field that looked like this: "1.79.0". When I crated the appropriate HTML file I used set_extension that replaced the last "0" by "html" yielding a filename "1.79.html". However on the page listing all the version "1.79" was already linking to "1.79.html" which now contained the list of "1.79.0". I was totally confused for quite some time. Eventually I figured out how to set the file extension.
- 65 crates use 2015 as "edition", 16,102 has no "edition".
- 143,234-132,182 = 11,052 of the crates have "rust-version"
- 10,788 crates (7.53%) has both "edition" and "rust-version"
- 16,055 crates (11.2%) have neither.
Number of crates
There are now 143,234 crates (1,252 more than two weeks ago).MSRV - Minimum Supported Rust Version Stats from the MSRV page
package.edition
edition | count |
---|---|
na | 16,102 |
2021 | 79,580 |
2018 | 47,270 |
2015 | 65 |
package.rust-version
Rust Digger Stats from the stats page
name | value | percentage |
---|---|---|
total | 143,234 | 100% |
No repository | 27,784 | 19.39% |
Has homepage but no repository | 3,330 | 2.32% |
No homepage and no repository | 24,454 | 17.07% |
On GitHub but no CI | 56,857 | 39.69% |
On GitLab but no CI | 1,864 | 1.3% |
Crates without owner name | 21,309 | 14.87% |
Crates without owner | 11 | 0% |
Has rustfmt.toml | 15,182 | 10.59% |
Has .rustfmt.toml | 5,524 | 3.85% |
Has both rustfmt.toml and .rustfmt.toml | 35 | 0.02% |
Has Cargo.toml in root | 95,441 | 66.63% |
Has no Cargo.toml in root | 47,793 | 33.36% |
Has errors in the released Cargo.toml file | 83 | 0.05% |
Crates without edition and without rust-version in the Cargo.toml | 16,055 | 11.2% |
Crates with both edition rust-version in the Cargo.toml | 10,788 | 7.53% |