Skip to content

⬆️ rust-analyzer - #100303

Merged
bors merged 58 commits into
rust-lang:masterfrom
lnicola:rust-analyzer-2022-08-09
Aug 9, 2022
Merged

⬆️ rust-analyzer#100303
bors merged 58 commits into
rust-lang:masterfrom
lnicola:rust-analyzer-2022-08-09

Conversation

@lnicola

Copy link
Copy Markdown
Member

Veykriland others added 30 commits July 18, 2022 20:30
fix: remove whitespaces from doctest names
When rustdoc runs doctests, it removes whitespaces from the tests' path ([code](https://github.com/rust-lang/rust/blob/25bb1c13bd472b75ceebee3b8dcf4dcbc431a8be/src/librustdoc/doctest.rs#L951)). See rust-lang#89422 for details.
Interestingly enough, "Run doctest" has been working without much problem even though rust-analyzer hasn't followed the change. This is because cargo passes the test name to rustdoc via `--test-args` option, and then rustdoc [splits it by whitespace](https://github.com/rust-lang/rust/blob/25bb1c13bd472b75ceebee3b8dcf4dcbc431a8be/src/librustdoc/config.rs#L513-L514); the last element of the split test name **always** matches the test name that rustdoc generates.
However, it may run other tests unexpectedly (to be precise, this has long since been a thing because of the split). Consider the following example:
```rust
struct A<T, U>(T, U);
struct B<T, U>(T, U);
/// ```
/// doctest here
/// ```
impl<T, U> A<T, U> {}
/// ```
/// doctest here
/// ```
impl<T, U> B<T, U> {}
```
When you "Run doctest" either of the two, rustdoc considers "U>" one of the test specs and both doctests are run. This patch fixes it by following rustdoc and removing the whitespace from the doctests' name.
…schievink
feat: Publish extension for 32-bit ARM systems
…evink
fix: Fix r-a spelling in some places
User-facing change: All commands are now rendered as "rust-analyzer: Command" rather than "Rust Analyzer: Command".
Alternative to rust-lang/rust-analyzer#12910
Potentially controversial, since other extensions don't do this, so I won't self-approve.
Add syntax fixup for while loops
Part of rust-lang/rust-analyzer#12777
This is a first iteration to gather some feedback. In particular I'm not sure if the curly braces should be added here, but I couldn't get the test to work without them. Any hints welcome!
PathType path parents don't support this assist
…data, r=Veykril
feat: support associated values in "Generate Enum Variant" assist
This change adds support for associated values to the "Generate Enum Variant" assist.
I've split the implementation out into 4 steps to make code review easier:
- Add "add_variant" support to the structural ast editing system in `edit_in_place`
- Migrate `generate_enum_variant` to use structural ast editing instead of string manipulation
- Support tuple fields
- Support record fields
Please let me know if I should leave the commits as-is, or squash before merging.
Fixesrust-lang#12797
minor: Use the release branch in xtask promote
We enforce integral and `Copy` key, so some key-related functions are
not necessary since user can just reuse the index for the `entry` call.
Use an empty expander for ignored non-attribute proc-macros
Identity is the wrong behaviour for anything that's not an attribute here
borsand others added 21 commits August 4, 2022 12:57
feat: Only flycheck workspace that belongs to saved file
Supercedes rust-lang/rust-analyzer#11038
There is still the problem that all the diagnostics are cleared, only clearing diagnostics of the relevant workspace isn't easily doable though I think, will have to dig into that
When r-a starts up, it starts switching the workspace before all vfs
events have been processed which causes us to switch workspace multiple
times until all vfs changes have been processed. This scales with the
size of the project and its dependencies. If workspace files from
dependencies as well as the sysroot get loaded, we shouldn't switch
the workspace as those have no impact on the project workspace.
feat: Handle operators like their trait functions in the IDE
Allows hover and goto implementation to work on `?`, indexing brackets, binary operators, prefix operators and `await`. Regarding `await`, hover will continue to show the keyword docs while goto implementation will bring the user to the `poll` function of the `Future` implementation.
![Code_CJmZ3FGFVn](https://user-images.githubusercontent.com/3757771/183076683-c9899bd6-60d3-461b-965f-0c0f9745e2e8.gif)
Fixesrust-lang/rust-analyzer#12810
Don't switch workspace on vfs file changes from libraries
When r-a starts up, it starts switching the workspace before all vfs
events have been processed which causes us to switch workspace multiple
times until all vfs changes have been processed. This scales with the
size of the project and its dependencies. If workspace files from
dependencies as well as the sysroot get loaded, we shouldn't switch
the workspace as those have no impact on the project workspace.
Add more constructors and entry-APIs for la-arena
`la-arena` on crates.io is quite helpful when just a thin wrapper for Vec with u32 indices is needed.
But the current API is not ergonomic enough.
This PR
- Adds `ArenaMap::new`. Not sure why only `Arena` has it now.
- Adds `Arena{,Map}::with_capacity` for known-size storage.
- Adds entry-API for `ArenaMap` for easier `.entry(idx).or_default().push(value)` or `.entry(idx).or_insert(...)` operations.
Run stable `fmt` & `cargo` through `rustup`
`cargo test -p ide-assists` fails on Windows/x64/nightly:
```shell
> rustup self update
info: checking for self-updates
rustup unchanged - 1.25.1
> rustup update
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: checking for self-updates
stable-x86_64-pc-windows-msvc unchanged - rustc 1.62.1 (e092d0b 2022-07-16)
nightly-x86_64-pc-windows-msvc unchanged - rustc 1.64.0-nightly (affe0d3 2022-08-05)
info: cleaning up downloads & tmp directories
> rustup show
Default host: x86_64-pc-windows-msvc
rustup home: C:\Users\stanc\.rustup
installed toolchains
--------------------
stable-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-msvc (default)
active toolchain
----------------
nightly-x86_64-pc-windows-msvc (default)
rustc 1.64.0-nightly (affe0d3 2022-08-05)
> cargo test -p ide-assists
test tests::sourcegen::sourcegen_assists_docs ... FAILED
failures:
---- tests::sourcegen::sourcegen_assists_docs stdout ----
thread 'tests::sourcegen::sourcegen_assists_docs' panicked at 'Failed to run rustfmt from toolchain 'stable'. Please run `rustup component add rustfmt --toolchain stable` to install it.', crates\sourcegen\src\lib.rs:141:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
tests::sourcegen::sourcegen_assists_docs
test result: FAILED. 1576 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.82s
error: test failed, to rerun pass '-p ide-assists --lib'
```
After some investigation it seemed that [`cmd!`](https://github.com/rust-lang/rust-analyzer/blob/51705698bd66919435e4fcbc25d96bd7fc5583f4/crates/sourcegen/src/lib.rs#L139) didn't execute the expected (stable) rustfmt.
A simple `xshell` test failed too:
```rust
use xshell::{cmd, Shell};
fn main() {
let sh = &Shell::new().unwrap();
sh.set_var("RUSTUP_TOOLCHAIN", "stable");
let version = cmd!(sh, "rustfmt --version").read().unwrap_or_default();
println!("{version}");
}
```
Bypassing `xshell` and using `Command` directly failed too:
```rust
use std::process::{Command, Stdio};
fn main() {
let child = Command::new("rustfmt")
.arg("--version")
.stdin(Stdio::null())
.stdout(Stdio::piped())
.env("RUSTUP_TOOLCHAIN", "stable")
.spawn()
.expect("failed to start");
let output = child.wait_with_output().unwrap();
let version = String::from_utf8_lossy(&output.stdout);
println!("{version}");
}
```
Spawning `cargo +stable fmt version` [failed too](rust-lang/rustup#3036) with `error: no such subcommand: +stable`.
Only `rustup run stable` worked fine for both `cargo` and `fmt`.
Thanks to `@lnicola` for a live investigation session, hints and tips.
More methods and traits for `la_arena::ArenaMap`
Continue of rust-lang#12931. Seems that I forgot some methods in the previous PR :(
I also changed `ArenaMap::insert` to return the old value, to match the map-like collection API of std. **So this is a breaking change.**
r? `@lnicola`
@lnicola

Copy link
Copy Markdown
MemberAuthor

@bors r+ rollup=iffy

@bors

bors commented Aug 9, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit f1e801b has been approved by lnicola

It is now in the queue for this repository.

@borsbors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Aug 9, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 9, 2022
…iaskrgr
Rollup of 6 pull requests
Successful merges:
- rust-lang#100163 (Refactor: remove an unnecessary string search)
- rust-lang#100212 (Remove more Clean trait implementations)
- rust-lang#100238 (Further improve error message for E0081)
- rust-lang#100268 (Add regression test for rust-lang#79148)
- rust-lang#100294 (Update Duration::as_secs doc to point to as_secs_f64/32 for including fractional part)
- rust-lang#100303 (:arrow_up: rust-analyzer)
Failed merges:
- rust-lang#100281 (Remove more Clean trait implementations)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit cacd37a into rust-lang:masterAug 9, 2022
@rustbotrustbot added this to the 1.65.0 milestone Aug 9, 2022
@lnicola
lnicola deleted the rust-analyzer-2022-08-09 branch August 9, 2022 11:17
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants

@lnicola@bors@rustbot@Veykril@palango@lowr@DorianListens@oxalica@jean-santos@stanciuadrian