Skip to content

Commit 74ef46c

Browse files
committed
Replace UncoeribleReceiver error message with UndispatchableReceiver
1 parent 3c56d8d commit 74ef46c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/librustc/traits/object_safety.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ impl ObjectSafetyViolation {
6464
format!("method `{}` references the `Self` type in where clauses", name).into(),
6565
ObjectSafetyViolation::Method(name, MethodViolationCode::Generic) =>
6666
format!("method `{}` has generic type parameters", name).into(),
67-
ObjectSafetyViolation::Method(name, MethodViolationCode::UncoercibleReceiver) =>
68-
format!("method `{}` has an uncoercible receiver type", name).into(),
67+
ObjectSafetyViolation::Method(name, MethodViolationCode::UndispatchableReceiver) =>
68+
format!("method `{}`'s receiver cannot be dispatched on", name).into(),
6969
ObjectSafetyViolation::AssociatedConst(name) =>
7070
format!("the trait cannot contain associated consts like `{}`", name).into(),
7171
}
@@ -87,8 +87,8 @@ pub enum MethodViolationCode {
8787
/// e.g., `fn foo<A>()`
8888
Generic,
8989

90-
/// the self argument can't be coerced from Self=dyn Trait to Self=T where T: Trait
91-
UncoercibleReceiver,
90+
/// the method's receiver (`self` argument) can't be dispatched on
91+
UndispatchableReceiver,
9292
}
9393

9494
impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
@@ -325,7 +325,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
325325
// `Receiver: Unsize<Receiver[Self => dyn Trait]>`
326326
if receiver_ty != self.mk_self_type() {
327327
if !self.receiver_is_dispatchable(method, receiver_ty) {
328-
return Some(MethodViolationCode::UncoercibleReceiver);
328+
return Some(MethodViolationCode::UndispatchableReceiver);
329329
}
330330
}
331331

src/test/ui/arbitrary-self-types-not-object-safe.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ error[E0038]: the trait `Foo` cannot be made into an object
44
LL | let x = Rc::new(5usize) as Rc<Foo>;
55
| ^^^^^^^ the trait `Foo` cannot be made into an object
66
|
7-
= note: method `foo` has an uncoercible receiver type
7+
= note: method `foo`'s receiver cannot be dispatched on
88

99
error[E0038]: the trait `Foo` cannot be made into an object
1010
--> $DIR/arbitrary-self-types-not-object-safe.rs:40:13
1111
|
1212
LL | let x = Rc::new(5usize) as Rc<Foo>;
1313
| ^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
1414
|
15-
= note: method `foo` has an uncoercible receiver type
15+
= note: method `foo`'s receiver cannot be dispatched on
1616
= note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::rc::Rc<dyn Foo>>` for `std::rc::Rc<usize>`
1717

1818
error: aborting due to 2 previous errors

0 commit comments

Comments
 (0)