suspicious_double_ref_op: report unadjusted return type#157872
Merged
rust-bors[bot] merged 2 commits intoJun 15, 2026
Conversation
Collaborator
|
r? @camelid rustbot has assigned @camelid. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Member
|
@bors r+ rollup |
Contributor
This comment has been minimized.
This comment has been minimized.
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 15, 2026
…=camelid `suspicious_double_ref_op`: report unadjusted return type `suspicious_double_ref_op` uses the adjusted expression type to distinguish a no-op call from a double-reference operation. When the result is used as another method's receiver, that type can include the parent method's receiver adjustment. For example, `file.clone().write(&[])` reports that `clone` returns `&mut &File`, even though it returns `&File`. This PR continues to use the adjusted type for lint classification, but now uses the method call's unadjusted type in the diagnostic. The same issue affects `.deref()`, so the regression test covers both operations. Fixes #146227
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Contributor
|
💔 Test for 92df1e4 failed: CI. Failed job:
|
Contributor
|
@bors retry |
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jun 15, 2026
…-op-type, r=camelid `suspicious_double_ref_op`: report unadjusted return type `suspicious_double_ref_op` uses the adjusted expression type to distinguish a no-op call from a double-reference operation. When the result is used as another method's receiver, that type can include the parent method's receiver adjustment. For example, `file.clone().write(&[])` reports that `clone` returns `&mut &File`, even though it returns `&File`. This PR continues to use the adjusted type for lint classification, but now uses the method call's unadjusted type in the diagnostic. The same issue affects `.deref()`, so the regression test covers both operations. Fixes rust-lang#146227
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jun 15, 2026
…-op-type, r=camelid `suspicious_double_ref_op`: report unadjusted return type `suspicious_double_ref_op` uses the adjusted expression type to distinguish a no-op call from a double-reference operation. When the result is used as another method's receiver, that type can include the parent method's receiver adjustment. For example, `file.clone().write(&[])` reports that `clone` returns `&mut &File`, even though it returns `&File`. This PR continues to use the adjusted type for lint classification, but now uses the method call's unadjusted type in the diagnostic. The same issue affects `.deref()`, so the regression test covers both operations. Fixes rust-lang#146227
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 15, 2026
Rollup of 6 pull requests Successful merges: - #157899 (Update LLVM to 22.1.7) - #157029 (stabilize feature `float_algebraic`) - #157872 (`suspicious_double_ref_op`: report unadjusted return type) - #157877 (Stabilize `nonzero_from_str_radix`) - #157900 (Update intrinsics wrapping documentation) - #157904 (Add Alice Ryhl to libs review rotation)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 15, 2026
Rollup of 6 pull requests Successful merges: - #157899 (Update LLVM to 22.1.7) - #157029 (stabilize feature `float_algebraic`) - #157872 (`suspicious_double_ref_op`: report unadjusted return type) - #157877 (Stabilize `nonzero_from_str_radix`) - #157900 (Update intrinsics wrapping documentation) - #157904 (Add Alice Ryhl to libs review rotation)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 15, 2026
…uwer Rollup of 6 pull requests Successful merges: - #157029 (stabilize feature `float_algebraic`) - #157872 (`suspicious_double_ref_op`: report unadjusted return type) - #157877 (Stabilize `nonzero_from_str_radix`) - #157900 (Update intrinsics wrapping documentation) - #157904 (Add Alice Ryhl to libs review rotation) - #157911 (Rename `errors.rs` file to `diagnostics.rs` (10/N))
rust-timer
added a commit
that referenced
this pull request
Jun 15, 2026
Rollup merge of #157872 - qaijuang:fix-suspicious-double-ref-op-type, r=camelid `suspicious_double_ref_op`: report unadjusted return type `suspicious_double_ref_op` uses the adjusted expression type to distinguish a no-op call from a double-reference operation. When the result is used as another method's receiver, that type can include the parent method's receiver adjustment. For example, `file.clone().write(&[])` reports that `clone` returns `&mut &File`, even though it returns `&File`. This PR continues to use the adjusted type for lint classification, but now uses the method call's unadjusted type in the diagnostic. The same issue affects `.deref()`, so the regression test covers both operations. Fixes #146227
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
suspicious_double_ref_opuses the adjusted expression type to distinguish a no-op call from a double-reference operation. When the result is used as another method's receiver, that type can include the parent method's receiver adjustment.For example,
file.clone().write(&[])reports thatclonereturns&mut &File, even though it returns&File.This PR continues to use the adjusted type for lint classification, but now uses the method call's unadjusted type in the diagnostic. The same issue affects
.deref(), so the regression test covers both operations.Fixes #146227