File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,9 +118,12 @@ async function updateRustToolchain(tag: string) {
118118 if ( localMatch == null ) {
119119 throw new Error ( "Could not find channel in local rust-toolchain.toml." ) ;
120120 }
121+ // rust-toolchain.toml channels may be just "1.84" (no patch); pad to
122+ // MAJOR.MINOR.PATCH so @std /semver can parse it.
123+ const normalize = ( v : string ) => / ^ \d + \. \d + $ / . test ( v ) ? `${ v } .0` : v ;
121124 // only bump up; never downgrade. compare as semver so 1.95.0 > 1.91.0.
122- const local = semver . parse ( localMatch [ 1 ] ) ;
123- const upstream = semver . parse ( biomeRustVersion ) ;
125+ const local = semver . parse ( normalize ( localMatch [ 1 ] ) ) ;
126+ const upstream = semver . parse ( normalize ( biomeRustVersion ) ) ;
124127 if ( semver . greaterThan ( upstream , local ) ) {
125128 $ . log ( `Updating Rust toolchain: ${ localMatch [ 1 ] } -> ${ biomeRustVersion } ` ) ;
126129 toolchainPath . writeTextSync ( localContent . replace ( localMatch [ 0 ] , `channel = "${ biomeRustVersion } "` ) ) ;
You can’t perform that action at this time.
0 commit comments