diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-02 15:44:22 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-02-05 21:27:01 +1100 |
| commit | d9508a1fd2bdbc2f7c4e2ee28503f15487fdc8ce (patch) | |
| tree | 4ade503df4e501752bbe7feb71f6d2f18b488891 /compiler/rustc_codegen_ssa/src/back | |
| parent | 4e3eed48926b8b70eee8beb082e37ffa4985c0ed (diff) | |
| download | rust-d9508a1fd2bdbc2f7c4e2ee28503f15487fdc8ce.tar.gz rust-d9508a1fd2bdbc2f7c4e2ee28503f15487fdc8ce.zip | |
Make `Emitter::emit_diagnostic` consuming.
All the other `emit`/`emit_diagnostic` methods were recently made consuming (e.g. #119606), but this one wasn't. But it makes sense to. Much of this is straightforward, and lots of `clone` calls are avoided. There are a couple of tricky bits. - `Emitter::primary_span_formatted` no longer takes a `Diagnostic` and returns a pair. Instead it takes the two fields from `Diagnostic` that it used (`span` and `suggestions`) as `&mut`, and modifies them. This is necessary to avoid the cloning of `diag.children` in two emitters. - `from_errors_diagnostic` is rearranged so various uses of `diag` occur before the consuming `emit_diagnostic` call.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/write.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 4211f875dd0..9b24339d255 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -1810,7 +1810,7 @@ impl Translate for SharedEmitter { } impl Emitter for SharedEmitter { - fn emit_diagnostic(&mut self, diag: &rustc_errors::Diagnostic) { + fn emit_diagnostic(&mut self, diag: rustc_errors::Diagnostic) { let args: FxHashMap<DiagnosticArgName, DiagnosticArgValue> = diag.args().map(|(name, arg)| (name.clone(), arg.clone())).collect(); drop(self.sender.send(SharedEmitterMessage::Diagnostic(Diagnostic { |
