Skip to content

Commit e8ded84

Browse files
authored
Rollup merge of rust-lang#64207 - sinkuu:pub_dataflow, r=tmandry
Make rustc_mir::dataflow module pub (for clippy) I'm working on fixing false-positives of a MIR-based clippy lint (rust-lang/rust-clippy#4509), and in need of the dataflow infrastructure.
2 parents dece573 + 867ce76 commit e8ded84

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/librustc_mir/dataflow/mod.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ where
5656
/// string (as well as that of rendering up-front); in exchange, you
5757
/// don't have to hand over ownership of your value or deal with
5858
/// borrowing it.
59-
pub(crate) struct DebugFormatted(String);
59+
pub struct DebugFormatted(String);
6060

6161
impl DebugFormatted {
6262
pub fn new(input: &dyn fmt::Debug) -> DebugFormatted {
@@ -70,7 +70,7 @@ impl fmt::Debug for DebugFormatted {
7070
}
7171
}
7272

73-
pub(crate) trait Dataflow<'tcx, BD: BitDenotation<'tcx>> {
73+
pub trait Dataflow<'tcx, BD: BitDenotation<'tcx>> {
7474
/// Sets up and runs the dataflow problem, using `p` to render results if
7575
/// implementation so chooses.
7676
fn dataflow<P>(&mut self, p: P) where P: Fn(&BD, BD::Idx) -> DebugFormatted {
@@ -121,7 +121,7 @@ pub struct MoveDataParamEnv<'tcx> {
121121
pub(crate) param_env: ty::ParamEnv<'tcx>,
122122
}
123123

124-
pub(crate) fn do_dataflow<'a, 'tcx, BD, P>(
124+
pub fn do_dataflow<'a, 'tcx, BD, P>(
125125
tcx: TyCtxt<'tcx>,
126126
body: &'a Body<'tcx>,
127127
def_id: DefId,
@@ -565,7 +565,7 @@ pub struct GenKill<T> {
565565
pub(crate) kill_set: T,
566566
}
567567

568-
type GenKillSet<T> = GenKill<HybridBitSet<T>>;
568+
pub type GenKillSet<T> = GenKill<HybridBitSet<T>>;
569569

570570
impl<T> GenKill<T> {
571571
/// Creates a new tuple where `gen_set == kill_set == elem`.
@@ -580,28 +580,28 @@ impl<T> GenKill<T> {
580580
}
581581

582582
impl<E:Idx> GenKillSet<E> {
583-
pub(crate) fn clear(&mut self) {
583+
pub fn clear(&mut self) {
584584
self.gen_set.clear();
585585
self.kill_set.clear();
586586
}
587587

588-
fn gen(&mut self, e: E) {
588+
pub fn gen(&mut self, e: E) {
589589
self.gen_set.insert(e);
590590
self.kill_set.remove(e);
591591
}
592592

593-
fn gen_all(&mut self, i: impl IntoIterator<Item: Borrow<E>>) {
593+
pub fn gen_all(&mut self, i: impl IntoIterator<Item: Borrow<E>>) {
594594
for j in i {
595595
self.gen(*j.borrow());
596596
}
597597
}
598598

599-
fn kill(&mut self, e: E) {
599+
pub fn kill(&mut self, e: E) {
600600
self.gen_set.remove(e);
601601
self.kill_set.insert(e);
602602
}
603603

604-
fn kill_all(&mut self, i: impl IntoIterator<Item: Borrow<E>>) {
604+
pub fn kill_all(&mut self, i: impl IntoIterator<Item: Borrow<E>>) {
605605
for j in i {
606606
self.kill(*j.borrow());
607607
}

src/librustc_mir/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub mod error_codes;
3535

3636
mod borrow_check;
3737
mod build;
38-
mod dataflow;
38+
pub mod dataflow;
3939
mod hair;
4040
mod lints;
4141
mod shim;

0 commit comments

Comments
 (0)