@@ -20,7 +20,7 @@ use std::borrow::Cow;
20
20
use std:: iter:: { self } ;
21
21
use syntax:: ast:: { self } ;
22
22
use syntax:: symbol:: InternedString ;
23
- use syntax_pos:: Span ;
23
+ use syntax_pos:: { Span , DUMMY_SP } ;
24
24
25
25
#[ derive( Copy , Clone , Debug , PartialEq , Eq , Hash ) ]
26
26
pub enum ObjectSafetyViolation {
@@ -49,7 +49,7 @@ impl ObjectSafetyViolation {
49
49
ObjectSafetyViolation :: Method ( name, MethodViolationCode :: StaticMethod , _) =>
50
50
format ! ( "associated function `{}` has no `self` parameter" , name) . into ( ) ,
51
51
ObjectSafetyViolation :: Method ( name, MethodViolationCode :: ReferencesSelf , _) => format ! (
52
- "method `{}` references the `Self` type in its arguments or return type" ,
52
+ "method `{}` references the `Self` type in its parameters or return type" ,
53
53
name,
54
54
) . into ( ) ,
55
55
ObjectSafetyViolation :: Method (
@@ -67,9 +67,9 @@ impl ObjectSafetyViolation {
67
67
}
68
68
69
69
pub fn span ( & self ) -> Option < Span > {
70
- match self {
70
+ match * self {
71
71
ObjectSafetyViolation :: AssocConst ( _, span) |
72
- ObjectSafetyViolation :: Method ( _, _, span) = > Some ( * span) ,
72
+ ObjectSafetyViolation :: Method ( _, _, span) if span != DUMMY_SP = > Some ( span) ,
73
73
_ => None ,
74
74
}
75
75
}
0 commit comments