From 9835e2ae736235810b4ea1c162ca5e65c547e770 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 04:49:50 +0200 Subject: Merging upstream version 1.71.1+dfsg1. Signed-off-by: Daniel Baumann --- vendor/syn/tests/test_precedence.rs | 68 +++++++++++++++---------------------- 1 file changed, 27 insertions(+), 41 deletions(-) (limited to 'vendor/syn/tests/test_precedence.rs') diff --git a/vendor/syn/tests/test_precedence.rs b/vendor/syn/tests/test_precedence.rs index e2931ff5a..b49577f0f 100644 --- a/vendor/syn/tests/test_precedence.rs +++ b/vendor/syn/tests/test_precedence.rs @@ -35,7 +35,6 @@ extern crate thin_vec; use crate::common::eq::SpanlessEq; use crate::common::parse; use quote::quote; -use rayon::iter::{IntoParallelIterator, ParallelIterator}; use regex::Regex; use rustc_ast::ast; use rustc_ast::ptr::P; @@ -45,7 +44,6 @@ use std::fs; use std::path::Path; use std::process; use std::sync::atomic::{AtomicUsize, Ordering}; -use walkdir::{DirEntry, WalkDir}; #[macro_use] mod macros; @@ -70,48 +68,36 @@ fn test_rustc_precedence() { // 2018 edition is hard let edition_regex = Regex::new(r"\b(async|try)[!(]").unwrap(); - WalkDir::new("tests/rust") - .sort_by(|a, b| a.file_name().cmp(b.file_name())) - .into_iter() - .filter_entry(repo::base_dir_filter) - .collect::, walkdir::Error>>() - .unwrap() - .into_par_iter() - .for_each(|entry| { - let path = entry.path(); - if path.is_dir() { - return; - } + repo::for_each_rust_file(|path| { + let content = fs::read_to_string(path).unwrap(); + let content = edition_regex.replace_all(&content, "_$0"); - let content = fs::read_to_string(path).unwrap(); - let content = edition_regex.replace_all(&content, "_$0"); - - let (l_passed, l_failed) = match syn::parse_file(&content) { - Ok(file) => { - let edition = repo::edition(path).parse().unwrap(); - let exprs = collect_exprs(file); - let (l_passed, l_failed) = test_expressions(path, edition, exprs); - errorf!( - "=== {}: {} passed | {} failed\n", - path.display(), - l_passed, - l_failed, - ); - (l_passed, l_failed) - } - Err(msg) => { - errorf!("\nFAIL {} - syn failed to parse: {}\n", path.display(), msg); - (0, 1) - } - }; + let (l_passed, l_failed) = match syn::parse_file(&content) { + Ok(file) => { + let edition = repo::edition(path).parse().unwrap(); + let exprs = collect_exprs(file); + let (l_passed, l_failed) = test_expressions(path, edition, exprs); + errorf!( + "=== {}: {} passed | {} failed\n", + path.display(), + l_passed, + l_failed, + ); + (l_passed, l_failed) + } + Err(msg) => { + errorf!("\nFAIL {} - syn failed to parse: {}\n", path.display(), msg); + (0, 1) + } + }; - passed.fetch_add(l_passed, Ordering::Relaxed); - let prev_failed = failed.fetch_add(l_failed, Ordering::Relaxed); + passed.fetch_add(l_passed, Ordering::Relaxed); + let prev_failed = failed.fetch_add(l_failed, Ordering::Relaxed); - if prev_failed + l_failed >= abort_after { - process::exit(1); - } - }); + if prev_failed + l_failed >= abort_after { + process::exit(1); + } + }); let passed = passed.load(Ordering::Relaxed); let failed = failed.load(Ordering::Relaxed); -- cgit v1.2.3