Skip to content

Commit 9afcbe4

Browse files
committed
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 rust-lang/rust#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" ( rust-lang/rust#113349 ) r? SparrowLii `@rustbot` label WG-compiler-parallel
2 parents a91c1b4 + 9f683c9 commit 9afcbe4

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

Diff for: examples/rustc-driver-example.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ extern crate rustc_span;
1515

1616
use std::io;
1717
use std::path::Path;
18+
use std::sync::Arc;
1819

1920
use rustc_ast_pretty::pprust::item_to_string;
20-
use rustc_data_structures::sync::Lrc;
2121
use rustc_driver::{Compilation, run_compiler};
2222
use rustc_interface::interface::{Compiler, Config};
2323
use rustc_middle::ty::TyCtxt;
@@ -43,7 +43,7 @@ fn main() {
4343
}
4444
}
4545

46-
fn read_binary_file(&self, _path: &Path) -> io::Result<Lrc<[u8]>> {
46+
fn read_binary_file(&self, _path: &Path) -> io::Result<Arc<[u8]>> {
4747
Err(io::Error::other("oops"))
4848
}
4949
}

Diff for: examples/rustc-driver-interacting-with-the-ast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ extern crate rustc_span;
1515

1616
use std::io;
1717
use std::path::Path;
18+
use std::sync::Arc;
1819

1920
use rustc_ast_pretty::pprust::item_to_string;
20-
use rustc_data_structures::sync::Lrc;
2121
use rustc_driver::{Compilation, run_compiler};
2222
use rustc_interface::interface::{Compiler, Config};
2323
use rustc_middle::ty::TyCtxt;
@@ -43,7 +43,7 @@ fn main() {
4343
}
4444
}
4545

46-
fn read_binary_file(&self, _path: &Path) -> io::Result<Lrc<[u8]>> {
46+
fn read_binary_file(&self, _path: &Path) -> io::Result<Arc<[u8]>> {
4747
Err(io::Error::other("oops"))
4848
}
4949
}

Diff for: src/diagnostics/lintstore.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Lints are registered via the [`LintStore::register_lint`] function. This should
5454
happen just once for any lint, or an ICE will occur.
5555

5656
Once the registration is complete, we "freeze" the lint store by placing it in
57-
an `Lrc`.
57+
an `Arc`.
5858

5959
Lint passes are registered separately into one of the categories
6060
(pre-expansion, early, late, late module). Passes are registered as a closure

Diff for: src/parallel-rustc.md

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ are implemented differently depending on whether `parallel-compiler` is true.
4646

4747
| data structure | parallel | non-parallel |
4848
| -------------------------------- | --------------------------------------------------- | ------------ |
49-
| Lrc | std::sync::Arc | std::rc::Rc |
5049
| Weak | std::sync::Weak | std::rc::Weak |
5150
| Atomic{Bool}/{Usize}/{U32}/{U64} | std::sync::atomic::Atomic{Bool}/{Usize}/{U32}/{U64} | (std::cell::Cell<bool/usize/u32/u64>) |
5251
| OnceCell | std::sync::OnceLock | std::cell::OnceCell |

0 commit comments

Comments
 (0)