Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/syn/tests/repo/mod.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / syn / tests / repo / mod.rs` 789 lines ยท 38843 bytes Raw Blame History 1 #![allow(clippy::manual_assert)] 2 3 mod progress; 4 5 use self::progress::Progress; 6 use anyhow::Result; 7 use flate2::read::GzDecoder; 8 use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; 9 use rayon::ThreadPoolBuilder; 10 use std::collections::BTreeSet; 11 use std::env; 12 use std::ffi::OsStr; 13 use std::fs; 14 use std::path::{Path, PathBuf}; 15 use tar::Archive; 16 use walkdir::{DirEntry, WalkDir}; 17 18 // nightly-2026-07-18 19 const REVISION: &str = "`b6839f4d0e2bd63b960bbff8619c6fdea27d81e5`"; 20 21 #[rustfmt::skip] 22 static EXCLUDE_FILES: &[&str] = &[ 23 // TODO: unsafe fields: `struct S { unsafe field: T }` 24 // https://github.com/dtolnay/syn/issues/1792 25 "src/tools/clippy/tests/ui/derive.rs", 26 "src/tools/clippy/tests/ui/doc_unsafe.rs", 27 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/record_field_list.rs", 28 "src/tools/rustfmt/tests/source/unsafe-field.rs", 29 "src/tools/rustfmt/tests/target/unsafe-field.rs", 30 "tests/ui/unsafe-binders/unsafe-binders-debuginfo.rs", 31 "tests/ui/unsafe-fields/auxiliary/unsafe-fields-crate-dep.rs", 32 33 // TODO: guard patterns: `match expr { (A if f()) | (B if g()) => {} }` 34 // https://github.com/dtolnay/syn/issues/1793 35 "src/tools/rustfmt/tests/target/guard_patterns.rs", 36 "tests/ui/lint/unused/unused_parens/parens-around-guard-patterns-not-unused.rs", 37 "tests/ui/pattern/rfc-3637-guard-patterns/liveness-ice-issue-146445.rs", 38 "tests/ui/pattern/rfc-3637-guard-patterns/only-gather-locals-once.rs", 39 "tests/ui/reachable/guard_read_for_never.rs", 40 41 // TODO: final associated functions: `final fn` 42 // https://github.com/dtolnay/syn/issues/1981 43 "library/core/src/clone.rs", 44 "library/core/src/io/size_hint.rs", 45 "src/tools/rustfmt/tests/target/final-kw.rs", 46 "tests/rustdoc-html/final-trait-method.rs", 47 "tests/ui/traits/final/dyn-compat.rs", 48 "tests/ui/traits/final/works.rs", 49 50 // TODO: return type notation: `where T: Trait` and `where T::method(..): Send` 51 // https://github.com/dtolnay/syn/issues/1434 52 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/return_type_syntax_in_path.rs", 53 "src/tools/rustfmt/tests/target/return-type-notation.rs", 54 "tests/rustdoc-html/jump-to-def/assoc-items-extra.rs", 55 "tests/rustdoc-html/return-type-notation.rs", 56 "tests/rustdoc-json/return-type-notation.rs", 57 "tests/ui/associated-type-bounds/all-generics-lookup.rs", 58 "tests/ui/associated-type-bounds/implied-from-self-where-clause.rs", 59 "tests/ui/associated-type-bounds/return-type-notation/basic.rs", 60 "tests/ui/associated-type-bounds/return-type-notation/higher-ranked-bound-works.rs", 61 "tests/ui/associated-type-bounds/return-type-notation/namespace-conflict.rs", 62 "tests/ui/associated-type-bounds/return-type-notation/path-constrained-in-method.rs", 63 "tests/ui/associated-type-bounds/return-type-notation/path-self-qself.rs", 64 "tests/ui/associated-type-bounds/return-type-notation/path-works.rs", 65 "tests/ui/associated-type-bounds/return-type-notation/trait-alias.rs", 66 "tests/ui/associated-type-bounds/return-type-notation/unpretty-parenthesized.rs", 67 "tests/ui/async-await/return-type-notation/issue-110963-late.rs", 68 "tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs", 69 "tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs", 70 "tests/ui/async-await/return-type-notation/super-method-bound.rs", 71 "tests/ui/async-await/return-type-notation/supertrait-bound.rs", 72 "tests/ui/borrowck/alias-liveness/rtn-static.rs", 73 "tests/ui/feature-gates/feature-gate-return_type_notation.rs", 74 75 // TODO: gen blocks and functions 76 // https://github.com/dtolnay/syn/issues/1526 77 "compiler/rustc_codegen_cranelift/example/gen_block_iterate.rs", 78 "compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs", 79 "compiler/rustc_metadata/src/rmeta/decoder.rs", 80 "compiler/rustc_middle/src/ty/closure.rs", 81 "compiler/rustc_middle/src/ty/context.rs", 82 "src/tools/clippy/tests/ui/infinite_loops.rs", 83 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/gen_blocks.rs", 84 "tests/ui/async-await/async-drop/assign-incompatible-types.rs", 85 "tests/ui/coroutine/async-gen-deduce-yield.rs", 86 "tests/ui/coroutine/async-gen-yield-ty-is-unit.rs", 87 "tests/ui/coroutine/async_gen_fn_iter.rs", 88 "tests/ui/coroutine/gen_block_is_fused_iter.rs", 89 "tests/ui/coroutine/gen_block_is_iter.rs", 90 "tests/ui/coroutine/gen_block_iterate.rs", 91 "tests/ui/coroutine/gen_fn_iter.rs", 92 "tests/ui/coroutine/gen_fn_lifetime_capture.rs", 93 "tests/ui/coroutine/other-attribute-on-gen.rs", 94 "tests/ui/coroutine/return-types-diverge.rs", 95 "tests/ui/higher-ranked/builtin-closure-like-bounds.rs", 96 "tests/ui/sanitizer/cfi/coroutine.rs", 97 98 // TODO: coroutines (static closure) 99 // https://github.com/dtolnay/syn/issues/2019 100 "src/tools/clippy/tests/ui/redundant_locals.rs", 101 "src/tools/miri/tests/fail/coroutine-pinned-moved.rs", 102 "src/tools/miri/tests/pass/stacked_borrows/coroutine-self-referential.rs", 103 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/lambda_expr.rs", 104 "src/tools/rustfmt/tests/source/async_block.rs", 105 "src/tools/rustfmt/tests/source/immovable_coroutines.rs", 106 "src/tools/rustfmt/tests/target/async_block.rs", 107 "src/tools/rustfmt/tests/target/immovable_coroutines.rs", 108 "tests/ui/coroutine/addassign-yield.rs", 109 "tests/ui/coroutine/drop-track-addassign-yield.rs", 110 "tests/ui/coroutine/drop-tracking-yielding-in-match-guards.rs", 111 "tests/ui/coroutine/issue-53548.rs", 112 "tests/ui/coroutine/issue-61442-stmt-expr-with-drop.rs", 113 "tests/ui/coroutine/pin-box-coroutine.rs", 114 "tests/ui/coroutine/size-moved-locals.rs", 115 "tests/ui/coroutine/static-coroutine.rs", 116 "tests/ui/coroutine/static-mut-reference-across-yield.rs", 117 "tests/ui/coroutine/static-reference-across-yield.rs", 118 "tests/ui/expr/weird-exprs.rs", 119 120 // TODO: `!` as a pattern 121 // https://github.com/dtolnay/syn/issues/1546 122 "tests/mir-opt/building/match/never_patterns.rs", 123 "tests/pretty/never-pattern.rs", 124 "tests/ui/reachable/never-pattern-closure-param-array.rs", 125 "tests/ui/rfcs/rfc-0000-never_patterns/always-read-in-closure-capture.rs", 126 "tests/ui/rfcs/rfc-0000-never_patterns/diverges.rs", 127 "tests/ui/rfcs/rfc-0000-never_patterns/use-bindings.rs", 128 129 // TODO: async trait bounds: `impl async Fn()` 130 // https://github.com/dtolnay/syn/issues/1628 131 "src/tools/miri/tests/pass/async-closure-captures.rs", 132 "src/tools/miri/tests/pass/async-closure-drop.rs", 133 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/async_trait_bound.rs", 134 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/for_binder_bound.rs", 135 "src/tools/rustfmt/tests/target/asyncness.rs", 136 "tests/coverage/async_closure.rs", 137 "tests/ui/async-await/async-closures/async-fn-mut-for-async-fn.rs", 138 "tests/ui/async-await/async-closures/async-fn-once-for-async-fn.rs", 139 "tests/ui/async-await/async-closures/auxiliary/foreign.rs", 140 "tests/ui/async-await/async-closures/body-check-on-non-fnmut.rs", 141 "tests/ui/async-await/async-closures/box-deref-in-debuginfo.rs", 142 "tests/ui/async-await/async-closures/brand.rs", 143 "tests/ui/async-await/async-closures/captures.rs", 144 "tests/ui/async-await/async-closures/clone-closure.rs", 145 "tests/ui/async-await/async-closures/constrained-but-no-upvars-yet.rs", 146 "tests/ui/async-await/async-closures/debuginfo-by-move-body.rs", 147 "tests/ui/async-await/async-closures/drop.rs", 148 "tests/ui/async-await/async-closures/force-move-due-to-inferred-kind.rs", 149 "tests/ui/async-await/async-closures/foreign.rs", 150 "tests/ui/async-await/async-closures/inline-body.rs", 151 "tests/ui/async-await/async-closures/mangle.rs", 152 "tests/ui/async-await/async-closures/moro-example.rs", 153 "tests/ui/async-await/async-closures/move-is-async-fn.rs", 154 "tests/ui/async-await/async-closures/mut-ref-reborrow.rs", 155 "tests/ui/async-await/async-closures/no-borrow-from-env.rs", 156 "tests/ui/async-await/async-closures/non-copy-arg-does-not-force-inner-move.rs", 157 "tests/ui/async-await/async-closures/overlapping-projs.rs", 158 "tests/ui/async-await/async-closures/precise-captures.rs", 159 "tests/ui/async-await/async-closures/refd.rs", 160 "tests/ui/async-await/async-closures/signature-deduction.rs", 161 "tests/ui/async-await/async-fn/edition-2015-not-async-bound.rs", 162 "tests/ui/async-await/async-fn/higher-ranked-async-fn.rs", 163 "tests/ui/async-await/async-fn/impl-trait.rs", 164 "tests/ui/async-await/async-fn/project.rs", 165 "tests/ui/async-await/async-fn/sugar.rs", 166 167 // TODO: mutable by-reference bindings (mut ref) 168 // https://github.com/dtolnay/syn/issues/1629 169 "src/tools/rustfmt/tests/source/mut_ref.rs", 170 "src/tools/rustfmt/tests/target/mut_ref.rs", 171 "tests/ui/mut/mut-ref.rs", 172 173 // TODO: postfix match 174 // https://github.com/dtolnay/syn/issues/1630 175 "src/tools/clippy/tests/ui/unnecessary_semicolon.rs", 176 "src/tools/rustfmt/tests/source/postfix-match/pf-match.rs", 177 "src/tools/rustfmt/tests/target/postfix-match/pf-match.rs", 178 "tests/pretty/postfix-match/simple-matches.rs", 179 "tests/ui/match/postfix-match/no-unused-parens.rs", 180 "tests/ui/match/postfix-match/pf-match-chain.rs", 181 "tests/ui/match/postfix-match/postfix-match.rs", 182 183 // TODO: postfix yield 184 // https://github.com/dtolnay/syn/issues/1890 185 "tests/pretty/postfix-yield.rs", 186 "tests/ui/coroutine/postfix-yield.rs", 187 188 // TODO: delegation: `reuse Trait::bar { Box::new(self.0) }` 189 // https://github.com/dtolnay/syn/issues/1580 190 "src/tools/rustfmt/tests/target/issue_6513.rs", 191 "tests/incremental/delegation-ice-155729.rs", 192 "tests/pretty/delegation/delegation.rs", 193 "tests/pretty/delegation/generics.rs", 194 "tests/pretty/delegation/impl-reuse.rs", 195 "tests/pretty/delegation/inherit-attributes.rs", 196 "tests/pretty/delegation/inline-attribute.rs", 197 "tests/pretty/delegation/self-mapping-output.rs", 198 "tests/pretty/delegation/self-rename.rs", 199 "tests/pretty/hir-delegation.rs", 200 "tests/rustdoc-html/async/async-fn-delegation.rs", 201 "tests/ui/delegation/auxiliary/recursive-delegation-aux.rs", 202 "tests/ui/delegation/body-identity-glob.rs", 203 "tests/ui/delegation/body-identity-list.rs", 204 "tests/ui/delegation/explicit-paths-in-traits-pass.rs", 205 "tests/ui/delegation/explicit-paths-pass.rs", 206 "tests/ui/delegation/explicit-paths-signature-pass.rs", 207 "tests/ui/delegation/fn-header.rs", 208 "tests/ui/delegation/generics/const-type-ice-154334.rs", 209 "tests/ui/delegation/generics/free-fn-to-free-fn-pass.rs", 210 "tests/ui/delegation/generics/free-fn-to-trait-method-pass.rs", 211 "tests/ui/delegation/generics/generics-aux-pass.rs", 212 "tests/ui/delegation/generics/impl-to-free-fn-pass.rs", 213 "tests/ui/delegation/generics/impl-trait-to-trait-method-pass.rs", 214 "tests/ui/delegation/generics/inherent-impl-to-trait-method-pass.rs", 215 "tests/ui/delegation/generics/mapping/free-to-free-pass.rs", 216 "tests/ui/delegation/generics/mapping/free-to-trait-pass.rs", 217 "tests/ui/delegation/generics/mapping/impl-trait-to-free-pass.rs", 218 "tests/ui/delegation/generics/mapping/impl-trait-to-trait-pass.rs", 219 "tests/ui/delegation/generics/mapping/inherent-impl-to-free-pass.rs", 220 "tests/ui/delegation/generics/mapping/inherent-impl-to-trait-pass.rs", 221 "tests/ui/delegation/generics/mapping/trait-to-free-pass.rs", 222 "tests/ui/delegation/generics/mapping/trait-to-trait-pass.rs", 223 "tests/ui/delegation/generics/self-rename.rs", 224 "tests/ui/delegation/generics/stability-implications-non-local-defid.rs", 225 "tests/ui/delegation/generics/synth-params-ice-154780.rs", 226 "tests/ui/delegation/generics/trait-method-to-other-pass.rs", 227 "tests/ui/delegation/generics/unelided-lifetime-in-sig-ice-156848.rs", 228 "tests/ui/delegation/glob-glob.rs", 229 "tests/ui/delegation/glob-override.rs", 230 "tests/ui/delegation/glob.rs", 231 "tests/ui/delegation/impl-reuse-pass.rs", 232 "tests/ui/delegation/impl-trait.rs", 233 "tests/ui/delegation/list.rs", 234 "tests/ui/delegation/macro-inside-glob.rs", 235 "tests/ui/delegation/macro-inside-list.rs", 236 "tests/ui/delegation/method-call-priority.rs", 237 "tests/ui/delegation/parse.rs", 238 "tests/ui/delegation/recursive-delegation-pass.rs", 239 "tests/ui/delegation/rename.rs", 240 "tests/ui/delegation/self-coercion.rs", 241 "tests/ui/delegation/self-mapping-arguments.rs", 242 "tests/ui/delegation/target-expression-removal-pass.rs", 243 244 // TODO: for await 245 // https://github.com/dtolnay/syn/issues/1631 246 "tests/ui/async-await/for-await-2015.rs", 247 "tests/ui/async-await/for-await-passthrough.rs", 248 "tests/ui/async-await/for-await.rs", 249 250 // TODO: unparenthesized half-open range pattern inside slice pattern: `[1..]` 251 // https://github.com/dtolnay/syn/issues/1769 252 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/range_pat.rs", 253 "tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs", 254 255 // TODO: pinned type sugar: `&pin const Self` 256 // https://github.com/dtolnay/syn/issues/1770 257 "src/tools/rustfmt/tests/source/pin_sugar.rs", 258 "src/tools/rustfmt/tests/target/pin_sugar.rs", 259 "tests/pretty/pin-ergonomics-hir.rs", 260 "tests/pretty/pin-ergonomics.rs", 261 "tests/ui/pin-ergonomics/borrow.rs", 262 "tests/ui/pin-ergonomics/pin-coercion.rs", 263 "tests/ui/pin-ergonomics/pinned-drop-sugar-no-core.rs", 264 "tests/ui/pin-ergonomics/pinned-drop-sugar.rs", 265 "tests/ui/pin-ergonomics/pinned-drop.rs", 266 "tests/ui/pin-ergonomics/sugar-self.rs", 267 "tests/ui/pin-ergonomics/sugar.rs", 268 "tests/ui/pin-ergonomics/user-type-projection.rs", 269 270 // TODO: super let 271 // https://github.com/dtolnay/syn/issues/1889 272 "library/std/src/macros/tests.rs", 273 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/let_stmt.rs", 274 "tests/ui/drop/if-let-super-let.rs", 275 "tests/ui/drop/super-let-tail-expr-drop-order.rs", 276 277 // TODO: "ergonomic clones": `f(obj.use)`, `thread::spawn(use || f(obj))`, `async use` 278 // https://github.com/dtolnay/syn/issues/1802 279 "src/tools/clippy/tests/ui/redundant_closure_call_early.rs", 280 "src/tools/clippy/tests/ui/redundant_closure_call_fixable.rs", 281 "src/tools/rustfmt/tests/source/ergonomic_clones.rs", 282 "src/tools/rustfmt/tests/target/ergonomic_clones.rs", 283 "tests/codegen-llvm/ergonomic-clones/closure.rs", 284 "tests/mir-opt/ergonomic-clones/closure.rs", 285 "tests/ui/ergonomic-clones/async/basic.rs", 286 "tests/ui/ergonomic-clones/closure/basic.rs", 287 "tests/ui/ergonomic-clones/closure/const-closure.rs", 288 "tests/ui/ergonomic-clones/closure/mutation.rs", 289 "tests/ui/ergonomic-clones/closure/nested.rs", 290 "tests/ui/ergonomic-clones/closure/once-move-out-on-heap.rs", 291 "tests/ui/ergonomic-clones/closure/with-binders.rs", 292 "tests/ui/ergonomic-clones/dotuse/basic.rs", 293 "tests/ui/ergonomic-clones/dotuse/block.rs", 294 295 // TODO: move expression 296 // https://github.com/dtolnay/syn/issues/1983 297 "tests/ui/move-expr/borrow-only.rs", 298 "tests/ui/move-expr/copy-type.rs", 299 "tests/ui/move-expr/name-resolution.rs", 300 "tests/ui/move-expr/nested-closures.rs", 301 "tests/ui/move-expr/nested-move-expr.rs", 302 "tests/ui/move-expr/parse-ambiguity.rs", 303 "tests/ui/move-expr/plain-closure.rs", 304 305 // TODO: contracts 306 // https://github.com/dtolnay/syn/issues/1892 307 "tests/ui/contracts/internal_machinery/contract-ast-extensions-nest.rs", 308 "tests/ui/contracts/internal_machinery/contract-ast-extensions-tail.rs", 309 "tests/ui/contracts/internal_machinery/contracts-lowering-ensures-is-not-inherited-when-nesting.rs", 310 "tests/ui/contracts/internal_machinery/contracts-lowering-requires-is-not-inherited-when-nesting.rs", 311 312 // TODO: frontmatter 313 // https://github.com/dtolnay/syn/issues/1893 314 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/frontmatter.rs", 315 "src/tools/rustfmt/tests/source/frontmatter_compact.rs", 316 "src/tools/rustfmt/tests/source/frontmatter_escaped.rs", 317 "src/tools/rustfmt/tests/source/frontmatter_spaced.rs", 318 "src/tools/rustfmt/tests/target/frontmatter_compact.rs", 319 "src/tools/rustfmt/tests/target/frontmatter_escaped.rs", 320 "src/tools/rustfmt/tests/target/frontmatter_spaced.rs", 321 "tests/rustdoc-html/source-code-pages/frontmatter.rs", 322 "tests/ui/frontmatter/auxiliary/expr.rs", 323 "tests/ui/frontmatter/auxiliary/lib.rs", 324 "tests/ui/frontmatter/content-contains-whitespace.rs", 325 "tests/ui/frontmatter/content-non-lexible-tokens.rs", 326 "tests/ui/frontmatter/escape-hyphens-leading.rs", 327 "tests/ui/frontmatter/escape-hyphens-nonleading-1.rs", 328 "tests/ui/frontmatter/escape-hyphens-nonleading-2.rs", 329 "tests/ui/frontmatter/escape-hyphens-nonleading-3.rs", 330 "tests/ui/frontmatter/fence-whitespace-trailing-1.rs", 331 "tests/ui/frontmatter/fence-whitespace-trailing-2.rs", 332 "tests/ui/frontmatter/frontmatter-crlf.rs", 333 "tests/ui/frontmatter/infostring-dot-nonleading.rs", 334 "tests/ui/frontmatter/infostring-hyphen-nonleading.rs", 335 "tests/ui/frontmatter/location-after-shebang.rs", 336 "tests/ui/include-macros/auxiliary/shebang-expr.rs", 337 "tests/ui/unpretty/frontmatter.rs", 338 339 // TODO: `type const` associated items 340 // https://github.com/dtolnay/syn/issues/1984 341 "src/tools/clippy/tests/ui/crashes/mgca-16691.rs", 342 "src/tools/clippy/tests/ui/trait_duplication_in_bounds_assoc_const_eq.rs", 343 "src/tools/rustfmt/tests/source/direct_const_arg.rs", 344 "src/tools/rustfmt/tests/target/direct_const_arg.rs", 345 "tests/debuginfo/associated-const-bindings.rs", 346 "tests/rustdoc-html/constant/ice-associated-const-equality-105952.rs", 347 "tests/rustdoc-html/inline_cross/auxiliary/assoc-const-equality.rs", 348 "tests/rustdoc-html/type-const-associated-const-no-body.rs", 349 "tests/rustdoc-html/type-const-free-in-array.rs", 350 "tests/rustdoc-html/type-const-inherent-with-body.rs", 351 "tests/ui/associated-consts/issue-110933.rs", 352 "tests/ui/associated-consts/type-const-in-array-len.rs", 353 "tests/ui/associated-type-bounds/duplicate-bound.rs", 354 "tests/ui/const-generics/associated-const-bindings/assoc-const.rs", 355 "tests/ui/const-generics/associated-const-bindings/bound-var-in-ty.rs", 356 "tests/ui/const-generics/associated-const-bindings/coexisting-with-type-binding.rs", 357 "tests/ui/const-generics/associated-const-bindings/const_evaluatable_unchecked.rs", 358 "tests/ui/const-generics/associated-const-bindings/dyn-compat-basic.rs", 359 "tests/ui/const-generics/associated-const-bindings/dyn-compat-self-const-projections-in-methods.rs", 360 "tests/ui/const-generics/associated-const-bindings/dyn-const-projection-escaping-bound-vars.rs", 361 "tests/ui/const-generics/associated-const-bindings/equality-unused-issue-126729.rs", 362 "tests/ui/const-generics/associated-const-bindings/equality_bound_with_infer.rs", 363 "tests/ui/const-generics/associated-const-bindings/normalization-via-param-env.rs", 364 "tests/ui/const-generics/associated-const-bindings/supertraits.rs", 365 "tests/ui/const-generics/gca/basic-different-definitions.rs", 366 "tests/ui/const-generics/gca/basic.rs", 367 "tests/ui/const-generics/generic_const_exprs/auxiliary/non_local_type_const.rs", 368 "tests/ui/const-generics/mgca/adt_expr_infers_from_value.rs", 369 "tests/ui/const-generics/mgca/array-expr-with-assoc-const.rs", 370 "tests/ui/const-generics/mgca/assoc-const-projection-in-bound.rs", 371 "tests/ui/const-generics/mgca/assoc-const.rs", 372 "tests/ui/const-generics/mgca/concrete-expr-with-generics-in-env.rs", 373 "tests/ui/const-generics/mgca/explicit_anon_consts_literals_hack.rs", 374 "tests/ui/const-generics/mgca/generic-args-on-enum-variant-segments.rs", 375 "tests/ui/const-generics/mgca/multi_braced_direct_const_args.rs", 376 "tests/ui/const-generics/mgca/tuple_ctor_arg_simple.rs", 377 "tests/ui/const-generics/mgca/tuple_expr_arg_simple.rs", 378 "tests/ui/const-generics/mgca/type-const-ctor-148953.rs", 379 "tests/ui/const-generics/mgca/type-const-used-in-trait.rs", 380 "tests/ui/const-generics/mgca/type_const-array-return.rs", 381 "tests/ui/const-generics/mgca/type_const-incemental-compile.rs", 382 "tests/ui/const-generics/mgca/type_const-pub.rs", 383 "tests/ui/const-generics/mgca/type_const-use.rs", 384 "tests/ui/const-generics/mgca/type_const_in_pattern.rs", 385 "tests/ui/generic-const-items/assoc-const-bindings.rs", 386 "tests/ui/generic-const-items/type-const-nested-assoc-const.rs", 387 "tests/ui/sanitizer/cfi/assoc-const-projection-issue-151878.rs", 388 "tests/ui/supertrait-shadowing/assoc-const.rs", 389 "tests/ui/supertrait-shadowing/out-of-scope.rs", 390 "tests/ui/supertrait-shadowing/type-dependent.rs", 391 392 // TODO: const block in path argument: `T: Trait` 393 // https://github.com/dtolnay/syn/issues/1985 394 "tests/ui/const-generics/mgca/higher-ranked-lts-good.rs", 395 "tests/ui/traits/associated_type_bound/generic-const-args-default.rs", 396 397 // TODO: item-level const blocks 398 // https://github.com/dtolnay/syn/issues/1986 399 "src/tools/rustfmt/tests/source/const-block-items.rs", 400 "src/tools/rustfmt/tests/target/const-block-items.rs", 401 "tests/ui/consts/const-block-items/assert-pass.rs", 402 "tests/ui/consts/const-block-items/hir.rs", 403 "tests/ui/parser/const-block-items/attrs.rs", 404 "tests/ui/parser/const-block-items/mod-in-fn.rs", 405 "tests/ui/parser/const-block-items/pub.rs", 406 407 // TODO: mut-restricted fields 408 // https://github.com/dtolnay/syn/issues/1987 409 "src/tools/rustfmt/tests/source/mut-restriction.rs", 410 "src/tools/rustfmt/tests/target/mut-restriction.rs", 411 "tests/pretty/hir-mut-restriction.rs", 412 "tests/ui/mut-restriction/auxiliary/external-mut-restriction.rs", 413 414 // TODO: heterogeneous try-blocks: `try bikeshed Option<_>` 415 // https://github.com/dtolnay/syn/issues/1988 416 "src/tools/rustfmt/tests/source/try_blocks_heterogeneous.rs", 417 "src/tools/rustfmt/tests/target/try_blocks_heterogeneous.rs", 418 "tests/pretty/try-blocks.rs", 419 "tests/ui/try-block/try-block-heterogeneous.rs", 420 421 // TODO: `|| .. .method()` 422 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/closure_range_method_call.rs", 423 "src/tools/rustfmt/tests/source/issue-4808.rs", 424 425 // Compile-fail expr parameter in const generic position: `f::<1 + 2>()` 426 "tests/ui/const-generics/early/closing-args-token.rs", 427 "tests/ui/const-generics/early/const-expression-parameter.rs", 428 429 // Compile-fail variadics in not the last position of a function parameter list 430 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/fn_def_param.rs", 431 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/param_list_vararg.rs", 432 "tests/ui/parser/variadic-ffi-syntactic-pass.rs", 433 434 // Need at least one trait in impl Trait, no such type as impl 'static 435 "tests/ui/type-alias-impl-trait/generic_type_does_not_live_long_enough.rs", 436 437 // Negative polarity trait bound: `where T: !Copy` 438 "src/tools/rustfmt/tests/target/negative-bounds.rs", 439 "tests/ui/traits/negative-bounds/supertrait.rs", 440 441 // Outdated const impl syntax: `impl const Trait for Type` 442 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/impl_item_const.rs", 443 "src/tools/rust-analyzer/crates/test-utils/src/minicore.rs", 444 445 // Const impl that is not a trait impl: `impl ~const T {}` 446 "tests/ui/traits/const-traits/syntax.rs", 447 448 // Lifetimes and types out of order in angle bracketed path arguments 449 "tests/ui/parser/constraints-before-generic-args-syntactic-pass.rs", 450 451 // Deprecated anonymous parameter syntax in traits 452 "src/tools/rustfmt/tests/source/trait.rs", 453 "src/tools/rustfmt/tests/target/trait.rs", 454 "tests/pretty/hir-fn-params.rs", 455 "tests/rustdoc-html/anon-fn-params.rs", 456 "tests/rustdoc-html/auxiliary/ext-anon-fn-params.rs", 457 "tests/ui/anon-params/anon-params-trait-method-multiple.rs", 458 "tests/ui/fn/anonymous-parameters-trait-13105.rs", 459 "tests/ui/proc-macro/trait-fn-args-2015.rs", 460 "tests/ui/trait-bounds/anonymous-parameters-13775.rs", 461 462 // Deprecated where-clause location 463 "src/tools/rustfmt/tests/source/issue_4257.rs", 464 "src/tools/rustfmt/tests/source/issue_4911.rs", 465 "src/tools/rustfmt/tests/target/issue_4257.rs", 466 "src/tools/rustfmt/tests/target/issue_4911.rs", 467 "tests/pretty/gat-bounds.rs", 468 "tests/ui/where-clauses/cfg-attr-issue-138010-1.rs", 469 470 // Dual where-clauses on the same type alias. 471 "src/tools/rustfmt/tests/source/type-alias-where-clauses-with-comments.rs", 472 "src/tools/rustfmt/tests/source/type-alias-where-clauses.rs", 473 "src/tools/rustfmt/tests/target/type-alias-where-clauses-with-comments.rs", 474 "src/tools/rustfmt/tests/target/type-alias-where-clauses.rs", 475 476 // Deprecated trait object syntax with parenthesized generic arguments and no dyn keyword 477 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/path_fn_trait_args.rs", 478 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/typepathfn_with_coloncolon.rs", 479 "src/tools/rustfmt/tests/source/attrib.rs", 480 "src/tools/rustfmt/tests/source/closure.rs", 481 "src/tools/rustfmt/tests/source/existential_type.rs", 482 "src/tools/rustfmt/tests/source/fn-simple.rs", 483 "src/tools/rustfmt/tests/source/fn_args_layout-vertical.rs", 484 "src/tools/rustfmt/tests/source/issue-4689/one.rs", 485 "src/tools/rustfmt/tests/source/issue-4689/two.rs", 486 "src/tools/rustfmt/tests/source/paths.rs", 487 "src/tools/rustfmt/tests/source/structs.rs", 488 "src/tools/rustfmt/tests/target/attrib.rs", 489 "src/tools/rustfmt/tests/target/closure.rs", 490 "src/tools/rustfmt/tests/target/existential_type.rs", 491 "src/tools/rustfmt/tests/target/fn-simple.rs", 492 "src/tools/rustfmt/tests/target/fn.rs", 493 "src/tools/rustfmt/tests/target/fn_args_layout-vertical.rs", 494 "src/tools/rustfmt/tests/target/issue-4689/one.rs", 495 "src/tools/rustfmt/tests/target/issue-4689/two.rs", 496 "src/tools/rustfmt/tests/target/paths.rs", 497 "src/tools/rustfmt/tests/target/structs.rs", 498 "tests/codegen-units/item-collection/non-generic-closures.rs", 499 "tests/debuginfo/recursive-enum.rs", 500 "tests/pretty/closure-reform-pretty.rs", 501 "tests/run-make/reproducible-build-2/reproducible-build.rs", 502 "tests/run-make/reproducible-build/reproducible-build.rs", 503 "tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.rs", 504 "tests/ui/lifetimes/auxiliary/lifetime_bound_will_change_warning_lib.rs", 505 "tests/ui/lifetimes/bare-trait-object-borrowck.rs", 506 "tests/ui/lifetimes/bare-trait-object.rs", 507 "tests/ui/parser/bounds-obj-parens.rs", 508 509 // Various extensions to Rust syntax made up by rust-analyzer 510 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/asm_piece_attr.rs", 511 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/assoc_type_bound.rs", 512 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/const_param_default_path.rs", 513 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/deref_pat.rs", 514 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/field_expr.rs", 515 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/generic_arg_bounds.rs", 516 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/global_asm.rs", 517 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/include_bytes.rs", 518 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/not_null_pat.rs", 519 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/pattern_type.rs", 520 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/question_for_type_trait_bound.rs", 521 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/record_mut_restrictions_after.rs", 522 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/record_mut_restrictions_before.rs", 523 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/ref_expr.rs", 524 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/try_block_expr.rs", 525 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/tuple_mut_restrictions.rs", 526 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/type_const.rs", 527 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/use_tree_abs_star.rs", 528 "src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0015_use_tree.rs", 529 "src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0019_enums.rs", 530 "src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0029_range_forms.rs", 531 "src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0051_parameter_attrs.rs", 532 "src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0055_dot_dot_dot.rs", 533 "src/tools/rust-analyzer/crates/parser/test_data/parser/ok/0068_item_modifiers.rs", 534 "src/tools/rust-analyzer/crates/syntax/test_data/parser/validation/0031_block_inner_attrs.rs", 535 "src/tools/rust-analyzer/crates/syntax/test_data/parser/validation/0038_endless_inclusive_range.rs", 536 "src/tools/rust-analyzer/crates/syntax/test_data/parser/validation/0045_ambiguous_trait_object.rs", 537 "src/tools/rust-analyzer/crates/syntax/test_data/parser/validation/0046_mutable_const_item.rs", 538 "src/tools/rust-analyzer/crates/syntax/test_data/parser/validation/0224_dangling_dyn.rs", 539 "src/tools/rust-analyzer/crates/syntax/test_data/parser/validation/0261_dangling_impl_undeclared_lifetime.rs", 540 "src/tools/rust-analyzer/crates/syntax/test_data/parser/validation/dangling_impl.rs", 541 "src/tools/rust-analyzer/crates/syntax/test_data/parser/validation/dangling_impl_reference.rs", 542 "src/tools/rust-analyzer/crates/syntax/test_data/parser/validation/impl_trait_lifetime_only.rs", 543 544 // Placeholder syntax for "throw expressions" 545 "compiler/rustc_expand/src/module.rs", 546 "compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs", 547 "src/tools/clippy/tests/ui/needless_return.rs", 548 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/yeet_expr.rs", 549 "tests/pretty/yeet-expr.rs", 550 "tests/ui/contracts/contracts-ensures-early-fn-exit.rs", 551 "tests/ui/try-trait/yeet-for-option.rs", 552 "tests/ui/try-trait/yeet-for-result.rs", 553 554 // Edition 2015 code using identifiers that are now keywords 555 // TODO: some of these we should probably parse 556 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/ok/dyn_trait_type_weak.rs", 557 "src/tools/rustfmt/tests/source/configs/indent_style/block_call.rs", 558 "src/tools/rustfmt/tests/source/configs/use_try_shorthand/false.rs", 559 "src/tools/rustfmt/tests/source/configs/use_try_shorthand/true.rs", 560 "src/tools/rustfmt/tests/source/issue_1306.rs", 561 "src/tools/rustfmt/tests/source/try-conversion.rs", 562 "src/tools/rustfmt/tests/target/configs/indent_style/block_call.rs", 563 "src/tools/rustfmt/tests/target/configs/use_try_shorthand/false.rs", 564 "src/tools/rustfmt/tests/target/issue-1681.rs", 565 "src/tools/rustfmt/tests/target/issue_1306.rs", 566 "tests/ui/dyn-keyword/dyn-2015-no-warnings-without-lints.rs", 567 "tests/ui/editions/edition-keywords-2015-2015.rs", 568 "tests/ui/editions/edition-keywords-2015-2018.rs", 569 "tests/ui/lint/keyword-idents/auxiliary/multi_file_submod.rs", 570 "tests/ui/lint/lint_pre_expansion_extern_module_aux.rs", 571 "tests/ui/macros/macro-comma-support-rpass.rs", 572 "tests/ui/macros/try-macro.rs", 573 "tests/ui/parser/extern-crate-async.rs", 574 "tests/ui/try-block/try-is-identifier-edition2015.rs", 575 576 // Excessive nesting 577 "tests/ui/expr/if/expr-stack-overflow.rs", 578 579 // Testing tools on invalid syntax 580 "src/tools/clippy/tests/ui/non_expressive_names_error_recovery.rs", 581 "src/tools/rustfmt/tests/coverage/target/comments.rs", 582 "src/tools/rustfmt/tests/parser/issue-4126/invalid.rs", 583 "src/tools/rustfmt/tests/parser/issue_4418.rs", 584 "src/tools/rustfmt/tests/parser/stashed-diag.rs", 585 "src/tools/rustfmt/tests/parser/stashed-diag2.rs", 586 "src/tools/rustfmt/tests/parser/unclosed-delims/issue_4466.rs", 587 "src/tools/rustfmt/tests/source/configs/disable_all_formatting/true.rs", 588 "src/tools/rustfmt/tests/source/configs/spaces_around_ranges/false.rs", 589 "src/tools/rustfmt/tests/source/configs/spaces_around_ranges/true.rs", 590 "src/tools/rustfmt/tests/source/impls.rs", 591 "src/tools/rustfmt/tests/source/type.rs", 592 "src/tools/rustfmt/tests/target/configs/spaces_around_ranges/false.rs", 593 "src/tools/rustfmt/tests/target/configs/spaces_around_ranges/true.rs", 594 "src/tools/rustfmt/tests/target/impl.rs", 595 "src/tools/rustfmt/tests/target/impls.rs", 596 "src/tools/rustfmt/tests/target/type.rs", 597 "src/tools/rustfmt/tests/target/unsafe_extern_blocks.rs", 598 "tests/ui/generics/issue-94432-garbage-ice.rs", 599 600 // Not actually test cases 601 "tests/ui/lint/expansion-time-include.rs", 602 "tests/ui/macros/auxiliary/macro-comma-support.rs", 603 "tests/ui/macros/auxiliary/macro-include-items-expr.rs", 604 "tests/ui/macros/include-single-expr-helper.rs", 605 "tests/ui/macros/include-single-expr-helper-1.rs", 606 "tests/ui/parser/issues/auxiliary/issue-21146-inc.rs", 607 ]; 608 609 #[rustfmt::skip] 610 static EXCLUDE_DIRS: &[&str] = &[ 611 // Inputs that intentionally do not parse 612 "src/tools/rust-analyzer/crates/parser/test_data/parser/err", 613 "src/tools/rust-analyzer/crates/parser/test_data/parser/inline/err", 614 615 // Inputs that lex but do not necessarily parse 616 "src/tools/rust-analyzer/crates/parser/test_data/lexer", 617 618 // Inputs that used to crash rust-analyzer, but aren't necessarily supposed to parse 619 "src/tools/rust-analyzer/crates/syntax/test_data/parser/fuzz-failures", 620 "src/tools/rust-analyzer/crates/syntax/test_data/reparse/fuzz-failures", 621 622 // Inputs that crash rustc, making no claim about whether they are valid Rust 623 "tests/crashes", 624 ]; 625 626 // Directories in which a .stderr implies the corresponding .rs is not expected 627 // to work. 628 static UI_TEST_DIRS: &[&str] = &["tests/ui", "tests/rustdoc-ui"]; 629 630 pub fn for_each_rust_file(for_each: impl Fn(&Path) + Sync + Send) { 631 let mut rs_files = BTreeSet::new(); 632 633 let repo_dir = Path::new("tests/rust"); 634 for entry in WalkDir::new(repo_dir) 635 .into_iter() 636 .filter_entry(base_dir_filter) 637 { 638 let entry = entry.unwrap(); 639 if !entry.file_type().is_dir() { 640 rs_files.insert(entry.into_path()); 641 } 642 } 643 644 for ui_test_dir in UI_TEST_DIRS { 645 for entry in WalkDir::new(repo_dir.join(ui_test_dir)) { 646 let mut path = entry.unwrap().into_path(); 647 if path.extension() == Some(OsStr::new("stderr")) { 648 loop { 649 rs_files.remove(&path.with_extension("rs")); 650 path = path.with_extension(""); 651 if path.extension().is_none() { 652 break; 653 } 654 } 655 } 656 } 657 } 658 659 rs_files.par_iter().map(PathBuf::as_path).for_each(for_each); 660 } 661 662 pub fn base_dir_filter(entry: &DirEntry) -> bool { 663 let path = entry.path(); 664 665 let mut path_string = path.to_string_lossy(); 666 if cfg!(windows) { 667 path_string = path_string.replace('\\', "/").into(); 668 } 669 let path_string = if path_string == "tests/rust" { 670 return true; 671 } else if let Some(path) = path_string.strip_prefix("tests/rust/") { 672 path 673 } else { 674 panic!("unexpected path in Rust dist: {}", path_string); 675 }; 676 677 if path.is_dir() { 678 return !EXCLUDE_DIRS.contains(&path_string); 679 } 680 681 if path.extension() != Some(OsStr::new("rs")) { 682 return false; 683 } 684 685 !EXCLUDE_FILES.contains(&path_string) 686 } 687 688 #[allow(dead_code)] 689 pub fn edition(path: &Path) -> &'static str { 690 if path.ends_with("dyn-2015-no-warnings-without-lints.rs") { 691 "2015" 692 } else { 693 "2021" 694 } 695 } 696 697 #[allow(dead_code)] 698 pub fn abort_after() -> usize { 699 match env::var("ABORT_AFTER_FAILURE") { 700 Ok(s) => s.parse().expect("failed to parse ABORT_AFTER_FAILURE"), 701 Err(_) => usize::MAX, 702 } 703 } 704 705 pub fn rayon_init() { 706 let stack_size = match env::var("RUST_MIN_STACK") { 707 Ok(s) => s.parse().expect("failed to parse RUST_MIN_STACK"), 708 Err(_) => 1024 * 1024 * if cfg!(debug_assertions) { 50 } else { 30 }, 709 }; 710 ThreadPoolBuilder::new() 711 .stack_size(stack_size) 712 .build_global() 713 .unwrap(); 714 } 715 716 pub fn clone_rust() { 717 let needs_clone = match fs::read_to_string("tests/rust/COMMIT") { 718 Err(_) => true, 719 Ok(contents) => contents.trim() != REVISION, 720 }; 721 if needs_clone { 722 download_and_unpack().unwrap(); 723 } 724 725 let mut missing = String::new(); 726 let test_src = Path::new("tests/rust"); 727 728 let mut exclude_files_set = BTreeSet::new(); 729 for exclude in EXCLUDE_FILES { 730 if !exclude_files_set.insert(exclude) { 731 panic!("duplicate path in EXCLUDE_FILES: {}", exclude); 732 } 733 for dir in EXCLUDE_DIRS { 734 if Path::new(exclude).starts_with(dir) { 735 panic!("excluded file {} is inside an excluded dir", exclude); 736 } 737 } 738 if !test_src.join(exclude).is_file() { 739 missing += "\ntests/rust/"; 740 missing += exclude; 741 } 742 } 743 744 let mut exclude_dirs_set = BTreeSet::new(); 745 for exclude in EXCLUDE_DIRS { 746 if !exclude_dirs_set.insert(exclude) { 747 panic!("duplicate path in EXCLUDE_DIRS: {}", exclude); 748 } 749 if !test_src.join(exclude).is_dir() { 750 missing += "\ntests/rust/"; 751 missing += exclude; 752 missing += "/"; 753 } 754 } 755 756 if !missing.is_empty() { 757 panic!("excluded test file does not exist:{}\n", missing); 758 } 759 } 760 761 fn download_and_unpack() -> Result<()> { 762 let url = format!("https://github.com/rust-lang/rust/archive/{REVISION}.tar.gz"); 763 errorf!("downloading {url}\n"); 764 765 let response = reqwest::blocking::get(url)?.error_for_status()?; 766 let progress = Progress::new(response); 767 let decoder = GzDecoder::new(progress); 768 let mut archive = Archive::new(decoder); 769 let prefix = format!("rust-{}", REVISION); 770 771 let tests_rust = Path::new("tests/rust"); 772 if tests_rust.exists() { 773 fs::remove_dir_all(tests_rust)?; 774 } 775 776 for entry in archive.entries()? { 777 let mut entry = entry?; 778 let path = entry.path()?; 779 if path == Path::new("pax_global_header") { 780 continue; 781 } 782 let relative = path.strip_prefix(&prefix)?; 783 let out = tests_rust.join(relative); 784 entry.unpack(&out)?; 785 } 786 787 fs::write("tests/rust/COMMIT", REVISION)?; 788 Ok(()) 789 }