diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-05-25 08:01:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-25 08:01:08 +0200 |
| commit | a9743e108a254809a7235460f9ba9e000776c507 (patch) | |
| tree | e8f7dbfd8f2692f036da4a526a4e6aa9cd665736 /compiler/rustc_interface/src | |
| parent | 725cadb2760e8084f21d50e2c7f1aa8cf42d14f0 (diff) | |
| parent | e2b953063d1c6302dd61a2284f8da8b770ddc11d (diff) | |
| download | rust-a9743e108a254809a7235460f9ba9e000776c507.tar.gz rust-a9743e108a254809a7235460f9ba9e000776c507.zip | |
Rollup merge of #111875 - WaffleLapkin:defer_on_drop, r=Nilstrieb
Don't leak the function that is called on drop It probably wasn't causing problems anyway, but still, a `// this leaks, please don't pass anything that owns memory` is not sustainable. I could implement a version which does not require `Option`, but it would require `unsafe`, at which point it's probably not worth it.
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/interface.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index 681819703c2..39d56897999 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -3,9 +3,9 @@ use crate::util; use rustc_ast::token; use rustc_ast::{self as ast, LitKind, MetaItemKind}; use rustc_codegen_ssa::traits::CodegenBackend; +use rustc_data_structures::defer; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::Lrc; -use rustc_data_structures::OnDrop; use rustc_errors::registry::Registry; use rustc_errors::{ErrorGuaranteed, Handler}; use rustc_lint::LintStore; @@ -325,7 +325,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se rustc_span::set_source_map(compiler.sess.parse_sess.clone_source_map(), move || { let r = { - let _sess_abort_error = OnDrop(|| { + let _sess_abort_error = defer(|| { compiler.sess.finish_diagnostics(registry); }); |
