@@ -91,12 +91,12 @@ pub trait EmissionGuarantee: Sized {
9191 /// `impl` of `EmissionGuarantee`, to make it impossible to create a value
9292 /// of `Self::EmitResult` without actually performing the emission.
9393 #[ track_caller]
94- fn emit_producing_guarantee ( db : & mut DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult ;
94+ fn emit_producing_guarantee ( db : DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult ;
9595}
9696
9797impl < ' a , G : EmissionGuarantee > DiagnosticBuilder < ' a , G > {
9898 /// Most `emit_producing_guarantee` functions use this as a starting point.
99- fn emit_producing_nothing ( & mut self ) {
99+ fn emit_producing_nothing ( mut self ) {
100100 match self . state {
101101 // First `.emit()` call, the `&DiagCtxt` is still available.
102102 DiagnosticBuilderState :: Emittable ( dcx) => {
@@ -111,7 +111,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
111111
112112// FIXME(eddyb) make `ErrorGuaranteed` impossible to create outside `.emit()`.
113113impl EmissionGuarantee for ErrorGuaranteed {
114- fn emit_producing_guarantee ( db : & mut DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
114+ fn emit_producing_guarantee ( mut db : DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
115115 // Contrast this with `emit_producing_nothing`.
116116 match db. state {
117117 // First `.emit()` call, the `&DiagCtxt` is still available.
@@ -152,7 +152,7 @@ impl EmissionGuarantee for ErrorGuaranteed {
152152
153153// FIXME(eddyb) should there be a `Option<ErrorGuaranteed>` impl as well?
154154impl EmissionGuarantee for ( ) {
155- fn emit_producing_guarantee ( db : & mut DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
155+ fn emit_producing_guarantee ( db : DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
156156 db. emit_producing_nothing ( ) ;
157157 }
158158}
@@ -165,7 +165,7 @@ pub struct BugAbort;
165165impl EmissionGuarantee for BugAbort {
166166 type EmitResult = !;
167167
168- fn emit_producing_guarantee ( db : & mut DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
168+ fn emit_producing_guarantee ( db : DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
169169 db. emit_producing_nothing ( ) ;
170170 panic:: panic_any ( ExplicitBug ) ;
171171 }
@@ -179,14 +179,14 @@ pub struct FatalAbort;
179179impl EmissionGuarantee for FatalAbort {
180180 type EmitResult = !;
181181
182- fn emit_producing_guarantee ( db : & mut DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
182+ fn emit_producing_guarantee ( db : DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
183183 db. emit_producing_nothing ( ) ;
184184 crate :: FatalError . raise ( )
185185 }
186186}
187187
188188impl EmissionGuarantee for rustc_span:: fatal_error:: FatalError {
189- fn emit_producing_guarantee ( db : & mut DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
189+ fn emit_producing_guarantee ( db : DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
190190 db. emit_producing_nothing ( ) ;
191191 rustc_span:: fatal_error:: FatalError
192192 }
@@ -269,8 +269,8 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
269269
270270 /// Emit and consume the diagnostic.
271271 #[ track_caller]
272- pub fn emit ( mut self ) -> G :: EmitResult {
273- G :: emit_producing_guarantee ( & mut self )
272+ pub fn emit ( self ) -> G :: EmitResult {
273+ G :: emit_producing_guarantee ( self )
274274 }
275275
276276 /// Emit the diagnostic unless `delay` is true,
0 commit comments