@@ -95,12 +95,12 @@ pub trait EmissionGuarantee: Sized {
9595 /// `impl` of `EmissionGuarantee`, to make it impossible to create a value
9696 /// of `Self::EmitResult` without actually performing the emission.
9797 #[ track_caller]
98- fn emit_producing_guarantee ( db : & mut DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult ;
98+ fn emit_producing_guarantee ( db : DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult ;
9999}
100100
101101impl < ' a , G : EmissionGuarantee > DiagnosticBuilder < ' a , G > {
102102 /// Most `emit_producing_guarantee` functions use this as a starting point.
103- fn emit_producing_nothing ( & mut self ) {
103+ fn emit_producing_nothing ( mut self ) {
104104 match self . state {
105105 // First `.emit()` call, the `&DiagCtxt` is still available.
106106 DiagnosticBuilderState :: Emittable ( dcx) => {
@@ -115,7 +115,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
115115
116116// FIXME(eddyb) make `ErrorGuaranteed` impossible to create outside `.emit()`.
117117impl EmissionGuarantee for ErrorGuaranteed {
118- fn emit_producing_guarantee ( db : & mut DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
118+ fn emit_producing_guarantee ( mut db : DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
119119 // Contrast this with `emit_producing_nothing`.
120120 match db. state {
121121 // First `.emit()` call, the `&DiagCtxt` is still available.
@@ -156,7 +156,7 @@ impl EmissionGuarantee for ErrorGuaranteed {
156156
157157// FIXME(eddyb) should there be a `Option<ErrorGuaranteed>` impl as well?
158158impl EmissionGuarantee for ( ) {
159- fn emit_producing_guarantee ( db : & mut DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
159+ fn emit_producing_guarantee ( db : DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
160160 db. emit_producing_nothing ( ) ;
161161 }
162162}
@@ -169,7 +169,7 @@ pub struct BugAbort;
169169impl EmissionGuarantee for BugAbort {
170170 type EmitResult = !;
171171
172- fn emit_producing_guarantee ( db : & mut DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
172+ fn emit_producing_guarantee ( db : DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
173173 db. emit_producing_nothing ( ) ;
174174 panic:: panic_any ( ExplicitBug ) ;
175175 }
@@ -183,14 +183,14 @@ pub struct FatalAbort;
183183impl EmissionGuarantee for FatalAbort {
184184 type EmitResult = !;
185185
186- fn emit_producing_guarantee ( db : & mut DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
186+ fn emit_producing_guarantee ( db : DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
187187 db. emit_producing_nothing ( ) ;
188188 crate :: FatalError . raise ( )
189189 }
190190}
191191
192192impl EmissionGuarantee for rustc_span:: fatal_error:: FatalError {
193- fn emit_producing_guarantee ( db : & mut DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
193+ fn emit_producing_guarantee ( db : DiagnosticBuilder < ' _ , Self > ) -> Self :: EmitResult {
194194 db. emit_producing_nothing ( ) ;
195195 rustc_span:: fatal_error:: FatalError
196196 }
@@ -265,8 +265,8 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
265265
266266 /// Emit and consume the diagnostic.
267267 #[ track_caller]
268- pub fn emit ( mut self ) -> G :: EmitResult {
269- G :: emit_producing_guarantee ( & mut self )
268+ pub fn emit ( self ) -> G :: EmitResult {
269+ G :: emit_producing_guarantee ( self )
270270 }
271271
272272 /// Emit the diagnostic unless `delay` is true,
0 commit comments