Improve spans for RPITIT object-safety errors
This commit is contained in:
parent
c4165f3a96
commit
9a9d0f40b8
5 changed files with 69 additions and 14 deletions
|
@ -924,10 +924,13 @@ impl ObjectSafetyViolation {
|
|||
}
|
||||
ObjectSafetyViolation::Method(
|
||||
name,
|
||||
MethodViolationCode::ReferencesImplTraitInTrait,
|
||||
MethodViolationCode::ReferencesImplTraitInTrait(_),
|
||||
_,
|
||||
) => format!("method `{}` references an `impl Trait` type in its return type", name)
|
||||
.into(),
|
||||
ObjectSafetyViolation::Method(name, MethodViolationCode::AsyncFn, _) => {
|
||||
format!("method `{}` is `async`", name).into()
|
||||
}
|
||||
ObjectSafetyViolation::Method(
|
||||
name,
|
||||
MethodViolationCode::WhereClauseReferencesSelf,
|
||||
|
@ -1035,7 +1038,10 @@ pub enum MethodViolationCode {
|
|||
ReferencesSelfOutput,
|
||||
|
||||
/// e.g., `fn foo(&self) -> impl Sized`
|
||||
ReferencesImplTraitInTrait,
|
||||
ReferencesImplTraitInTrait(Span),
|
||||
|
||||
/// e.g., `async fn foo(&self)`
|
||||
AsyncFn,
|
||||
|
||||
/// e.g., `fn foo(&self) where Self: Clone`
|
||||
WhereClauseReferencesSelf,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue