Skip to content

Commit

Permalink
Merge pull request #2758 from integer32llc/early-versions
Browse files Browse the repository at this point in the history
Hardcode special cases for versions 1.0-1.8
  • Loading branch information
rbtcollins authored May 7, 2021
2 parents d5b88b5 + 361a8f3 commit 5b8099d
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/dist/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,24 @@ impl FromStr for ParsedToolchainDesc {
}
}

// These versions don't have v2 manifests, but they don't have point releases either,
// so to make the two-part version numbers work for these versions, specially turn
// them into their corresponding ".0" version.
let channel = match c.get(1).unwrap().as_str() {
"1.0" => "1.0.0",
"1.1" => "1.1.0",
"1.2" => "1.2.0",
"1.3" => "1.3.0",
"1.4" => "1.4.0",
"1.5" => "1.5.0",
"1.6" => "1.6.0",
"1.7" => "1.7.0",
"1.8" => "1.8.0",
other => other,
};

Self {
channel: c.get(1).unwrap().as_str().to_owned(),
channel: channel.to_owned(),
date: c.get(2).map(|s| s.as_str()).and_then(fn_map),
target: c.get(3).map(|s| s.as_str()).and_then(fn_map),
}
Expand Down Expand Up @@ -1019,6 +1035,16 @@ mod tests {
"0.0.0-0000-00-00-any-other-thing",
("0.0.0", Some("0000-00-00"), Some("any-other-thing")),
),
// special hardcoded cases that only have v1 manifests
("1.0", ("1.0.0", None, None)),
("1.1", ("1.1.0", None, None)),
("1.2", ("1.2.0", None, None)),
("1.3", ("1.3.0", None, None)),
("1.4", ("1.4.0", None, None)),
("1.5", ("1.5.0", None, None)),
("1.6", ("1.6.0", None, None)),
("1.7", ("1.7.0", None, None)),
("1.8", ("1.8.0", None, None)),
];

for (input, (channel, date, target)) in success_cases {
Expand Down

0 comments on commit 5b8099d

Please sign in to comment.