Skip to content

[Doc] Improve rust analyzer section, distinguishing bzlmod and WORKSPACE #3365

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

Merged
merged 4 commits into from
May 1, 2025

Conversation

bertulli
Copy link
Contributor

The documentation for the rust-analyzer section is outdated, and realtive to the WORKSPACE approach. i tried improving it slightly, distinguishing the bzlmod approach. Right now, calling rust_analyzer_dependencies() when using bzlmod seems to throw an error. References issue #2997

Copy link

google-cla bot commented Mar 19, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

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

Thanks! Just one question

@@ -8,23 +8,46 @@ such a file.

### Setup

#### Bzlmod

First, ensure `rules_rust` is setup in your workspace. By default, `rust_register_toolchains` will
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this accurate for bzlmod? I thought all the toolchains were registered by default for @rules_rust//tools/rust_analyzer:gen_rust_project (excluding the rust toolchain itself)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'm not sure i understood correctly (i'm not so experienced with bazel), but commenting the line register_toolchains("@rust_toolchains//:all") from MODULE.bazel made the project still build

Copy link
Collaborator

Choose a reason for hiding this comment

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

In other words, what should users expect to put in their MODULE.bazel files after reading this? Can you add a snippet for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, i tried reducing the MODULE file as possible with the new features, now the only required part is one line, i pushed

@bertulli
Copy link
Contributor Author

just to know, is there something i can do?

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

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

Sorry this fell off my radar, back to you!

@@ -8,23 +8,46 @@ such a file.

### Setup

#### Bzlmod

First, ensure `rules_rust` is setup in your workspace. By default, `rust_register_toolchains` will
Copy link
Collaborator

Choose a reason for hiding this comment

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

In other words, what should users expect to put in their MODULE.bazel files after reading this? Can you add a snippet for that?

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

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

Thank you!

@UebelAndre UebelAndre enabled auto-merge April 30, 2025 13:54
@UebelAndre UebelAndre added this pull request to the merge queue May 1, 2025
Merged via the queue into bazelbuild:main with commit ea35d34 May 1, 2025
3 checks passed
@bertulli bertulli deleted the rust-analyzer branch May 2, 2025 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants