Change wording for object unsafe because of assoc const

This commit is contained in:
Esteban Küber 2020-02-03 10:43:45 -08:00
parent b9c125af75
commit 0e584114c6
6 changed files with 10 additions and 12 deletions

View File

@ -80,12 +80,10 @@ impl ObjectSafetyViolation {
ObjectSafetyViolation::Method(name, MethodViolationCode::UndispatchableReceiver, _) => {
format!("method `{}`'s `self` parameter cannot be dispatched on", name).into()
}
ObjectSafetyViolation::AssocConst(_, DUMMY_SP) => {
"it cannot contain associated consts".into()
}
ObjectSafetyViolation::AssocConst(name, _) => {
format!("it cannot contain associated consts like `{}`", name).into()
ObjectSafetyViolation::AssocConst(name, DUMMY_SP) => {
format!("it contains associated `const` `{}`", name).into()
}
ObjectSafetyViolation::AssocConst(..) => "it contains this associated `const`".into(),
}
}

View File

@ -4,7 +4,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
LL | trait Trait {
| ----- this trait cannot be made into an object...
LL | const N: usize;
| - ...because it cannot contain associated consts like `N`
| - ...because it contains this associated `const`
...
LL | impl dyn Trait {
| ^^^^^^^^^ the trait `Trait` cannot be made into an object

View File

@ -4,7 +4,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
LL | trait Bar {
| --- this trait cannot be made into an object...
LL | const X: usize;
| - ...because it cannot contain associated consts like `X`
| - ...because it contains this associated `const`
...
LL | impl dyn Bar {}
| ^^^^^^^ the trait `Bar` cannot be made into an object

View File

@ -4,7 +4,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
LL | trait Bar {
| --- this trait cannot be made into an object...
LL | const X: usize;
| - ...because it cannot contain associated consts like `X`
| - ...because it contains this associated `const`
...
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^ the trait `Bar` cannot be made into an object

View File

@ -4,7 +4,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
LL | trait Bar {
| --- this trait cannot be made into an object...
LL | const X: usize;
| - ...because it cannot contain associated consts like `X`
| - ...because it contains this associated `const`
...
LL | t
| ^ the trait `Bar` cannot be made into an object

View File

@ -111,15 +111,15 @@ error[E0038]: the trait `assoc_const::C` cannot be made into an object
--> $DIR/trait-item-privacy.rs:101:5
|
LL | const A: u8 = 0;
| - ...because it cannot contain associated consts like `A`
| - ...because it contains this associated `const`
...
LL | const B: u8 = 0;
| - ...because it cannot contain associated consts like `B`
| - ...because it contains this associated `const`
...
LL | pub trait C: A + B {
| - this trait cannot be made into an object...
LL | const C: u8 = 0;
| - ...because it cannot contain associated consts like `C`
| - ...because it contains this associated `const`
...
LL | C::A;
| ^^^^ the trait `assoc_const::C` cannot be made into an object