This works around a quirk in rust-analyzer's AST generation machinery,
where for an `<X as Y>` path there might be no way to directly get `Y`
from the path segment.
We found out we can stumble upon a `line_index.line_col` panic,
specifically when reporting a macro parse error.
This replaces `line_col` with safer `try_line_col`, and deals more
gracefully with the error.
Rust-analyzer turned out to be quite picky about paths, where
`//?/`-prefixed paths can lead to flaky failures. See
https://github.com/rust-lang/rust-analyzer/issues/18894
for details.
This makes paths always be canonicalized with `dunce`. Previously,
`dunce` was used as a fallback, but that stopped working somewhere
after version 0.0.248 of rust-analyzer.
The rust-analyzer update will need more work as it seems to break rust
analysis on windows.
This was carried out using `cargo upgrade` from `cargo-edit`:
* getting exclusions options for rust-analyzer with
```bash
cargo upgrade -i --dry-run | grep -o 'ra_ap_\S\+' | sort -u | sed 's/^/--exclude=/' > /tmp/exclude
```
* running
```bash
cargo upgrade -i $(cat /tmp/exclude)
misc/bazel/3rdparty/update_cargo_deps.sh
```
Users will still be able to opt out:
* for unit tests, by providing the `cargo_cfg_overrides=-test` extractor
option
* for integration tests, by excluding the test files from the analysis
using `paths-ignore` in the codescanning configuration file
We may want to revisit whether we want a single option for both. Also
further work will be needed to restrict our security queries to non-test
code on the QL side.
This splits the `ArrayExpr` class into `ArrayListExpr` and `ArrayRepeatExpr`.
This uses the `synth.from_class` machinery to integrate seamlessly into the
generated code, by hiding the extracted `ArrayExpr` behind an internal class
and replacing it with a hierarchy of those two classes under a new
`ArrayExpr` class.