diff --git a/app/components/crate-sidebar.hbs b/app/components/crate-sidebar.hbs index 1ace1a533e7..d078b5f6790 100644 --- a/app/components/crate-sidebar.hbs +++ b/app/components/crate-sidebar.hbs @@ -22,7 +22,13 @@ {{svg-jar "rust"}} v{{@version.msrv}} - + + + "Minimum Supported Rust Version" + {{#if @version.edition}} +
requires Rust Edition {{@version.edition}}
+ {{/if}} +
{{/if}} diff --git a/app/components/crate-sidebar.module.css b/app/components/crate-sidebar.module.css index 0ca5c3ad98f..c66bdc2f1d6 100644 --- a/app/components/crate-sidebar.module.css +++ b/app/components/crate-sidebar.module.css @@ -40,6 +40,10 @@ } } +.edition { + margin-top: var(--space-2xs); +} + .license { a { color: var(--main-color); diff --git a/app/components/version-list/row.hbs b/app/components/version-list/row.hbs index 29d38afc667..137a72adc0d 100644 --- a/app/components/version-list/row.hbs +++ b/app/components/version-list/row.hbs @@ -71,6 +71,13 @@ {{svg-jar "rust"}} v{{@version.msrv}} + + + "Minimum Supported Rust Version" + {{#if @version.edition}} +
requires Rust Edition {{@version.edition}}
+ {{/if}} +
{{/if}} diff --git a/app/components/version-list/row.module.css b/app/components/version-list/row.module.css index c088ffc29e2..63722b01f09 100644 --- a/app/components/version-list/row.module.css +++ b/app/components/version-list/row.module.css @@ -46,10 +46,6 @@ z-index: 1; cursor: help; } - - :global(.ember-tooltip) { - word-break: break-all; - } } .version { @@ -57,6 +53,10 @@ grid-template-columns: auto auto; place-items: center; + :global(.ember-tooltip) { + word-break: break-all; + } + @media only screen and (max-width: 550px) { grid-template-columns: auto; margin: 0 var(--space-s); @@ -212,6 +212,10 @@ } } +.edition { + margin-top: var(--space-2xs); +} + .bytes { font-variant-numeric: tabular-nums; text-transform: none; diff --git a/app/models/version.js b/app/models/version.js index 87b1c29a2ec..a49ab2b9369 100644 --- a/app/models/version.js +++ b/app/models/version.js @@ -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} */ @@ -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() { diff --git a/app/styles/application.module.css b/app/styles/application.module.css index d2f39be49bc..3a8d4b583d5 100644 --- a/app/styles/application.module.css +++ b/app/styles/application.module.css @@ -202,5 +202,6 @@ noscript { } :global(.ember-tooltip) { + max-width: 300px; font-weight: normal; }