Macro rustc_errors::diagnostic_builder::forward [−][src]
macro_rules! forward {
($(#[$attrs : meta]) * pub fn $n :
ident(& self, $($name : ident : $ty : ty), * $(,) ?) -> & Self) => { ... };
($(#[$attrs : meta]) * pub fn $n :
ident(& mut self, $($name : ident : $ty : ty), * $(,) ?) -> & mut Self) => { ... };
($(#[$attrs : meta]) * pub fn $n : ident <
$($generic : ident : $bound : path), * >
(& mut self, $($name : ident : $ty : ty), * $(,) ?) -> & mut Self) => { ... };
}
Expand description
In general, the DiagnosticBuilder
uses deref to allow access to
the fields and methods of the embedded diagnostic
in a
transparent way. However, many of the methods are intended to
be used in a chained way, and hence ought to return self
. In
that case, we can’t just naively forward to the method on the
diagnostic
, because the return type would be a &Diagnostic
instead of a &DiagnosticBuilder<'a>
. This forward!
macro makes
it easy to declare such methods on the builder.