diff options
| author | bors <bors@rust-lang.org> | 2024-10-29 12:29:43 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-10-29 12:29:43 +0000 |
| commit | 2dece5bb62f234f5622a08289c5a3d1555cd7843 (patch) | |
| tree | 211b9985a289ddb33d5abeb68e22caf0a07c83db /compiler/rustc_middle/src | |
| parent | c8a8c82035439cb2404b8f24ca0bc18209d534ca (diff) | |
| parent | 6c5641c16b99dbf732f71368a8dadc7b843eb307 (diff) | |
| download | rust-2dece5bb62f234f5622a08289c5a3d1555cd7843.tar.gz rust-2dece5bb62f234f5622a08289c5a3d1555cd7843.zip | |
Auto merge of #132317 - workingjubilee:rollup-x21ncea, r=workingjubilee
Rollup of 12 pull requests Successful merges: - #131375 (compiler: apply clippy::clone_on_ref_ptr for CI) - #131520 (Mark `str::is_char_boundary` and `str::split_at*` unstably `const`.) - #132119 (Hack out effects support for old solver) - #132194 (Collect item bounds for RPITITs from trait where clauses just like associated types) - #132216 (correct LLVMRustCreateThinLTOData arg types) - #132233 (Split `boxed.rs` into a few modules) - #132266 (riscv-soft-abi-with-float-features.rs: adapt for LLVM 20) - #132270 (clarified doc for `std::fs::OpenOptions.truncate()`) - #132284 (Remove my ping for rustdoc/clean/types.rs) - #132293 (Remove myself from mentions inside `tests/ui/check-cfg` directory) - #132312 (Delete `tests/crashes/23707.rs` because it's flaky) - #132313 (compiletest: Rename `command-list.rs` to `directive-list.rs`) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/middle/debugger_visualizer.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/query/on_disk_cache.rs | 45 |
2 files changed, 21 insertions, 26 deletions
diff --git a/compiler/rustc_middle/src/middle/debugger_visualizer.rs b/compiler/rustc_middle/src/middle/debugger_visualizer.rs index 615a7402139..c241c06fce4 100644 --- a/compiler/rustc_middle/src/middle/debugger_visualizer.rs +++ b/compiler/rustc_middle/src/middle/debugger_visualizer.rs @@ -32,7 +32,7 @@ impl DebuggerVisualizerFile { pub fn path_erased(&self) -> Self { DebuggerVisualizerFile { - src: self.src.clone(), + src: Lrc::clone(&self.src), visualizer_type: self.visualizer_type, path: None, } diff --git a/compiler/rustc_middle/src/query/on_disk_cache.rs b/compiler/rustc_middle/src/query/on_disk_cache.rs index 35a16684615..8b77a4a81ca 100644 --- a/compiler/rustc_middle/src/query/on_disk_cache.rs +++ b/compiler/rustc_middle/src/query/on_disk_cache.rs @@ -472,32 +472,27 @@ impl<'a, 'tcx> CacheDecoder<'a, 'tcx> { let CacheDecoder { tcx, file_index_to_file, file_index_to_stable_id, source_map, .. } = *self; - file_index_to_file - .borrow_mut() - .entry(index) - .or_insert_with(|| { - let source_file_id = &file_index_to_stable_id[&index]; - let source_file_cnum = - tcx.stable_crate_id_to_crate_num(source_file_id.stable_crate_id); - - // If this `SourceFile` is from a foreign crate, then make sure - // that we've imported all of the source files from that crate. - // This has usually already been done during macro invocation. - // However, when encoding query results like `TypeckResults`, - // we might encode an `AdtDef` for a foreign type (because it - // was referenced in the body of the function). There is no guarantee - // that we will load the source files from that crate during macro - // expansion, so we use `import_source_files` to ensure that the foreign - // source files are actually imported before we call `source_file_by_stable_id`. - if source_file_cnum != LOCAL_CRATE { - self.tcx.import_source_files(source_file_cnum); - } + Lrc::clone(file_index_to_file.borrow_mut().entry(index).or_insert_with(|| { + let source_file_id = &file_index_to_stable_id[&index]; + let source_file_cnum = tcx.stable_crate_id_to_crate_num(source_file_id.stable_crate_id); + + // If this `SourceFile` is from a foreign crate, then make sure + // that we've imported all of the source files from that crate. + // This has usually already been done during macro invocation. + // However, when encoding query results like `TypeckResults`, + // we might encode an `AdtDef` for a foreign type (because it + // was referenced in the body of the function). There is no guarantee + // that we will load the source files from that crate during macro + // expansion, so we use `import_source_files` to ensure that the foreign + // source files are actually imported before we call `source_file_by_stable_id`. + if source_file_cnum != LOCAL_CRATE { + self.tcx.import_source_files(source_file_cnum); + } - source_map - .source_file_by_stable_id(source_file_id.stable_source_file_id) - .expect("failed to lookup `SourceFile` in new context") - }) - .clone() + source_map + .source_file_by_stable_id(source_file_id.stable_source_file_id) + .expect("failed to lookup `SourceFile` in new context") + })) } } |
