Skip to content

Commit cb56b1a

Browse files
committed
Fix comment that refers to dead enforce_object_limitations function.
1 parent 6513f50 commit cb56b1a

File tree

1 file changed

+6
-7
lines changed
  • compiler/rustc_typeck/src/check/method

1 file changed

+6
-7
lines changed

Diff for: compiler/rustc_typeck/src/check/method/probe.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -765,13 +765,12 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
765765
)
766766
});
767767

768-
// It is illegal to invoke a method on a trait instance that
769-
// refers to the `Self` type. An error will be reported by
770-
// `enforce_object_limitations()` if the method refers to the
771-
// `Self` type anywhere other than the receiver. Here, we use
772-
// a substitution that replaces `Self` with the object type
773-
// itself. Hence, a `&self` method will wind up with an
774-
// argument type like `&Trait`.
768+
// It is illegal to invoke a method on a trait instance that refers to
769+
// the `Self` type. An [`ObjectSafetyViolation::SupertraitSelf`] error
770+
// will be reported by `object_safety.rs` if the method refers to the
771+
// `Self` type anywhere other than the receiver. Here, we use a
772+
// substitution that replaces `Self` with the object type itself. Hence,
773+
// a `&self` method will wind up with an argument type like `&Trait`.
775774
let trait_ref = principal.with_self_ty(self.tcx, self_ty);
776775
self.elaborate_bounds(iter::once(trait_ref), |this, new_trait_ref, item| {
777776
let new_trait_ref = this.erase_late_bound_regions(new_trait_ref);

0 commit comments

Comments
 (0)