Also accept `options.yml` and `options.yaml` files as well for test options,
to get YAML syntax highlighting. In a follow up PR we might make the extension
mandatory.
We've been observing some performance issues using crate_universe on CI.
Therefore, we're moving to vendor the auto-generated BUILD files
in our repository. This should provide a nice speed boost, while
getting rid of the complexity of the "rust cache" job we've been using
when we had a lot of git dependencies.
This PR includes a vendor script, and I'll put up a CI job internally
that runs that vendor script on Cargo.toml and Cargo.lock changes, to check
that the vendored files are in sync.
This allows to tweak via extractor options some aspects of the cargo
configuration:
* the target architecture
* features (including `*` for all, which we must understand whether to
set by default)
* cfg overrides
Integration tests will be added in a follow-up commit.
If:
* the text for a file_id is not found (likely non-utf data in file)
* path does not appear in Vfs, in which case we fall back on loading the file from disk with no "semantics" available
Files were reloaded to handle cases were there was no content
for a file_id, causing a panic. Missing contents was caused by
files that did not contain valid UTF-8 data. These are skipped
by rust-analyzer when it is loading data into the RootDatabase.
This avoids problems with files containing invalid utf-8 data, which may cause
panic's like:
```
thread 'main' panicked at external/rules_rust~~_crate~ql~~r~r__ra_ap_salsa-0.0.232/src/input.rs:91:32:
no value set for CompressedFileTextQuery(FileId(2429))
stack backtrace:
0: rust_begin_unwind
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
1: core::panicking::panic_fmt
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
2: <salsa::input::InputStorage<Q> as salsa::plumbing::QueryStorageOps<Q>>::fetch
3: <DB as ra_ap_base_db::SourceDatabase>::compressed_file_text::__shim
4: <ra_ap_base_db::FileTextQuery as salsa::plumbing::QueryFunction>::execute
5: salsa::Cycle::catch
6: salsa::derived_lru::slot::Slot<Q,MP>::execute
7: salsa::derived_lru::slot::Slot<Q,MP>::read
8: <salsa::derived_lru::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
9: <DB as ra_ap_base_db::SourceDatabase>::file_text::__shim
10: <DB as ra_ap_base_db::SourceDatabase>::file_text
11: <ra_ap_base_db::ParseQuery as salsa::plumbing::QueryFunction>::execute
12: salsa::Cycle::catch
13: salsa::derived_lru::slot::Slot<Q,MP>::execute
14: salsa::derived_lru::slot::Slot<Q,MP>::read
15: <salsa::derived_lru::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
16: <DB as ra_ap_base_db::SourceDatabase>::parse::__shim
17: <DB as ra_ap_base_db::SourceDatabase>::parse
18: ra_ap_hir::semantics::SemanticsImpl::parse
19: single_arch_extractor::main
```