You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: compiler/rustc_hir_analysis/messages.ftl
+3
Original file line number
Diff line number
Diff line change
@@ -99,6 +99,9 @@ hir_analysis_coerce_pointee_not_struct = `derive(CoercePointee)` is only applica
99
99
100
100
hir_analysis_coerce_pointee_not_transparent = `derive(CoercePointee)` is only applicable to `struct` with `repr(transparent)` layout
101
101
102
+
hir_analysis_coerce_unsized_field_validity = for `{$ty}` to have a valid implementation of `{$trait_name}`, it must be possible to coerce the field of type `{$field_ty}`
103
+
.label = `{$field_ty}` must be a pointer, reference, or smart pointer that is allowed to be unsized
104
+
102
105
hir_analysis_coerce_unsized_may = the trait `{$trait_name}` may only be implemented for a coercion between structures
103
106
104
107
hir_analysis_coerce_zero = implementing `{$trait_name}` requires a field to be coerced
//~^ ERROR for `RcWithId<T>` to have a valid implementation of `CoerceUnsized`, it must be possible to coerce the field of type `Rc<(i32, Box<T>)>`
148
+
//~| ERROR for `RcWithId<T>` to have a valid implementation of `DispatchFromDyn`, it must be possible to coerce the field of type `Rc<(i32, Box<T>)>`
149
+
structRcWithId<T: ?Sized>{
150
+
inner: std::rc::Rc<(i32,Box<T>)>,
151
+
}
152
+
153
+
#[repr(transparent)]
154
+
#[derive(CoercePointee)]
155
+
//~^ ERROR implementing `CoerceUnsized` does not allow multiple fields to be coerced
156
+
//~| ERROR implementing `DispatchFromDyn` does not allow multiple fields to be coerced
157
+
structMoreThanOneField<T: ?Sized>{
158
+
//~^ ERROR transparent struct needs at most one field with non-trivial size or alignment, but has 2
159
+
inner1:Box<T>,
160
+
inner2:Box<T>,
161
+
}
162
+
163
+
structNotCoercePointeeData<T: ?Sized>(T);
164
+
165
+
#[repr(transparent)]
166
+
#[derive(CoercePointee)]
167
+
//~^ ERROR for `UsingNonCoercePointeeData<T>` to have a valid implementation of `CoerceUnsized`, it must be possible to coerce the field of type `NotCoercePointeeData<T>`
168
+
//~| ERROR for `UsingNonCoercePointeeData<T>` to have a valid implementation of `DispatchFromDyn`, it must be possible to coerce the field of type `NotCoercePointeeData<T>`
error: for `RcWithId<T>` to have a valid implementation of `DispatchFromDyn`, it must be possible to coerce the field of type `Rc<(i32, Box<T>)>`
122
+
--> $DIR/deriving-coerce-pointee-neg.rs:146:10
123
+
|
124
+
LL | #[derive(CoercePointee)]
125
+
| ^^^^^^^^^^^^^
126
+
...
127
+
LL | inner: std::rc::Rc<(i32, Box<T>)>,
128
+
| --------------------------------- `Rc<(i32, Box<T>)>` must be a pointer, reference, or smart pointer that is allowed to be unsized
129
+
|
130
+
= note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
131
+
132
+
error[E0375]: implementing `DispatchFromDyn` does not allow multiple fields to be coerced
133
+
--> $DIR/deriving-coerce-pointee-neg.rs:154:10
134
+
|
135
+
LL | #[derive(CoercePointee)]
136
+
| ^^^^^^^^^^^^^
137
+
|
138
+
note: the trait `DispatchFromDyn` may only be implemented when a single field is being coerced
139
+
--> $DIR/deriving-coerce-pointee-neg.rs:159:5
140
+
|
141
+
LL | inner1: Box<T>,
142
+
| ^^^^^^^^^^^^^^
143
+
LL | inner2: Box<T>,
144
+
| ^^^^^^^^^^^^^^
145
+
= note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
146
+
147
+
error: for `UsingNonCoercePointeeData<T>` to have a valid implementation of `DispatchFromDyn`, it must be possible to coerce the field of type `NotCoercePointeeData<T>`
| ----------------------- `NotCoercePointeeData<T>` must be a pointer, reference, or smart pointer that is allowed to be unsized
155
+
|
156
+
= note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
157
+
158
+
error: for `RcWithId<T>` to have a valid implementation of `CoerceUnsized`, it must be possible to coerce the field of type `Rc<(i32, Box<T>)>`
159
+
--> $DIR/deriving-coerce-pointee-neg.rs:146:10
160
+
|
161
+
LL | #[derive(CoercePointee)]
162
+
| ^^^^^^^^^^^^^
163
+
...
164
+
LL | inner: std::rc::Rc<(i32, Box<T>)>,
165
+
| --------------------------------- `Rc<(i32, Box<T>)>` must be a pointer, reference, or smart pointer that is allowed to be unsized
166
+
|
167
+
= note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
168
+
169
+
error[E0375]: implementing `CoerceUnsized` does not allow multiple fields to be coerced
170
+
--> $DIR/deriving-coerce-pointee-neg.rs:154:10
171
+
|
172
+
LL | #[derive(CoercePointee)]
173
+
| ^^^^^^^^^^^^^
174
+
|
175
+
note: the trait `CoerceUnsized` may only be implemented when a single field is being coerced
176
+
--> $DIR/deriving-coerce-pointee-neg.rs:159:5
177
+
|
178
+
LL | inner1: Box<T>,
179
+
| ^^^^^^^^^^^^^^
180
+
LL | inner2: Box<T>,
181
+
| ^^^^^^^^^^^^^^
182
+
= note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info)
183
+
184
+
error: for `UsingNonCoercePointeeData<T>` to have a valid implementation of `CoerceUnsized`, it must be possible to coerce the field of type `NotCoercePointeeData<T>`
0 commit comments