mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 16:44:33 +00:00
Ignore can errors in glue tests
This commit is contained in:
parent
066474bfde
commit
1cffb3376e
2 changed files with 22 additions and 4 deletions
|
@ -12,8 +12,20 @@ use std::process;
|
||||||
use strum::IntoEnumIterator;
|
use strum::IntoEnumIterator;
|
||||||
use target_lexicon::Triple;
|
use target_lexicon::Triple;
|
||||||
|
|
||||||
|
pub struct IgnoreErrors {
|
||||||
|
pub can: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IgnoreErrors {
|
||||||
|
const NONE: Self = IgnoreErrors { can: false };
|
||||||
|
}
|
||||||
|
|
||||||
pub fn generate(input_path: &Path, output_path: &Path) -> io::Result<i32> {
|
pub fn generate(input_path: &Path, output_path: &Path) -> io::Result<i32> {
|
||||||
match load_types(input_path.to_path_buf(), Threading::AllAvailable) {
|
match load_types(
|
||||||
|
input_path.to_path_buf(),
|
||||||
|
Threading::AllAvailable,
|
||||||
|
IgnoreErrors::NONE,
|
||||||
|
) {
|
||||||
Ok(types_and_targets) => {
|
Ok(types_and_targets) => {
|
||||||
let mut file = File::create(output_path).unwrap_or_else(|err| {
|
let mut file = File::create(output_path).unwrap_or_else(|err| {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
|
@ -67,6 +79,7 @@ pub fn generate(input_path: &Path, output_path: &Path) -> io::Result<i32> {
|
||||||
pub fn load_types(
|
pub fn load_types(
|
||||||
full_file_path: PathBuf,
|
full_file_path: PathBuf,
|
||||||
threading: Threading,
|
threading: Threading,
|
||||||
|
ignore_errors: IgnoreErrors,
|
||||||
) -> Result<Vec<(Types, TargetInfo)>, io::Error> {
|
) -> Result<Vec<(Types, TargetInfo)>, io::Error> {
|
||||||
let target_info = (&Triple::host()).into();
|
let target_info = (&Triple::host()).into();
|
||||||
|
|
||||||
|
@ -108,7 +121,7 @@ pub fn load_types(
|
||||||
let can_problems = can_problems.remove(&home).unwrap_or_default();
|
let can_problems = can_problems.remove(&home).unwrap_or_default();
|
||||||
let type_problems = type_problems.remove(&home).unwrap_or_default();
|
let type_problems = type_problems.remove(&home).unwrap_or_default();
|
||||||
|
|
||||||
if !can_problems.is_empty() || !type_problems.is_empty() {
|
if (!ignore_errors.can && !can_problems.is_empty()) || !type_problems.is_empty() {
|
||||||
todo!(
|
todo!(
|
||||||
"Gracefully report compilation problems during glue generation: {:?}, {:?}",
|
"Gracefully report compilation problems during glue generation: {:?}, {:?}",
|
||||||
can_problems,
|
can_problems,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use roc_glue::load::load_types;
|
use roc_glue::load::{load_types, IgnoreErrors};
|
||||||
use roc_glue::rust_glue;
|
use roc_glue::rust_glue;
|
||||||
use roc_load::Threading;
|
use roc_load::Threading;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
@ -33,7 +33,12 @@ pub fn generate_bindings(decl_src: &str) -> String {
|
||||||
let mut file = File::create(file_path).unwrap();
|
let mut file = File::create(file_path).unwrap();
|
||||||
writeln!(file, "{}", &src).unwrap();
|
writeln!(file, "{}", &src).unwrap();
|
||||||
|
|
||||||
let result = load_types(full_file_path, Threading::Single);
|
let result = load_types(
|
||||||
|
full_file_path,
|
||||||
|
Threading::Single,
|
||||||
|
// required `nothing` is unused; that error is okay
|
||||||
|
IgnoreErrors { can: true },
|
||||||
|
);
|
||||||
|
|
||||||
dir.close().expect("Unable to close tempdir");
|
dir.close().expect("Unable to close tempdir");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue