Skip to content
Open
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
10 changes: 9 additions & 1 deletion compiler/rustc_middle/src/ty/predicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,17 @@ impl<'tcx> Clause<'tcx> {
}

pub fn kind(self) -> ty::Binder<'tcx, ClauseKind<'tcx>> {
// Outline the unreachable! call to make the happy path faster.
// see: https://github.com/rust-lang/rust/pull/163657#issuecomment-5956974964
#[cold]

@lcnr lcnr Oct 2, 2026 •

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.

can you put a comment here referencing this perf run, r=me after

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks ;) but I don't have r+ rights to approve this

#[inline(never)]
fn unreachable_inner() -> ! {
unreachable!()
}

self.0.internee.map_bound_no_validate_bound_vars(|kind| match kind {
PredicateKind::Clause(clause) => clause,
_ => unreachable!(),
_ => unreachable_inner(),
})
}

Expand Down
Loading