tree-sitter / tree-sitter-rust

Rust grammar for tree-sitter
MIT License
331 stars 95 forks source link

[meta] cases where treesitter rejects code that rustc accepts #229

Open matthiaskrgr opened 1 month ago

matthiaskrgr commented 1 month ago

There are a a bunch of more cases where rustc compiles a file whereas treesitter-rustc throws an error, indicating a parsing failure in treesitter-rust.

Since I deem filing all these issues separately is not worth my time, here is a list of interesting test files:

the files can be found inside the rustc repo @ 0038c021031ce9f1ec2329469c8d85d0e681ef8f

Tested tree-sitter version was 0038c021031ce9f1ec2329469c8d85d0e681ef8f with a patched version of tree-sitter-rust 04352146022062c101b8ddd853adf17eadd8cf56 , as just adding both -git deps to a crate did not work out for me.

tests/ui/parser/keyword-union-as-identifier.rs
tests/ui/associated-type-bounds/type-alias.rs
tests/ui/traits/object/issue-33140-traitobject-crate.rs
tests/ui/rfcs/rfc-2565-param-attrs/param-attrs-allowed.rs
tests/ui/type/type-alias-bounds.rs
tests/ui/associated-types/project-recursion-limit-non-fatal.rs
tests/pretty/ast-stmt-expr-attr.rs
tests/ui/codegen/subtyping-impacts-selection-1.rs
tests/rustdoc/inline_cross/auxiliary/dyn_trait.rs
tests/ui/implied-bounds/normalization-placeholder-leak.rs
tests/ui/macros/type-macros-hlist.rs
tests/ui/sized/coinductive-1-gat.rs
tests/ui/structs-enums/struct-aliases.rs
tests/ui/borrowck/alias-liveness/higher-ranked.rs
tests/rustdoc/where.rs
tests/pretty/issue-25031.rs
tests/ui/binding/use-uninit-match2.rs
tests/ui/const-generics/defaults/trait_objects.rs
tests/rustdoc/bounds.rs
tests/ui/const-generics/defaults/rp_impl_trait.rs
tests/ui/traits/next-solver/alias-relate/alias_eq_dont_use_normalizes_to_if_substs_eq.rs
tests/ui/or-patterns/or-patterns-syntactic-pass.rs
tests/ui/parser/trait-plusequal-splitting.rs
tests/ui/const-generics/defaults/auxiliary/const_defaulty.rs
tests/ui/underscore-method-after-integer.rs
tests/ui/rfcs/rfc-2632-const-trait-impl/mbe-bare-trait-objects-const-trait-bounds.rs
tests/ui/traits/non_lifetime_binders/disqualifying-object-candidates.rs
tests/ui/structs-enums/numeric-fields.rs
tests/ui/parser/trait-item-with-defaultness-pass.rs
tests/ui/issues/issue-26186.rs
tests/ui/traits/solver-cycles/inductive-canonical-cycle.rs
tests/rustdoc/inline_cross/auxiliary/default-generic-args.rs
tests/ui/associated-item/issue-105449.rs
tests/ui/where-clauses/issue-50825-1.rs
tests/rustdoc/higher-ranked-trait-bounds.rs
tests/ui/const-generics/defaults/repr-c-issue-82792.rs
tests/coverage/unicode.rs
tests/ui/nll/issue-112604-closure-output-normalize.rs
tests/ui/macros/user-defined-macro-rules.rs
tests/ui/traits/issue-72455.rs
tests/ui/macros/edition-macro-pats.rs
tests/ui/parser/extern-abi-raw-strings.rs
tests/ui/binding/match-bot.rs
tests/ui/issues/issue-50714.rs
tests/rustdoc/const-generics/const-generic-defaults.rs
tests/ui/implied-bounds/hrlt-implied-trait-bounds-roundtrip.rs
tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-normalization-3.rs
tests/ui/feature-gates/feature-gate-trivial_bounds-lint.rs
tests/pretty/nested-item-vis-defaultness.rs
tests/ui/parser/parser-unicode-whitespace.rs
tests/ui/derives/derive-macro-const-default.rs
tests/ui/dropck/trivial-impl-bounds.rs
tests/ui/issues/issue-43692.rs
tests/ui/const-generics/arg-in-pat-3.rs
tests/ui/type_length_limit.rs
tests/ui/issues/issue-36116.rs
tests/ui/traits/issue-78632.rs
tests/ui/pattern/size-and-align.rs
tests/ui/impl-trait/different_where_bounds.rs
tests/ui/trivial-bounds/trivial-bounds-object.rs
tests/ui/auto-traits/pre-cfg.rs
tests/ui/const-generics/defaults/const-param-as-default-value.rs
tests/ui/where-clauses/where-clause-placement-assoc-type-in-impl.rs
tests/ui/traits/next-solver/dont-loop-fulfill-on-region-constraints.rs
tests/ui/empty-type-parameter-list.rs
tests/ui/structs-enums/simple-match-generic-tag.rs
tests/ui/lifetimes/elided-lifetime-in-param-pat.rs
tests/rustdoc/inline_cross/auxiliary/impl_trait_aux.rs
tests/ui/issues/issue-61475.rs
tests/ui/nll/empty-type-predicate-2.rs
tests/ui/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs
tests/ui/match/match-bot-panic.rs
tests/rustdoc/inline_cross/auxiliary/early-late-bound-lifetime-params.rs
tests/ui/half-open-range-patterns/half-open-range-pats-syntactic-pass.rs
tests/ui/issues/issue-22471.rs
tests/ui/const-generics/defaults/type-default-const-param-name.rs
tests/ui/attributes/issue-115264-pat-field.rs
tests/ui/issues/issue-34751.rs
tests/ui/half-open-range-patterns/pat-tuple-4.rs
tests/ui/codegen/mono-impossible.rs
tests/ui/binding/use-uninit-match.rs
tests/ui/higher-ranked/trait-bounds/issue-95230.rs
tests/ui/binding/match-join.rs
tests/ui/feature-gates/soft-syntax-gates-without-errors.rs
tests/ui/traits/issue-22110.rs
tests/ui/attrs-resolution.rs
tests/ui/nll/empty-type-predicate.rs
tests/ui/pattern/usefulness/integer-ranges/issue-117648-overlapping_range_endpoints-false-positive.rs
tests/ui/traits/object/lifetime-first.rs
tests/ui/traits/next-solver/unevaluated-const-impl-trait-ref.rs
tests/ui/parser/issues/issue-65041-empty-vis-matcher-in-trait.rs
tests/ui/parser/shebang/shebang-and-attrib.rs
tests/ui/destructuring-assignment/struct_destructure.rs
tests/ui/parser/issues/issue-88583-union-as-ident.rs
tests/ui/parser/foreign-ty-syntactic-pass.rs
tests/ui/parser/impls-nested-within-anon-consts-semantic.rs
tests/pretty/where-clauses.rs
tests/ui/parser/item-free-type-bounds-syntactic-pass.rs
tests/pretty/if-attr.rs
tests/ui/nll/assign-while-to-immutable.rs
tests/ui/const-generics/defaults/const-default.rs
tests/ui/const-generics/min_const_generics/type_and_const_defaults.rs
tests/ui/codegen/mono-impossible-2.rs
tests/ui/parser/shebang/valid-shebang.rs
tests/ui/issues/issue-37733.rs
tests/ui/binding/nested-matchs.rs
tests/ui/const-generics/min_const_generics/default_trait_param.rs
tests/ui/parser/shebang/sneaky-attrib.rs
tests/ui/parser/shebang/shebang-space.rs
tests/ui/traits/dyn-trait.rs
tests/ui/issues/issue-39089.rs
tests/ui/consts/const-labeled-break.rs
tests/ui/associated-types/issue-64855-2.rs
tests/ui/parser/shebang/shebang-empty.rs
tests/ui/error-codes/E0646.rs

Have fun :)

amaanq commented 1 month ago

ooh this is awesome, thanks for the list.