Skip to content

[core] Fix -Wshadow build error in GcsActorManager with clang 17-21 - #66692

Merged
Sparks0219 merged 5 commits into
ray-project:masterfrom
dancingactor:fix-Wshadow-build-error
Oct 6, 2026
Merged

Sparks0219 merged 5 commits into
ray-project:masterfrom
dancingactor:fix-Wshadow-build-error

Conversation

@dancingactor

@dancingactor dancingactor commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

Building Ray from source on current master fails with Apple clang 17 (Xcode 26) because of a -Wshadow -Werror error introduced in #66073:

src/ray/gcs/actor/gcs_actor_manager.cc:1872:21: error: declaration shadows a structured binding [-Werror,-Wshadow]
 1872 |             {[this, actor_id = actor_id, observability_data = observability_data](
      |                     ^
src/ray/gcs/actor/gcs_actor_manager.cc:1784:21: note: previous declaration is here
 1784 |   for (const auto &[actor_id, actor_table_data] : gcs_init_data.Actors()) {
      |                     ^
1 error generated.

This PR fixes the issue by renaming the inner actor_id variable to eliminate the shadowing.

Verification

The build passes with this fix applied.

Related issues

Fixes #66691

@dancingactor
dancingactor requested a review from a team as a code owner October 3, 2026 09:07

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 325adb3. Configure here.

Comment thread src/ray/gcs/actor/gcs_actor_manager.cc Resolved

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request renames actor_id to dead_actor_id in a lambda capture list within GcsActorManager::Initialize to avoid shadowing. The review feedback suggests simplifying the capture list further by capturing observability_data directly by value instead of using an init-capture, which helps prevent potential -Wshadow warnings.

Comment thread src/ray/gcs/actor/gcs_actor_manager.cc Resolved
@ray-gardener ray-gardener Bot added core Issues that should be addressed in Ray Core community-contribution Contributed by the community labels Oct 3, 2026
dancingactor and others added 2 commits October 4, 2026 00:59
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Ding-Xin Chen <[email protected]>
Signed-off-by: dancingactor <[email protected]>
@Efutrrionpy

Copy link
Copy Markdown
Contributor

I verified the fix with a minimal example on Linux using Clang 21.1.8 and -std=c++17 -Wshadow -Werror. The original version fails with the shadowing error, and the updated version compiles successfully.

Comment thread src/ray/gcs/actor/gcs_actor_manager.cc Resolved

@Sparks0219 Sparks0219 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚢 thanks man!

@Sparks0219
Sparks0219 enabled auto-merge (squash) October 5, 2026 23:34
@github-actions github-actions Bot added the go add ONLY when ready to merge, run all tests label Oct 5, 2026
@Sparks0219
Sparks0219 merged commit 3f14906 into ray-project:master Oct 6, 2026
8 checks passed
@dancingactor

Copy link
Copy Markdown
Contributor Author

@Sparks0219 Thanks for review!

nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…ay-project#66692)

## Description
Building Ray from source on current master fails with Apple clang 17
(Xcode 26) because of a `-Wshadow -Werror` error introduced in ray-project#66073:

```
src/ray/gcs/actor/gcs_actor_manager.cc:1872:21: error: declaration shadows a structured binding [-Werror,-Wshadow]
 1872 |             {[this, actor_id = actor_id, observability_data = observability_data](
      |                     ^
src/ray/gcs/actor/gcs_actor_manager.cc:1784:21: note: previous declaration is here
 1784 |   for (const auto &[actor_id, actor_table_data] : gcs_init_data.Actors()) {
      |                     ^
1 error generated.
```

This PR fixes the issue by renaming the inner `actor_id` variable to
eliminate the shadowing.

### Verification
The build passes with this fix applied.

## Related issues
Fixes ray-project#66691

---------

Signed-off-by: dancingactor <[email protected]>
Signed-off-by: Ding-Xin Chen <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@dancingactor
dancingactor deleted the fix-Wshadow-build-error branch October 28, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community core Issues that should be addressed in Ray Core go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Core] Fail to build from source with Clang 17-21 due to -Wshadow error in GcsActorManager

4 participants