Skip to content
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

[WIP]: generating rust-project file for r-a #120611

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

onur-ozkan
Copy link
Member

PR is in the early stage and it is not ready for review yet. I want to check the CI results with the changes I will push.

r? ghost

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Feb 3, 2024
@onur-ozkan onur-ozkan added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 3, 2024
@onur-ozkan onur-ozkan changed the title [WIP]: generating rust-project for r-a [WIP]: generating rust-project file for r-a Feb 3, 2024
@onur-ozkan onur-ozkan force-pushed the embedded-lsp-feed branch 2 times, most recently from 2d0fb4d to fdf34cf Compare February 3, 2024 17:58
Contains the implementation for generating rust-project.json data
which can be utilized for LSPs (Language Server Protocols).

Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
src/bootstrap/src/utils/ra_project.rs Outdated Show resolved Hide resolved
Comment on lines +34 to +35
env: BTreeMap<String, String>,
is_proc_macro: bool,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't documented, but you probably want to include a include_dirs that corresponds to each src/ directory. If rustc keeps a Cargo-like structure, knowing the crate entrypoint is probably enough, but if it drifts, include_dirs will ensure all rust-analyzer functionality will keep working.

(it's important to note that rust-project.json is basically a lower-level version of what rust-analyzer already doing with Cargo, so you just need to a do a little more work via rust-project.json to ensure that everything continues to just work.)

@onur-ozkan
Copy link
Member Author

onur-ozkan commented Feb 9, 2024

jfyi I am unable to proceed on this task because I cannot set a custom rustc path in the rust-project.json file (I think we shouldn't even need that, r-a should consider using rustc from the sysroot we provide in rust-project.json). I would enhance r-a to be capable of handling this, but unfortunately I have too many tasks on my list at the moment.

etc/rust_analyzer_settings.json isn't helpful as it re-indexes everything from scratch, ignoring the rust-project.json file.

@rustbot blocked.

@rustbot rustbot added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 9, 2024
@Veykril
Copy link
Member

Veykril commented Feb 9, 2024

I think we shouldn't even need that, r-a should consider using rustc from the sysroot we provide in rust-project.json

It should I agree, opened rust-lang/rust-analyzer#16523 as a reminder. I can look into it the coming week

@Veykril
Copy link
Member

Veykril commented Feb 12, 2024

rust-lang/rust-analyzer#16537 should fix this

@Dylan-DPC Dylan-DPC added S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Feb 21, 2024
@Noratrieb
Copy link
Member

@onur-ozkan what's the status here? Is this blocked on anything or just waiting for someone to pick it up?

@onur-ozkan
Copy link
Member Author

@onur-ozkan what's the status here? Is this blocked on anything or just waiting for someone to pick it up?

Not blocked anymore. While it was blocked I shifted myself to different tasks and I don't have enough space to continue on this at the moment. Maybe in couple months.

@Noratrieb
Copy link
Member

I do think that this is some of the most impactful work on bootstrap right now and would prioritize it over other bootstrap things, but you're of course free to do whatever you want and have time for, any work on bootstrap is better than nothing ❤️ (and nothing is fine too if you're busy with other things, of course!).

@onur-ozkan
Copy link
Member Author

I do think that this is some of the most impactful work on bootstrap right now and would prioritize it over other bootstrap things, but you're of course free to do whatever you want and have time for, any work on bootstrap is better than nothing ❤️ (and nothing is fine too if you're busy with other things, of course!).

At the moment I am working on 2 major tasks (removing python from bootstrap and redesigning stage0 std). Once I complete either of these tasks I will have the capacity to start working on another one (which will be this one). If anyone else has additional time and is interested in working on this, feel free to takeover this PR.

@onur-ozkan onur-ozkan added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 16, 2024
@davidbarsky
Copy link
Contributor

rust-lang/rust-analyzer#17246 could help a bit with the UX of using rust-project.json files in rustc. I'm going to try landing that change this week, but I'll need to clean up a few things for that to happen. Still, it's my top priority right now.

@bors
Copy link
Contributor

bors commented Jun 16, 2024

☔ The latest upstream changes (presumably #126540) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants