Skip to content

Commit 6cb3376

Browse files
committed
Add a comment explaining some weird is_vtable_safe_method behavior
1 parent 94c9d0c commit 6cb3376

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_trait_selection/src/traits/object_safety.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ fn check_is_object_safe(tcx: TyCtxt<'_>, trait_def_id: DefId) -> bool {
9797
/// object. Note that object-safe traits can have some
9898
/// non-vtable-safe methods, so long as they require `Self: Sized` or
9999
/// otherwise ensure that they cannot be used when `Self = Trait`.
100+
///
101+
/// [`MethodViolationCode::WhereClauseReferencesSelf`] is considered object safe due to backwards
102+
/// compatibility, see <https://github.com/rust-lang/rust/issues/51443> and
103+
/// [`WHERE_CLAUSES_OBJECT_SAFETY`].
100104
pub fn is_vtable_safe_method(tcx: TyCtxt<'_>, trait_def_id: DefId, method: ty::AssocItem) -> bool {
101105
debug_assert!(tcx.generics_of(trait_def_id).has_self);
102106
debug!("is_vtable_safe_method({:?}, {:?})", trait_def_id, method);

0 commit comments

Comments
 (0)