Skip to content

Commit 0bd9ecd

Browse files
possible rewording of diagnostics
1 parent 31e8e2e commit 0bd9ecd

14 files changed

+37
-19
lines changed

compiler/rustc_hir_analysis/messages.ftl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ hir_analysis_invalid_receiver_ty_help =
264264
consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box<Self>`, `self: Rc<Self>`, or `self: Arc<Self>`
265265
266266
hir_analysis_invalid_receiver_ty_help_no_arbitrary_self_types =
267-
consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
267+
consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`);
268+
alternatively, consider implement `Receiver` trait on the type of `self`, where applicable
268269
269270
hir_analysis_invalid_receiver_ty_help_nonnull_note =
270271
`NonNull` does not implement `Receiver` because it has methods that may shadow the referent; consider wrapping your `NonNull` in a newtype wrapper for which you implement `Receiver`

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1815,7 +1815,7 @@ fn receiver_is_valid<'tcx>(
18151815
let mut autoderef = Autoderef::new(infcx, wfcx.param_env, wfcx.body_def_id, span, receiver_ty);
18161816

18171817
// The `arbitrary_self_types` feature allows custom smart pointer
1818-
// types to be method receivers, as identified by following the Receiver<Target=T>
1818+
// types to be method receivers, as identified by following the Receiver<Target = T>
18191819
// chain.
18201820
if arbitrary_self_types_enabled.is_some() {
18211821
// We are in the wf check, so we would like to deref the references in the type head.

tests/ui/abi/invalid-self-parameter-type-56806.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | fn dyn_instead_of_self(self: Box<dyn Trait>);
55
| ^^^^^^^^^^^^^^
66
|
77
= note: type of `self` must be `Self` or a type that dereferences to it
8-
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
8+
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`);
9+
alternatively, consider implement `Receiver` trait on the type of `self`, where applicable
910

1011
error: aborting due to 1 previous error
1112

tests/ui/async-await/inference_var_self_argument.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | async fn foo(self: &dyn Foo) {
55
| ^^^^^^^^
66
|
77
= note: type of `self` must be `Self` or a type that dereferences to it
8-
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
8+
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`);
9+
alternatively, consider implement `Receiver` trait on the type of `self`, where applicable
910

1011
error[E0038]: the trait `Foo` is not dyn compatible
1112
--> $DIR/inference_var_self_argument.rs:5:5

tests/ui/async-await/issue-66312.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | fn is_some(self: T);
55
| ^
66
|
77
= note: type of `self` must be `Self` or a type that dereferences to it
8-
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
8+
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`);
9+
alternatively, consider implement `Receiver` trait on the type of `self`, where applicable
910

1011
error[E0308]: mismatched types
1112
--> $DIR/issue-66312.rs:9:8

tests/ui/feature-gates/feature-gate-arbitrary-self-types.stderr

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | fn foo(self: Ptr<Self>) {}
55
| ^^^^^^^^^
66
|
77
= note: type of `self` must be `Self` or a type that dereferences to it
8-
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
8+
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`);
9+
alternatively, consider implement `Receiver` trait on the type of `self`, where applicable
910

1011
error[E0307]: invalid `self` parameter type: `Box<Ptr<Bar>>`
1112
--> $DIR/feature-gate-arbitrary-self-types.rs:24:18
@@ -14,7 +15,8 @@ LL | fn bar(self: Box<Ptr<Self>>) {}
1415
| ^^^^^^^^^^^^^^
1516
|
1617
= note: type of `self` must be `Self` or a type that dereferences to it
17-
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
18+
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`);
19+
alternatively, consider implement `Receiver` trait on the type of `self`, where applicable
1820

1921
error[E0307]: invalid `self` parameter type: `Ptr<Self>`
2022
--> $DIR/feature-gate-arbitrary-self-types.rs:14:18
@@ -23,7 +25,8 @@ LL | fn foo(self: Ptr<Self>);
2325
| ^^^^^^^^^
2426
|
2527
= note: type of `self` must be `Self` or a type that dereferences to it
26-
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
28+
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`);
29+
alternatively, consider implement `Receiver` trait on the type of `self`, where applicable
2730

2831
error: aborting due to 3 previous errors
2932

tests/ui/feature-gates/feature-gate-dispatch-from-dyn-cell.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | fn cell(self: Cell<&Self>);
55
| ^^^^^^^^^^^
66
|
77
= note: type of `self` must be `Self` or a type that dereferences to it
8-
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
8+
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`);
9+
alternatively, consider implement `Receiver` trait on the type of `self`, where applicable
910

1011
error: aborting due to 1 previous error
1112

tests/ui/self/arbitrary-self-from-method-substs.default.stderr

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ LL | fn get6<FR: FindReceiver>(self: FR::Receiver, other: FR) -> u32 {
5959
| ^^^^^^^^^^^^
6060
|
6161
= note: type of `self` must be `Self` or a type that dereferences to it
62-
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
62+
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`);
63+
alternatively, consider implement `Receiver` trait on the type of `self`, where applicable
6364

6465
error[E0307]: invalid `self` parameter type: `R`
6566
--> $DIR/arbitrary-self-from-method-substs.rs:102:18
@@ -68,7 +69,8 @@ LL | fn get(self: R) {}
6869
| ^
6970
|
7071
= note: type of `self` must be `Self` or a type that dereferences to it
71-
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
72+
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`);
73+
alternatively, consider implement `Receiver` trait on the type of `self`, where applicable
7274

7375
error[E0271]: type mismatch resolving `<Silly as FindReceiver>::Receiver == Foo`
7476
--> $DIR/arbitrary-self-from-method-substs.rs:136:9

tests/ui/self/arbitrary-self-opaque.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ LL | fn foo(self: Bar) {}
55
| ^^^
66
|
77
= note: type of `self` must be `Self` or a type that dereferences to it
8-
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
8+
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`);
9+
alternatively, consider implement `Receiver` trait on the type of `self`, where applicable
910

1011
error: item does not constrain `Bar::{opaque#0}`
1112
--> $DIR/arbitrary-self-opaque.rs:8:8

tests/ui/self/dispatch-dyn-incompatible-that-does-not-deref.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ LL | fn method(self: &W) {}
2323
| ^^
2424
|
2525
= note: type of `self` must be `Self` or a type that dereferences to it
26-
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
26+
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`);
27+
alternatively, consider implement `Receiver` trait on the type of `self`, where applicable
2728

2829
error[E0038]: the trait `Foo` is not dyn compatible
2930
--> $DIR/dispatch-dyn-incompatible-that-does-not-deref.rs:14:5

0 commit comments

Comments
 (0)