From 74ef46cfa2c7d8befbd82faf973268957d5b718d Mon Sep 17 00:00:00 2001 From: Michael Hewson Date: Mon, 8 Oct 2018 20:37:58 -0400 Subject: [PATCH] Replace UncoeribleReceiver error message with UndispatchableReceiver --- src/librustc/traits/object_safety.rs | 10 +++++----- .../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 5e7a3043ae73..cd7e2774371f 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()` 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 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 715fc86517be..77ca118471db 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; | ^^^^^^^ 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; | ^^^^^^^^^^^^^^^ 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>` for `std::rc::Rc` error: aborting due to 2 previous errors