diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-09-03 08:05:54 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-09-03 08:05:54 -0700 |
| commit | 4a79633ad2ff5ce1641405daefc41a13d786dacf (patch) | |
| tree | 6297213c02a7d66d338089d3178434e36aa27733 /src/librustc | |
| parent | 28b518474ed2a5dee812e4f356f71f4c60628421 (diff) | |
| download | rust-4a79633ad2ff5ce1641405daefc41a13d786dacf.tar.gz rust-4a79633ad2ff5ce1641405daefc41a13d786dacf.zip | |
review comments
Diffstat (limited to 'src/librustc')
| -rw-r--r-- | src/librustc/traits/object_safety.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index 5392e9100c6..f7f459cd27f 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -60,13 +60,15 @@ impl ObjectSafetyViolation { ObjectSafetyViolation::Method(name, MethodViolationCode::Generic, _) => format!("method `{}` has generic type parameters", name).into(), ObjectSafetyViolation::Method(name, MethodViolationCode::UndispatchableReceiver, _) => - format!("method `{}`'s receiver cannot be dispatched on", name).into(), + format!("method `{}`'s `self` parameter cannot be dispatched on", name).into(), ObjectSafetyViolation::AssocConst(name, _) => format!("the trait cannot contain associated consts like `{}`", name).into(), } } pub fn span(&self) -> Option<Span> { + // When `span` comes from a separate crate, it'll be `DUMMY_SP`. Treat it as `None` so + // diagnostics use a `note` instead of a `span_label`. match *self { ObjectSafetyViolation::AssocConst(_, span) | ObjectSafetyViolation::Method(_, _, span) if span != DUMMY_SP => Some(span), |
