Skip to content

Commit

Permalink
Rewrite core-no-fp-fmt-parse in Rust
Browse files Browse the repository at this point in the history
Rewrite core-no-fp-fmt-parse in Rust

fix: missing import

fix: tidiness check

more tidy checks

remove tidy line length ignore
  • Loading branch information
Oneirical committed Mar 30, 2024
1 parent d748046 commit e473b04
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/tools/run-make-support/src/rustc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::env;
use std::path::Path;
use std::path::PathBuf;
use std::process::{Command, Output};

use crate::{handle_failed_output, tmp_dir};
Expand Down Expand Up @@ -104,6 +105,13 @@ impl Rustc {
self
}

/// Generic file path provider.
pub fn arg_path(&mut self, path: &[&str]) -> &mut Self {
let path_buf = path.iter().collect::<PathBuf>();
self.cmd.arg(path_buf.to_str().unwrap());
self
}

/// Generic command arguments provider. Use `.arg("-Zname")` over `.arg("-Z").arg("arg")`.
/// This method will panic if a plain `-Z` or `-C` is passed, or if `-Z <name>` or `-C <name>`
/// is passed (note the space).
Expand Down
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ run-make/compiler-rt-works-on-mingw/Makefile
run-make/compressed-debuginfo/Makefile
run-make/const-prop-lint/Makefile
run-make/const_fn_mir/Makefile
run-make/core-no-fp-fmt-parse/Makefile
run-make/core-no-oom-handling/Makefile
run-make/crate-data-smoke/Makefile
run-make/crate-hash-rustc-version/Makefile
Expand Down
4 changes: 0 additions & 4 deletions tests/run-make/core-no-fp-fmt-parse/Makefile

This file was deleted.

20 changes: 20 additions & 0 deletions tests/run-make/core-no-fp-fmt-parse/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This test checks that the core library of Rust can be compiled without enabling
// support for formatting and parsing floating-point numbers.

extern crate run_make_support;

use run_make_support::rustc;
use std::path::PathBuf;

fn main() {
rustc()
.arg("--edition")
.arg("2021")
.arg("-Dwarnings")
.arg("--crate-type")
.arg("rlib")
.arg_path(&["..", "..", "..", "library", "core", "src", "lib.rs"])
.arg("--cfg")
.arg("no_fp_fmt_parse")
.run();
}

0 comments on commit e473b04

Please sign in to comment.