Skip to content
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
3 changes: 2 additions & 1 deletion compiler/rustc_middle/src/ty/predicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ impl<'tcx> Clause<'tcx> {
pub fn kind(self) -> ty::Binder<'tcx, ClauseKind<'tcx>> {
self.0.internee.map_bound(|kind| match kind {
PredicateKind::Clause(clause) => clause,
_ => unreachable!(),
// SAFETY: This function is incredibly hot. Let's make it optimize better.
_ => unsafe { std::hint::unreachable_unchecked() },
Comment on lines +176 to +177

@lcnr lcnr Oct 2, 2026 •

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.

I don't understand safety comments apparently. This is not a safety comment

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

// HOTNESS: This function is incredibly hot.

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.

Now the big problem, is that it's non-trivial to actually make this safe. THis field is public and the best commit is "while pub(super), nobody constructs a clause from something that's not a PredicateKind::Clause"

})
}

Expand Down
Loading