about summary refs log tree commit diff
path: root/src/doc/rustc-dev-guide/examples
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-02-06 10:50:05 +0000
committerbors <bors@rust-lang.org>2025-02-06 10:50:05 +0000
commit2f92f050e83bf3312ce4ba73c31fe843ad3cbc60 (patch)
treece6f75039ccafd2fa1dd5dbdeeff37233cb09d45 /src/doc/rustc-dev-guide/examples
parent59588250ad973ce69bd15879314c9769e65f36b3 (diff)
parent0a21f1d0a2fe9e84727a2de735fdcf55e8820db6 (diff)
downloadrust-2f92f050e83bf3312ce4ba73c31fe843ad3cbc60.tar.gz
rust-2f92f050e83bf3312ce4ba73c31fe843ad3cbc60.zip
Auto merge of #136471 - safinaskar:parallel, r=SparrowLii
tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc`

tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc`

This is continuation of https://github.com/rust-lang/rust/pull/132282 .

I'm pretty sure I did everything right. In particular, I searched all occurrences of `Lrc` in submodules and made sure that they don't need replacement.

There are other possibilities, through.

We can define `enum Lrc<T> { Rc(Rc<T>), Arc(Arc<T>) }`. Or we can make `Lrc` a union and on every clone we can read from special thread-local variable. Or we can add a generic parameter to `Lrc` and, yes, this parameter will be everywhere across all codebase.

So, if you think we should take some alternative approach, then don't merge this PR. But if it is decided to stick with `Arc`, then, please, merge.

cc "Parallel Rustc Front-end" ( https://github.com/rust-lang/rust/issues/113349 )

r? SparrowLii

`@rustbot` label WG-compiler-parallel
Diffstat (limited to 'src/doc/rustc-dev-guide/examples')
-rw-r--r--src/doc/rustc-dev-guide/examples/rustc-driver-example.rs4
-rw-r--r--src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/doc/rustc-dev-guide/examples/rustc-driver-example.rs b/src/doc/rustc-dev-guide/examples/rustc-driver-example.rs
index b0f9af1b8d1..14998965ac8 100644
--- a/src/doc/rustc-dev-guide/examples/rustc-driver-example.rs
+++ b/src/doc/rustc-dev-guide/examples/rustc-driver-example.rs
@@ -15,9 +15,9 @@ extern crate rustc_span;
 
 use std::io;
 use std::path::Path;
+use std::sync::Arc;
 
 use rustc_ast_pretty::pprust::item_to_string;
-use rustc_data_structures::sync::Lrc;
 use rustc_driver::{Compilation, run_compiler};
 use rustc_interface::interface::{Compiler, Config};
 use rustc_middle::ty::TyCtxt;
@@ -43,7 +43,7 @@ fn main() {
         }
     }
 
-    fn read_binary_file(&self, _path: &Path) -> io::Result<Lrc<[u8]>> {
+    fn read_binary_file(&self, _path: &Path) -> io::Result<Arc<[u8]>> {
         Err(io::Error::other("oops"))
     }
 }
diff --git a/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs b/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs
index 8766a817344..9fcb16b0fca 100644
--- a/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs
+++ b/src/doc/rustc-dev-guide/examples/rustc-driver-interacting-with-the-ast.rs
@@ -15,9 +15,9 @@ extern crate rustc_span;
 
 use std::io;
 use std::path::Path;
+use std::sync::Arc;
 
 use rustc_ast_pretty::pprust::item_to_string;
-use rustc_data_structures::sync::Lrc;
 use rustc_driver::{Compilation, run_compiler};
 use rustc_interface::interface::{Compiler, Config};
 use rustc_middle::ty::TyCtxt;
@@ -43,7 +43,7 @@ fn main() {
         }
     }
 
-    fn read_binary_file(&self, _path: &Path) -> io::Result<Lrc<[u8]>> {
+    fn read_binary_file(&self, _path: &Path) -> io::Result<Arc<[u8]>> {
         Err(io::Error::other("oops"))
     }
 }