diff options
| author | Michael Hewson <michael@michaelhewson.ca> | 2018-10-08 20:37:58 -0400 |
|---|---|---|
| committer | Michael Hewson <michael@michaelhewson.ca> | 2018-11-01 18:16:59 -0400 |
| commit | 74ef46cfa2c7d8befbd82faf973268957d5b718d (patch) | |
| tree | 009fecb378f905157c0c6ccd96b14bbe82fc1020 | |
| parent | 3c56d8d0c21e15be8ea41835c647a0caecc0d0da (diff) | |
| download | rust-74ef46cfa2c7d8befbd82faf973268957d5b718d.tar.gz rust-74ef46cfa2c7d8befbd82faf973268957d5b718d.zip | |
Replace UncoeribleReceiver error message with UndispatchableReceiver
| -rw-r--r-- | src/librustc/traits/object_safety.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/arbitrary-self-types-not-object-safe.stderr | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index 5e7a3043ae7..cd7e2774371 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -64,8 +64,8 @@ impl ObjectSafetyViolation { format!("method `{}` references the `Self` type in where clauses", name).into(), ObjectSafetyViolation::Method(name, MethodViolationCode::Generic) => format!("method `{}` has generic type parameters", name).into(), - ObjectSafetyViolation::Method(name, MethodViolationCode::UncoercibleReceiver) => - format!("method `{}` has an uncoercible receiver type", name).into(), + ObjectSafetyViolation::Method(name, MethodViolationCode::UndispatchableReceiver) => + format!("method `{}`'s receiver cannot be dispatched on", name).into(), ObjectSafetyViolation::AssociatedConst(name) => format!("the trait cannot contain associated consts like `{}`", name).into(), } @@ -87,8 +87,8 @@ pub enum MethodViolationCode { /// e.g., `fn foo<A>()` Generic, - /// the self argument can't be coerced from Self=dyn Trait to Self=T where T: Trait - UncoercibleReceiver, + /// the method's receiver (`self` argument) can't be dispatched on + UndispatchableReceiver, } impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { @@ -325,7 +325,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { // `Receiver: Unsize<Receiver[Self => dyn Trait]>` if receiver_ty != self.mk_self_type() { if !self.receiver_is_dispatchable(method, receiver_ty) { - return Some(MethodViolationCode::UncoercibleReceiver); + return Some(MethodViolationCode::UndispatchableReceiver); } } diff --git a/src/test/ui/arbitrary-self-types-not-object-safe.stderr b/src/test/ui/arbitrary-self-types-not-object-safe.stderr index 715fc86517b..77ca118471d 100644 --- a/src/test/ui/arbitrary-self-types-not-object-safe.stderr +++ b/src/test/ui/arbitrary-self-types-not-object-safe.stderr @@ -4,7 +4,7 @@ error[E0038]: the trait `Foo` cannot be made into an object LL | let x = Rc::new(5usize) as Rc<Foo>; | ^^^^^^^ the trait `Foo` cannot be made into an object | - = note: method `foo` has an uncoercible receiver type + = note: method `foo`'s receiver cannot be dispatched on error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/arbitrary-self-types-not-object-safe.rs:40:13 @@ -12,7 +12,7 @@ error[E0038]: the trait `Foo` cannot be made into an object LL | let x = Rc::new(5usize) as Rc<Foo>; | ^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | - = note: method `foo` has an uncoercible receiver type + = note: method `foo`'s receiver cannot be dispatched on = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::rc::Rc<dyn Foo>>` for `std::rc::Rc<usize>` error: aborting due to 2 previous errors |
