fn fetch_attrs(target: &str) -> Result<Vec<Cfg>> {
  let args = vec![format!("--target={}", target), "--print=cfg".to_owned()];

  let output = Command::new("rustc").args(&args).output()?;

  if !output.status.success() {
    panic!(
      "getting target attrs for {} failed with status: '{}' \nstdout: {}\nstderr: {}",
      target,
      output.status,
      String::from_utf8(output.stdout).unwrap_or_else(|_| "[unparseable bytes]".to_owned()),
      String::from_utf8(output.stderr).unwrap_or_else(|_| "[unparseable bytes]".to_owned())
    )
  }

  let attr_str =
    String::from_utf8(output.stdout).expect("successful run of rustc's output to be utf8");

  Ok(
    attr_str
      .lines()
      .map(Cfg::from_str)
      .map(|cfg| cfg.expect("attrs from rustc should be parsable into Cargo Cfg"))
      .collect(),
  )
}
/// Gets the proper system attributes for the provided platform triple using rustc.
Gets the proper system attributes for the provided platform triple using rustc.
Gets the proper system attributes for the provided platform triple using rustc .
fn fetch_attrs(target: &str) -> Result<Vec<Cfg>> {
  let args = vec![format!("--target={}", target), "--print=cfg".to_owned()];
  let output = Command::new("rustc").args(&args).output()?;
  if !output.status.success() {
    panic!(
      "getting target attrs for {} failed with status: '{}' \nstdout: {}\nstderr: {}",
      target,
      output.status,
      String::from_utf8(output.stdout).unwrap_or_else(|_| "[unparseable bytes]".to_owned()),
      String::from_utf8(output.stderr).unwrap_or_else(|_| "[unparseable bytes]".to_owned())
    )
  }
  let attr_str =
    String::from_utf8(output.stdout).expect("successful run of rustc's output to be utf8");
  Ok(
    attr_str
      .lines()
      .map(Cfg::from_str)
      .map(|cfg| cfg.expect("attrs from rustc should be parsable into Cargo Cfg"))
      .collect(),
  )
}
fn fetch_attrs ( target : & str ) -> Result < Vec < Cfg > > { let args = vec ! [ format ( " " target ) " " to_owned ( ) ] ; let output = Command :: new ( " " ) . args ( & args ) . output ( ) ? ; if ! output . status . success ( ) { panic ! ( " \n \n " target output status String from_utf8 ( output stdout ) unwrap_or_else ( " " to_owned ( ) ) String from_utf8 ( output stderr ) unwrap_or_else ( " " to_owned ( ) ) ) } let attr_str = String :: from_utf8 ( output . stdout ) . expect ( " " ) ; Ok ( attr_str . lines ( ) . map ( Cfg :: from_str ) . map ( | cfg | cfg . expect ( " " ) ) . collect ( ) , ) }
Gets the proper system attributes for the provided platform triple using rustc.
Gets the proper system attributes for the provided platform triple using rustc .
target
&str
target
&str