-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
suspicious_double_ref_op
: don't lint on .borrow()
#112517
Conversation
r? @b-naber (rustbot has picked a reviewer for you, use r? to override) |
@@ -129,6 +129,9 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall { | |||
NoopMethodCallDiag { method: call.ident.name, receiver_ty, label: span }, | |||
); | |||
} else { | |||
if op == "borrow" { |
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.
can you add a comment here explaining why borrow makes sense?
// FIXME(fee1-dead) stop using stringly typed diagnostic here | ||
// If `type_of(x) == T` and `x.borrow()` is used to get `&T`, | ||
// gthen that should be allowed | ||
if op == "borrow" { |
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.
nit:
if op == "borrow" { | |
if name == sym::noop_method_borrow { |
8e9e54d
to
1caed51
Compare
@bors r+ rollup |
…llaumeGomez Rollup of 8 pull requests Successful merges: - rust-lang#112403 (Prevent `.eh_frame` from being emitted for `-C panic=abort`) - rust-lang#112517 (`suspicious_double_ref_op`: don't lint on `.borrow()`) - rust-lang#112529 (Extend `unused_must_use` to cover block exprs) - rust-lang#112614 (tweak suggestion for argument-position `impl ?Sized`) - rust-lang#112654 (normalize closure output in equate_inputs_and_outputs) - rust-lang#112660 (Migrate GUI colors test to original CSS color format) - rust-lang#112664 (Add support for test tmpdir to fuchsia test runner) - rust-lang#112669 (Fix comment for ptr alignment checks in codegen) r? `@ghost` `@rustbot` modify labels: rollup
Should this be backported to the 1.71.0 beta? I'm asking because the issue is listed in the 1.71.0 milestone. |
It's too late now for 1.71.0, of course, but it could be considered for 1.71.1. A warn-by-default lint is not such a big deal, but this is a trivial backport (clean cherry-pick), and we're planning to have a point release anyway. FWIW, I also got a bug for this in CentOS Stream: https://bugzilla.redhat.com/show_bug.cgi?id=2225471 @rustbot label +stable-nominated |
Prepare Rust 1.71.1 This PR prepares the Rust 1.71.1 release, which contains: * rust-lang#113802 * rust-lang#113579 * rust-lang#111516 * rust-lang#112517 * rust-lang@67b5990 (from rust-lang#113678) r? `@ghost` cc `@rust-lang/release`
closes #112489