Skip to content

Commit 0e58411

Browse files
committed
Change wording for object unsafe because of assoc const
1 parent b9c125a commit 0e58411

File tree

6 files changed

+10
-12
lines changed

6 files changed

+10
-12
lines changed

src/librustc/traits/object_safety.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,10 @@ impl ObjectSafetyViolation {
8080
ObjectSafetyViolation::Method(name, MethodViolationCode::UndispatchableReceiver, _) => {
8181
format!("method `{}`'s `self` parameter cannot be dispatched on", name).into()
8282
}
83-
ObjectSafetyViolation::AssocConst(_, DUMMY_SP) => {
84-
"it cannot contain associated consts".into()
85-
}
86-
ObjectSafetyViolation::AssocConst(name, _) => {
87-
format!("it cannot contain associated consts like `{}`", name).into()
83+
ObjectSafetyViolation::AssocConst(name, DUMMY_SP) => {
84+
format!("it contains associated `const` `{}`", name).into()
8885
}
86+
ObjectSafetyViolation::AssocConst(..) => "it contains this associated `const`".into(),
8987
}
9088
}
9189

src/test/ui/associated-const/associated-const-in-trait.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0038]: the trait `Trait` cannot be made into an object
44
LL | trait Trait {
55
| ----- this trait cannot be made into an object...
66
LL | const N: usize;
7-
| - ...because it cannot contain associated consts like `N`
7+
| - ...because it contains this associated `const`
88
...
99
LL | impl dyn Trait {
1010
| ^^^^^^^^^ the trait `Trait` cannot be made into an object

src/test/ui/associated-item/issue-48027.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
44
LL | trait Bar {
55
| --- this trait cannot be made into an object...
66
LL | const X: usize;
7-
| - ...because it cannot contain associated consts like `X`
7+
| - ...because it contains this associated `const`
88
...
99
LL | impl dyn Bar {}
1010
| ^^^^^^^ the trait `Bar` cannot be made into an object

src/test/ui/object-safety/object-safety-associated-consts.curr.stderr

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

src/test/ui/object-safety/object-safety-associated-consts.object_safe_for_dispatch.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0038]: the trait `Bar` cannot be made into an object
44
LL | trait Bar {
55
| --- this trait cannot be made into an object...
66
LL | const X: usize;
7-
| - ...because it cannot contain associated consts like `X`
7+
| - ...because it contains this associated `const`
88
...
99
LL | t
1010
| ^ the trait `Bar` cannot be made into an object

src/test/ui/traits/trait-item-privacy.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ error[E0038]: the trait `assoc_const::C` cannot be made into an object
111111
--> $DIR/trait-item-privacy.rs:101:5
112112
|
113113
LL | const A: u8 = 0;
114-
| - ...because it cannot contain associated consts like `A`
114+
| - ...because it contains this associated `const`
115115
...
116116
LL | const B: u8 = 0;
117-
| - ...because it cannot contain associated consts like `B`
117+
| - ...because it contains this associated `const`
118118
...
119119
LL | pub trait C: A + B {
120120
| - this trait cannot be made into an object...
121121
LL | const C: u8 = 0;
122-
| - ...because it cannot contain associated consts like `C`
122+
| - ...because it contains this associated `const`
123123
...
124124
LL | C::A;
125125
| ^^^^ the trait `assoc_const::C` cannot be made into an object

0 commit comments

Comments
 (0)