Open
Description
This macro only accepts a few functions. But if the ones it accepts aren't imported, it quietly does the wrong thing. Surely this should always make a method for ChainRulesCore.rrule
:
julia> using ChainRulesCore: @opt_out
julia> ChainRulesCore.@opt_out *(::Rotation, ::Rotation)
ERROR: LoadError: Unexpected opt-out target. Exprected frule or rrule, got: *
julia> ChainRulesCore.@opt_out rrule(::typeof(*), ::Rotation, ::Rotation)
ERROR: LoadError: UndefVarError: ChainRulesCore not defined
in expression starting at REPL[3]:1
julia> using ChainRulesCore
julia> ChainRulesCore.@opt_out rrule(::typeof(*), ::Rotation, ::Rotation)
rrule (generic function with 1 method)
julia> @macroexpand ChainRulesCore.@opt_out rrule(::typeof(*), ::Rotation, ::Rotation)
quote
ChainRulesCore.no_rrule(::typeof(*), ::Rotation, ::Rotation) = ChainRulesCore.nothing
rrule(::typeof(*), ::Rotation, ::Rotation) = ChainRulesCore.nothing
end