Skip to content

[perf] Don't select on error path in probe #142203

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

Closed
Closed
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
9 changes: 9 additions & 0 deletions compiler/rustc_hir_typeck/src/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@
scope_expr_id: HirId,
candidate_filter: impl Fn(&ty::AssocItem) -> bool,
) -> Vec<ty::AssocItem> {
if true {
Copy link
Member Author

Choose a reason for hiding this comment

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

oops this shouldnt have made it into the PR, but w/e.

span_bug!(span, "this should not be called on the good path!");

Check failure on line 291 in compiler/rustc_hir_typeck/src/method/probe.rs

View workflow job for this annotation

GitHub Actions / PR - x86_64-gnu-tools

this should not be called on the good path!

Check failure on line 291 in compiler/rustc_hir_typeck/src/method/probe.rs

View workflow job for this annotation

GitHub Actions / PR - x86_64-gnu-tools

this should not be called on the good path!

Check failure on line 291 in compiler/rustc_hir_typeck/src/method/probe.rs

View workflow job for this annotation

GitHub Actions / PR - x86_64-gnu-tools

this should not be called on the good path!

Check failure on line 291 in compiler/rustc_hir_typeck/src/method/probe.rs

View workflow job for this annotation

GitHub Actions / PR - x86_64-gnu-tools

this should not be called on the good path!

Check failure on line 291 in compiler/rustc_hir_typeck/src/method/probe.rs

View workflow job for this annotation

GitHub Actions / PR - x86_64-gnu-tools

this should not be called on the good path!
}

let method_names = self
.probe_op(
span,
Expand Down Expand Up @@ -1741,6 +1745,11 @@
&self,
trait_ref: ty::TraitRef<'tcx>,
) -> traits::SelectionResult<'tcx, traits::Selection<'tcx>> {
// FIXME:
if self.next_trait_solver() {
return Ok(None);
}

let obligation =
traits::Obligation::new(self.tcx, self.misc(self.span), self.param_env, trait_ref);
traits::SelectionContext::new(self).select(&obligation)
Expand Down
Loading