Deny RPITIT for object safety

This commit is contained in:
Michael Goulet
2022-09-11 09:13:55 +00:00
parent 1463688700
commit 89b6488ef0
4 changed files with 107 additions and 0 deletions

View File

@@ -908,6 +908,12 @@ impl ObjectSafetyViolation {
ObjectSafetyViolation::Method(name, MethodViolationCode::ReferencesSelfOutput, _) => {
format!("method `{}` references the `Self` type in its return type", name).into()
}
ObjectSafetyViolation::Method(
name,
MethodViolationCode::ReferencesImplTraitInTrait,
_,
) => format!("method `{}` references an `impl Trait` type in its return type", name)
.into(),
ObjectSafetyViolation::Method(
name,
MethodViolationCode::WhereClauseReferencesSelf,
@@ -1014,6 +1020,9 @@ pub enum MethodViolationCode {
/// e.g., `fn foo(&self) -> Self`
ReferencesSelfOutput,
/// e.g., `fn foo(&self) -> impl Sized`
ReferencesImplTraitInTrait,
/// e.g., `fn foo(&self) where Self: Clone`
WhereClauseReferencesSelf,