@@ -188,16 +188,6 @@ 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.
201
191
fn consider_builtin_sized_candidate (
202
192
ecx : & mut EvalCtxt < ' _ , ' tcx > ,
203
193
goal : Goal < ' tcx , Self > ,
@@ -212,20 +202,6 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
212
202
)
213
203
}
214
204
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.
229
205
fn consider_builtin_copy_clone_candidate (
230
206
ecx : & mut EvalCtxt < ' _ , ' tcx > ,
231
207
goal : Goal < ' tcx , Self > ,
@@ -240,9 +216,6 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
240
216
)
241
217
}
242
218
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
246
219
fn consider_builtin_pointer_like_candidate (
247
220
ecx : & mut EvalCtxt < ' _ , ' tcx > ,
248
221
goal : Goal < ' tcx , Self > ,
@@ -272,25 +245,21 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
272
245
}
273
246
}
274
247
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.
281
248
fn consider_builtin_fn_ptr_trait_candidate (
282
249
ecx : & mut EvalCtxt < ' _ , ' tcx > ,
283
250
goal : Goal < ' tcx , Self > ,
284
251
) -> QueryResult < ' tcx > {
285
252
let self_ty = goal. predicate . self_ty ( ) ;
286
253
match goal. predicate . polarity {
254
+ // impl FnPtr for FnPtr {}
287
255
ty:: ImplPolarity :: Positive => {
288
256
if self_ty. is_fn_ptr ( ) {
289
257
ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: Yes )
290
258
} else {
291
259
Err ( NoSolution )
292
260
}
293
261
}
262
+ // impl !FnPtr for T where T != FnPtr && T is rigid {}
294
263
ty:: ImplPolarity :: Negative => {
295
264
// If a type is rigid and not a fn ptr, then we know for certain
296
265
// that it does *not* implement `FnPtr`.
0 commit comments