Skip to content

frontend: Infer MSRV based on edition if rust_version is not set #9996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions app/models/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ export default class Version extends Model {
*/
@attr rust_version;

/**
* The Rust edition required to compile this crate version.
* @type {string | null}
*/
@attr edition;

/** @type {boolean | null} */
@attr has_lib;
/** @type {string[] | null} */
Expand All @@ -46,8 +52,14 @@ export default class Version extends Model {

get msrv() {
let rustVersion = this.rust_version;
// add `.0` suffix if the `rust-version` field only has two version components
return /^[^.]+\.[^.]+$/.test(rustVersion) ? `${rustVersion}.0` : rustVersion;
if (rustVersion) {
// add `.0` suffix if the `rust-version` field only has two version components
return /^[^.]+\.[^.]+$/.test(rustVersion) ? `${rustVersion}.0` : rustVersion;
} else if (this.edition === '2018') {
return '1.31.0';
} else if (this.edition === '2021') {
return '1.56.0';
}
}

get isNew() {
Expand Down
Loading