about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-09-02 22:11:29 -0700
committerEsteban Küber <esteban@kuber.com.ar>2019-09-02 22:11:29 -0700
commitefe85943b3a5e7b3920db5a5a53183c75fc80d0c (patch)
tree6ad4646e21995f1227fec9c905c02c7926c16a42 /src/librustc
parentbb99fc31d0a8f962662e636938cf96f0f70d3803 (diff)
downloadrust-efe85943b3a5e7b3920db5a5a53183c75fc80d0c.tar.gz
rust-efe85943b3a5e7b3920db5a5a53183c75fc80d0c.zip
account for DUMMY_SP and correct wording
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/error_codes.rs2
-rw-r--r--src/librustc/traits/object_safety.rs8
2 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc/error_codes.rs b/src/librustc/error_codes.rs
index 2d09013f675..937a9ea6c1b 100644
--- a/src/librustc/error_codes.rs
+++ b/src/librustc/error_codes.rs
@@ -39,7 +39,7 @@ Generally, `Self: Sized` is used to indicate that the trait should not be used
 as a trait object. If the trait comes from your own crate, consider removing
 this restriction.
 
-### Method references the `Self` type in its arguments or return type
+### Method references the `Self` type in its parameters or return type
 
 This happens when a trait has a method like the following:
 
diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs
index 50f497e302e..5392e9100c6 100644
--- a/src/librustc/traits/object_safety.rs
+++ b/src/librustc/traits/object_safety.rs
@@ -20,7 +20,7 @@ use std::borrow::Cow;
 use std::iter::{self};
 use syntax::ast::{self};
 use syntax::symbol::InternedString;
-use syntax_pos::Span;
+use syntax_pos::{Span, DUMMY_SP};
 
 #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
 pub enum ObjectSafetyViolation {
@@ -49,7 +49,7 @@ impl ObjectSafetyViolation {
             ObjectSafetyViolation::Method(name, MethodViolationCode::StaticMethod, _) =>
                 format!("associated function `{}` has no `self` parameter", name).into(),
             ObjectSafetyViolation::Method(name, MethodViolationCode::ReferencesSelf, _) => format!(
-                "method `{}` references the `Self` type in its arguments or return type",
+                "method `{}` references the `Self` type in its parameters or return type",
                 name,
             ).into(),
             ObjectSafetyViolation::Method(
@@ -67,9 +67,9 @@ impl ObjectSafetyViolation {
     }
 
     pub fn span(&self) -> Option<Span> {
-        match self {
+        match *self {
             ObjectSafetyViolation::AssocConst(_, span) |
-            ObjectSafetyViolation::Method(_, _, span) => Some(*span),
+            ObjectSafetyViolation::Method(_, _, span) if span != DUMMY_SP => Some(span),
             _ => None,
         }
     }