Skip to content

Commit

Permalink
Change wording for object unsafe because of assoc const
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Feb 3, 2020
1 parent b9c125a commit 0e58411
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
8 changes: 3 additions & 5 deletions src/librustc/traits/object_safety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/associated-item/issue-48027.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/traits/trait-item-privacy.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0e58411

Please sign in to comment.