File: build.rs

package info (click to toggle)
rust-doc-comment 0.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 108 kB
  • sloc: makefile: 4
file content (24 lines) | stat: -rw-r--r-- 741 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use std::process::Command;

fn main() {
    if let Ok(v) = Command::new("rustc").arg("--version").output() {
        let s = match String::from_utf8(v.stdout) {
            Ok(s) => s,
            _ => return,
        };
        if !s.starts_with("rustc ") {
            return;
        }
        if let Some(s) = s.split(' ').skip(1).next() {
            let s = s.split('.').collect::<Vec<_>>();
            if s.len() < 3 {
                return;
            }
            if s[0] == "1" && u32::from_str_radix(&s[1], 10)
                                  .map(|nb| nb < 30)
                                  .unwrap_or_else(|_| false) {
                println!("cargo:rustc-cfg=feature=\"old_macros\"");
            }
        }
    }
}