Skip to content

Commit 47c97b1

Browse files
committed
Add rustdoc hack
1 parent 965da3a commit 47c97b1

File tree

1 file changed

+6
-1
lines changed
  • compiler/rustc_hir_analysis/src/coherence

1 file changed

+6
-1
lines changed

compiler/rustc_hir_analysis/src/coherence/builtin.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ fn visit_implementation_of_copy(
104104
Err(infringing_fields_error(tcx, fields, LangItem::Copy, impl_did, span))
105105
}
106106
Err(CopyImplementationError::NotAnAdt) => {
107-
Err(tcx.dcx().emit_err(errors::CopyImplOnNonAdt { span }))
107+
if tcx.sess.opts.actually_rustdoc {
108+
// HACK(rustdoc): `impl<Ret, T> Copy for fn(T) -> Ret` just for docs.
109+
Ok(())
110+
} else {
111+
Err(tcx.dcx().emit_err(errors::CopyImplOnNonAdt { span }))
112+
}
108113
}
109114
Err(CopyImplementationError::HasDestructor) => {
110115
Err(tcx.dcx().emit_err(errors::CopyImplOnTypeWithDtor { span }))

0 commit comments

Comments
 (0)