@@ -188,16 +188,6 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
188188 } )
189189 }
190190
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.
201191 fn consider_builtin_sized_candidate (
202192 ecx : & mut EvalCtxt < ' _ , ' tcx > ,
203193 goal : Goal < ' tcx , Self > ,
@@ -212,20 +202,6 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
212202 )
213203 }
214204
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.
229205 fn consider_builtin_copy_clone_candidate (
230206 ecx : & mut EvalCtxt < ' _ , ' tcx > ,
231207 goal : Goal < ' tcx , Self > ,
@@ -240,9 +216,6 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
240216 )
241217 }
242218
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
246219 fn consider_builtin_pointer_like_candidate (
247220 ecx : & mut EvalCtxt < ' _ , ' tcx > ,
248221 goal : Goal < ' tcx , Self > ,
@@ -272,25 +245,21 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
272245 }
273246 }
274247
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.
281248 fn consider_builtin_fn_ptr_trait_candidate (
282249 ecx : & mut EvalCtxt < ' _ , ' tcx > ,
283250 goal : Goal < ' tcx , Self > ,
284251 ) -> QueryResult < ' tcx > {
285252 let self_ty = goal. predicate . self_ty ( ) ;
286253 match goal. predicate . polarity {
254+ // impl FnPtr for FnPtr {}
287255 ty:: ImplPolarity :: Positive => {
288256 if self_ty. is_fn_ptr ( ) {
289257 ecx. evaluate_added_goals_and_make_canonical_response ( Certainty :: Yes )
290258 } else {
291259 Err ( NoSolution )
292260 }
293261 }
262+ // impl !FnPtr for T where T != FnPtr && T is rigid {}
294263 ty:: ImplPolarity :: Negative => {
295264 // If a type is rigid and not a fn ptr, then we know for certain
296265 // that it does *not* implement `FnPtr`.
0 commit comments