@@ -188,6 +188,16 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
188
188
} )
189
189
}
190
190
191
+ /// ```rust,ignore (not valid rust syntax)
192
+ /// impl Sized for u*, i*, bool, f*, FnPtr, FnDef, *(const/mut) T, char, &mut? T, [T; N], dyn* Trait, !
193
+ ///
194
+ /// impl Sized for (T1, T2, .., Tn) where T1: Sized, T2: Sized, .. Tn: Sized
195
+ ///
196
+ /// impl Sized for Adt where T: Sized forall T in field types
197
+ /// ```
198
+ ///
199
+ /// note that `[T; N]` is unconditionally sized since `T: Sized` is required for the array type to be
200
+ /// well-formed.
191
201
fn consider_builtin_sized_candidate (
192
202
ecx : & mut EvalCtxt < ' _ , ' tcx > ,
193
203
goal : Goal < ' tcx , Self > ,
@@ -202,6 +212,20 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
202
212
)
203
213
}
204
214
215
+ /// ```rust,ignore (not valid rust syntax)
216
+ /// impl Copy/Clone for FnDef, FnPtr
217
+ ///
218
+ /// impl Copy/Clone for (T1, T2, .., Tn) where T1: Copy/Clone, T2: Copy/Clone, .. Tn: Copy/Clone
219
+ ///
220
+ /// impl Copy/Clone for Closure where T: Copy/Clone forall T in upvars
221
+ ///
222
+ /// // only when `coroutine_clone` is enabled and the coroutine is movable
223
+ /// impl Copy/Clone for Coroutine where T: Copy/Clone forall T in (upvars, witnesses)
224
+ ///
225
+ /// impl Copy/Clone for CoroutineWitness where T: Copy/Clone forall T in coroutine_hidden_types
226
+ /// ```
227
+ ///
228
+ /// Some built-in types don't have built-in impls because they can be implemented within the standard library.
205
229
fn consider_builtin_copy_clone_candidate (
206
230
ecx : & mut EvalCtxt < ' _ , ' tcx > ,
207
231
goal : Goal < ' tcx , Self > ,
@@ -216,6 +240,9 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
216
240
)
217
241
}
218
242
243
+ /// Implements `PointerLike` for types that are pointer-sized, pointer-aligned,
244
+ /// and have a initialized (non-union), scalar ABI.
245
+ // Please also update compiler/rustc_target/src/abi/mod.rs if the criteria changes
219
246
fn consider_builtin_pointer_like_candidate (
220
247
ecx : & mut EvalCtxt < ' _ , ' tcx > ,
221
248
goal : Goal < ' tcx , Self > ,
@@ -245,6 +272,12 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
245
272
}
246
273
}
247
274
275
+ /// ```rust,ignore (not valid rust syntax)
276
+ /// impl FnPtr for FnPtr {}
277
+ /// impl !FnPtr for T where T != FnPtr && T is rigid {}
278
+ /// ```
279
+ ///
280
+ /// Note: see [`Ty::is_known_rigid`] for what it means for the type to be rigid.
248
281
fn consider_builtin_fn_ptr_trait_candidate (
249
282
ecx : & mut EvalCtxt < ' _ , ' tcx > ,
250
283
goal : Goal < ' tcx , Self > ,
@@ -375,6 +408,12 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
375
408
}
376
409
}
377
410
411
+ /// ```rust, ignore (not valid rust syntax)
412
+ /// impl Tuple for () {}
413
+ /// impl Tuple for (T1,) {}
414
+ /// impl Tuple for (T1, T2) {}
415
+ /// impl Tuple for (T1, .., Tn) {}
416
+ /// ```
378
417
fn consider_builtin_tuple_candidate (
379
418
ecx : & mut EvalCtxt < ' _ , ' tcx > ,
380
419
goal : Goal < ' tcx , Self > ,
0 commit comments