Remove cyclic dev dependency with the parser crate (#11261)

## Summary

This PR removes the cyclic dev dependency some of the crates had with
the parser crate.

The cyclic dependencies are:
* `ruff_python_ast` has a **dev dependency** on `ruff_python_parser` and
`ruff_python_parser` directly depends on `ruff_python_ast`
* `ruff_python_trivia` has a **dev dependency** on `ruff_python_parser`
and `ruff_python_parser` has an indirect dependency on
`ruff_python_trivia` (`ruff_python_parser` - `ruff_python_ast` -
`ruff_python_trivia`)

Specifically, this PR does the following:
* Introduce two new crates
* `ruff_python_ast_integration_tests` and move the tests from the
`ruff_python_ast` crate which uses the parser in this crate
* `ruff_python_trivia_integration_tests` and move the tests from the
`ruff_python_trivia` crate which uses the parser in this crate

### Motivation

The main motivation for this PR is to help development. Before this PR,
`rust-analyzer` wouldn't provide any intellisense in the
`ruff_python_parser` crate regarding the symbols in `ruff_python_ast`
crate.

```
[ERROR][2024-05-03 13:47:06] .../vim/lsp/rpc.lua:770	"rpc"	"/Users/dhruv/.cargo/bin/rust-analyzer"	"stderr"	"[ERROR project_model::workspace] cyclic deps: ruff_python_parser(Idx::<CrateData>(50)) -> ruff_python_ast(Idx::<CrateData>(37)), alternative path: ruff_python_ast(Idx::<CrateData>(37)) -> ruff_python_parser(Idx::<CrateData>(50))\n"
```

## Test Plan

Check the logs of `rust-analyzer` to not see any signs of cyclic
dependency.
This commit is contained in:
Dhruv Manilawala 2024-05-07 14:54:57 +05:30 committed by GitHub
parent 12b5c3a54c
commit 28cc71fb6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
78 changed files with 774 additions and 728 deletions

View file

@ -0,0 +1,13 @@
# Integration tests for `ruff_python_trivia`
This crate includes integration tests for the `ruff_python_trivia` crate.
The reason for having a separate crate is to avoid introducing a dev circular
dependency between the `ruff_python_parser` crate and the `ruff_python_trivia` crate.
This crate shouldn't include any code, only tests.
**Reference:**
- `rust-analyzer` issue: <https://github.com/rust-lang/rust-analyzer/issues/3390>
- Ruff's pull request: <https://github.com/astral-sh/ruff/pull/11261>