@@ -21,7 +21,6 @@ static EXCLUDE_FILES: &[&str] = &[
2121 // https://github.com/rust-lang/rust/issues/113333
2222 "src/tools/clippy/tests/ui/needless_raw_string_hashes.rs" ,
2323 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0085_expr_literals.rs" ,
24- "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/0085_expr_literals.rs" ,
2524 "tests/ui/explicit-tail-calls/return-lifetime-sub.rs" ,
2625
2726 // TODO: non-lifetime binders: `where for<'a, T> &'a Struct<T>: Trait`
@@ -287,21 +286,38 @@ pub fn clone_rust() {
287286 if needs_clone {
288287 download_and_unpack ( ) . unwrap ( ) ;
289288 }
289+
290290 let mut missing = String :: new ( ) ;
291291 let test_src = Path :: new ( "tests/rust" ) ;
292+
293+ let mut exclude_files_set = BTreeSet :: new ( ) ;
292294 for exclude in EXCLUDE_FILES {
295+ if !exclude_files_set. insert ( exclude) {
296+ panic ! ( "duplicate path in EXCLUDE_FILES: {}" , exclude) ;
297+ }
298+ for dir in EXCLUDE_DIRS {
299+ if Path :: new ( exclude) . starts_with ( dir) {
300+ panic ! ( "excluded file {} is inside an excluded dir" , exclude) ;
301+ }
302+ }
293303 if !test_src. join ( exclude) . is_file ( ) {
294304 missing += "\n tests/rust/" ;
295305 missing += exclude;
296306 }
297307 }
308+
309+ let mut exclude_dirs_set = BTreeSet :: new ( ) ;
298310 for exclude in EXCLUDE_DIRS {
311+ if !exclude_dirs_set. insert ( exclude) {
312+ panic ! ( "duplicate path in EXCLUDE_DIRS: {}" , exclude) ;
313+ }
299314 if !test_src. join ( exclude) . is_dir ( ) {
300315 missing += "\n tests/rust/" ;
301316 missing += exclude;
302317 missing += "/" ;
303318 }
304319 }
320+
305321 if !missing. is_empty ( ) {
306322 panic ! ( "excluded test file does not exist:{}\n " , missing) ;
307323 }
0 commit comments