Skip to content

Commit 55eba04

Browse files
authored
[v0.2] Fix feature detection with third-party rustc (#316)
1 parent 0393e2c commit 55eba04

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

build.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ fn main() {
2626

2727
// Treat nightly & dev compilers as the equivalent of the then-beta.
2828
// As features are never stabilized in patch versions, we can safely ignore it.
29-
let (effective_compiler_version, channel) = match rustc::triple() {
30-
Some((version, channel, _)) if channel.is_dev() => (version.to_mmp().1 - 2, channel),
31-
Some((version, channel, _)) if channel.is_nightly() => (version.to_mmp().1 - 1, channel),
32-
Some((version, channel, _)) => (version.to_mmp().1, channel),
33-
None => {
29+
let rustc_info = (rustc::Version::read(), rustc::Channel::read());
30+
let (effective_compiler_version, channel) = match rustc_info {
31+
(Some(version), Some(channel)) if channel.is_dev() => (version.to_mmp().1 - 2, channel),
32+
(Some(version), Some(channel)) if channel.is_nightly() => (version.to_mmp().1 - 1, channel),
33+
(Some(version), Some(channel)) => (version.to_mmp().1, channel),
34+
(None, _) | (_, None) => {
3435
warning!(
3536
"Unable to determine rustc version. Assuming rustc 1.{}.0.",
3637
MSRV

0 commit comments

Comments
 (0)