Skip to content

Commit

Permalink
Add rustdoc hack
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Feb 2, 2024
1 parent 965da3a commit 47c97b1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion compiler/rustc_hir_analysis/src/coherence/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ fn visit_implementation_of_copy(
Err(infringing_fields_error(tcx, fields, LangItem::Copy, impl_did, span))
}
Err(CopyImplementationError::NotAnAdt) => {
Err(tcx.dcx().emit_err(errors::CopyImplOnNonAdt { span }))
if tcx.sess.opts.actually_rustdoc {
// HACK(rustdoc): `impl<Ret, T> Copy for fn(T) -> Ret` just for docs.
Ok(())
} else {
Err(tcx.dcx().emit_err(errors::CopyImplOnNonAdt { span }))
}
}
Err(CopyImplementationError::HasDestructor) => {
Err(tcx.dcx().emit_err(errors::CopyImplOnTypeWithDtor { span }))
Expand Down

0 comments on commit 47c97b1

Please sign in to comment.