-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-add rust-analyzer as a subtree #99465
Conversation
internal: Lift out IdentContext from CompletionContext Makes things a bit messy overall, but with this I can start cleaning up the render functions properly now. cc rust-lang/rust-analyzer#12571
fix: Don't trigger pattern completions when typing a wildcard pattern Fixes rust-lang/rust-analyzer#12592
Don't analyze dependencies with `test`; this should fix various cases where crates use `cfg(not(test))` and so we didn't find things. "Local" here currently means anything that's not from the registry, so anything inside the workspace, but also path dependencies. So this isn't perfect, and users might still need to use `rust-analyzer.cargo.unsetTest` for these in some cases.
fix: Fix auto-ref completions inserting into wrong locations Fixes rust-lang/rust-analyzer#8058
fix: Only apply `cfg(test)` for local crates Don't analyze dependencies with `test`; this should fix various cases where crates use `cfg(not(test))` and so we didn't find things. "Local" here currently means anything that's not from the registry, so anything inside the workspace, but also path dependencies. So this isn't perfect, and users might still need to use `rust-analyzer.cargo.unsetTest` for these in some cases.
internal: Simplify some completions
- remove Valid, it serves no purpose and just obscures the diff - rename some things - don't use is_valid_candidate when searching for impl, it's not necessary
…eykril fix: completes non exhaustive variant within the defining crate close rust-lang#12624
internal: Simplify
This comment has been minimized.
This comment has been minimized.
this is coming from |
src/bootstrap/dist.rs
Outdated
.ensure(tool::RustAnalyzer { | ||
compiler, | ||
target, | ||
extra_features: vec!["in-rust-tree".to_owned()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather then adding this at every call site, you could make RustAnalyzer its own step outside of the macro, which calls ensure(ToolBuild) internally with the right features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm now working on the real PR and I'm trying to to understand this comment.
Do you mean adding a separate struct (what would it be named?) that implements Step
manually? And the macro-generated Step
would call it, like Rls
ensures Clippy
?
I'm trying to wrap my mind around this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh do you mean not using the macro at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct, not using the macro at all. or you can change the macro not to have extra_features
in some cases only; but that seems more complicated. up to you which you want to do.
const DEFAULT: bool = true; | ||
|
||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { | ||
run.paths(&["src/tools/rust-analyzer", "rust-analyzer"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That second one is redundant, the builder already has logic that lets you abbreviate to the last component of the path.
run.paths(&["src/tools/rust-analyzer", "rust-analyzer"]) | |
run.paths(&["src/tools/rust-analyzer"]) |
let compiler = builder.compiler(builder.top_stage, builder.config.build); | ||
let target = self.target; | ||
|
||
builder.ensure(Rustc { target }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look right, rust-analyzer doesn't use rustc_private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied that from the tool_check_step!
macro (used for clippy, miri, rls, rustfmt, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, those use rustc_private. Rust-analyzer doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm looking at this again and, without it, I get some failures like:
error[E0463]: can't find crate for `core`
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `compiler_builtins`
error[E0463]: can't find crate for `std`
--> /home/amos/.cargo/registry/src/github.com-1ecc6299db9ec823/text-size-1.1.0/src/traits.rs:1:23
|
1 | use {crate::TextSize, std::convert::TryInto};
| ^^^ can't find crate
error: cannot find attribute `derive` in this scope
--> /home/amos/.cargo/registry/src/github.com-1ecc6299db9ec823/drop_bomb-0.1.5/src/lib.rs:118:3
|
118 | #[derive(Debug)]
| ^^^^^^
I think we need at least ensure(Std {})
, maybe even ensure(Rustc {})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Continued here: #99603 (comment)
let mut cargo = prepare_tool_cargo( | ||
builder, | ||
compiler, | ||
Mode::ToolRustc, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mode::ToolRustc, | |
Mode::ToolStd, |
This comment has been minimized.
This comment has been minimized.
This reverts commit c213c23.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The job Click to see the possible cause of the failure (guessed by this bot)
|
@@ -288,7 +288,7 @@ impl server::FreeFunctions for Rustc { | |||
&mut self, | |||
_s: &str, | |||
) -> Result<bridge::Literal<Self::Span, Self::Symbol>, ()> { | |||
todo!("implement literal_from_str") | |||
panic!("FIXME: implement literal_from_str") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this specifically shouldn't need to change I think, only the comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RA has a tidy check that caught this todo!
.
I've switched strategies: I'm going to implement all that in the RA repository first (with cargo +stage1 test --features rust-analyzer/in-tree
) - there's been too many bridge changes to just tackle them in this monster PR.
This PR has served its purpose — thanks to @jyn514 for assisting me in doing the research. The roadmap for "RA as a git subtree" is already well underway: After these changes land there, I'll re-attempt a subtree PR with The Power Of Hindsight (simpler |
(Disclaimer: THIS IS A DRAFT, NOBODY APPROVED THIS, I'M JUST TRYING THINGS OUT)
This PR shows what it would take to make rust-lang/rust-analyzer#12815 happen.
I simply removed the submodule:
And added a subtree, after patching my local git-subtree, following the rustc dev guide:
I then cherry-picked some commits from:
The goal being to avoid regressions to rust-analyzer's
proc-macro-srv
component by running its test suite in CI.As a reminder, nobody approved this, this is me just doing research to try and save time if and when that option is chosen.