diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-07-30 12:14:08 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@tasking.com> | 2023-10-25 20:23:43 +0000 |
| commit | 6cb33764341e6a2a9b2b2c2b881204b54e52858b (patch) | |
| tree | cfdb9b0bb88febd495c226240ef2a9f67fcbd707 /compiler/rustc_trait_selection/src | |
| parent | 94c9d0c90f6bb6f7d8fdc6e326e148e7b5bb30cf (diff) | |
| download | rust-6cb33764341e6a2a9b2b2c2b881204b54e52858b.tar.gz rust-6cb33764341e6a2a9b2b2c2b881204b54e52858b.zip | |
Add a comment explaining some weird `is_vtable_safe_method` behavior
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/object_safety.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/object_safety.rs b/compiler/rustc_trait_selection/src/traits/object_safety.rs index 1dbe3039107..9984a3cbb29 100644 --- a/compiler/rustc_trait_selection/src/traits/object_safety.rs +++ b/compiler/rustc_trait_selection/src/traits/object_safety.rs @@ -97,6 +97,10 @@ fn check_is_object_safe(tcx: TyCtxt<'_>, trait_def_id: DefId) -> bool { /// object. Note that object-safe traits can have some /// non-vtable-safe methods, so long as they require `Self: Sized` or /// otherwise ensure that they cannot be used when `Self = Trait`. +/// +/// [`MethodViolationCode::WhereClauseReferencesSelf`] is considered object safe due to backwards +/// compatibility, see <https://github.com/rust-lang/rust/issues/51443> and +/// [`WHERE_CLAUSES_OBJECT_SAFETY`]. pub fn is_vtable_safe_method(tcx: TyCtxt<'_>, trait_def_id: DefId, method: ty::AssocItem) -> bool { debug_assert!(tcx.generics_of(trait_def_id).has_self); debug!("is_vtable_safe_method({:?}, {:?})", trait_def_id, method); |
