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

remove redundant logic #120987

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions compiler/rustc_hir_typeck/src/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1073,12 +1073,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// for instance
self.tcx.at(span).type_of(*def_id).instantiate_identity()
!= rcvr_ty
&& self
.tcx
.at(span)
.type_of(*def_id)
.instantiate_identity()
!= rcvr_ty
Comment on lines -1076 to -1081
Copy link
Member

Choose a reason for hiding this comment

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

@compiler-errors you updated this 3f697b8, but I'm not sure changing the use of actual to rcvr_ty is correct here. My read of the comment above suggests we explicitly wanted to compare the type before and after resolve_vars_if_possible.

Am I misreading this?

Copy link
Member

Choose a reason for hiding this comment

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

I don't believe it makes sense to compare before rcvr_ty has been resolved, so it makes sense to remove this branch. At least according to that commit, it was not actually ever being exercised either?

Copy link
Member

Choose a reason for hiding this comment

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

Looks like this has been essentially unchanged since it was added in #84221 which didn't add a test that covers the Box<Self> case the comment talks about.

I don't have an objection to removing the check, just thought I'd flag it as a bit suspicious 🙂

}
(Mode::Path, false, _) => true,
_ => false,
Expand Down
Loading