Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to nightly-2024-01-06 #87

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ exclude = ["ide/src/tests/mock_project"]
resolver = "2"

[workspace.dependencies]
rustc_plugin = "=0.7.3-nightly-2023-08-25"
rustc_utils = {version = "=0.7.3-nightly-2023-08-25", features = ["indexical"]}
rustc_plugin = "=0.8.0-nightly-2024-01-06"
rustc_utils = {version = "=0.8.0-nightly-2024-01-06", features = ["indexical"]}
indexical = {version = "0.3.1", default-features = false, features = ["rustc"]}

[profile.bench]
Expand Down
2 changes: 1 addition & 1 deletion crates/flowistry/examples/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl rustc_driver::Callbacks for Callbacks {
config.override_queries = Some(borrowck_facts::override_queries);
}

fn after_parsing<'tcx>(
fn after_crate_root_parsing<'tcx>(
&mut self,
_compiler: &rustc_interface::interface::Compiler,
queries: &'tcx rustc_interface::Queries<'tcx>,
Expand Down
4 changes: 2 additions & 2 deletions crates/flowistry/src/infoflow/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use rustc_middle::{
mir::{visit::Visitor, *},
ty::TyCtxt,
};
use rustc_mir_dataflow::{Analysis, AnalysisDomain, Forward};
use rustc_mir_dataflow::{Analysis, AnalysisDomain};
use rustc_utils::{
mir::{
control_dependencies::ControlDependencies,
Expand Down Expand Up @@ -233,7 +233,7 @@ impl<'a, 'tcx> FlowAnalysis<'a, 'tcx> {

impl<'a, 'tcx> AnalysisDomain<'tcx> for FlowAnalysis<'a, 'tcx> {
type Domain = FlowDomain<'tcx>;
type Direction = Forward;

const NAME: &'static str = "FlowAnalysis";

fn bottom_value(&self, _body: &Body<'tcx>) -> Self::Domain {
Expand Down
5 changes: 0 additions & 5 deletions crates/flowistry/src/infoflow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ pub fn compute_flow<'a, 'tcx>(
) -> FlowResults<'a, 'tcx> {
BODY_STACK.with(|body_stack| {
body_stack.borrow_mut().push(body_id);
debug!(
"{}",
rustc_hir_pretty::to_string(rustc_hir_pretty::NO_ANN, |s| s
.print_expr(tcx.hir().body(body_id).value))
);
debug!("{}", body_with_facts.body.to_string(tcx).unwrap());

let def_id = tcx.hir().body_owner_def_id(body_id).to_def_id();
Expand Down
4 changes: 2 additions & 2 deletions crates/flowistry/src/infoflow/recursive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl<'tcx> FlowAnalysis<'_, 'tcx> {
}
};

let def_id = match func.literal.ty().kind() {
let def_id = match func.const_.ty().kind() {
TyKind::FnDef(def_id, _) => def_id,
_ => {
debug!(" Func is not a FnDef");
Expand Down Expand Up @@ -80,7 +80,7 @@ impl<'tcx> FlowAnalysis<'_, 'tcx> {
}
};

let unsafety = tcx.unsafety_check_result(def_id.expect_local());
let unsafety = tcx.mir_unsafety_check_result(def_id.expect_local());
if !unsafety.used_unsafe_blocks.is_empty() {
debug!(" Func contains unsafe blocks");
return false;
Expand Down
3 changes: 2 additions & 1 deletion crates/flowistry/src/mir/aliases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pub struct Aliases<'a, 'tcx> {
}

rustc_index::newtype_index! {
#[orderable]
#[debug_format = "rs{}"]
struct RegionSccIndex {}
}
Expand All @@ -83,7 +84,7 @@ impl<'a, 'tcx> Aliases<'a, 'tcx> {
}

/// Alternative constructor if you need to filter out certain borrowck facts.
///
///
/// Just use [`Aliases::build`] unless you know what you're doing.
pub fn build_with_fact_selection(
tcx: TyCtxt<'tcx>,
Expand Down
14 changes: 8 additions & 6 deletions crates/flowistry/src/mir/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ pub struct AnalysisResults<'tcx, A: Analysis<'tcx>> {
/// The underlying analysis that was used to generate the results.
pub analysis: A,
location_domain: Rc<LocationOrArgDomain>,
state: IndexVec<LocationOrArgIndex, A::Domain>,
state: IndexVec<LocationOrArgIndex, Rc<A::Domain>>,
}

impl<'tcx, A: Analysis<'tcx>> AnalysisResults<'tcx, A> {
/// Same as [`rustc_mir_dataflow::Results::visit_reachable_with`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_dataflow/struct.Results.html#method.visit_reachable_with).
pub fn visit_reachable_with<'mir, V>(&self, body: &'mir Body<'tcx>, visitor: &mut V)
pub fn visit_reachable_with<'mir, V>(&mut self, body: &'mir Body<'tcx>, visitor: &mut V)
where
V: ResultsVisitor<'mir, 'tcx, Self, FlowState = A::Domain>,
{
Expand All @@ -52,23 +52,23 @@ impl<'tcx, A: Analysis<'tcx>> AnalysisResults<'tcx, A> {
statement_index,
};
let loc_index = location.to_index(&self.location_domain);
let state = &self.state[loc_index];
let state = Rc::clone(&self.state[loc_index]);

if statement_index == 0 {
visitor.visit_block_start(self, state, data, block);
visitor.visit_block_start(&state);
}

if statement_index == data.statements.len() {
visitor.visit_terminator_after_primary_effect(
self,
state,
&state,
data.terminator(),
location,
)
} else {
visitor.visit_statement_after_primary_effect(
self,
state,
&state,
&data.statements[statement_index],
location,
)
Expand Down Expand Up @@ -148,6 +148,8 @@ pub fn iterate_to_fixpoint<'tcx, A: Analysis<'tcx>>(
}
}

let state = state.into_iter().map(Rc::new).collect();

AnalysisResults {
analysis,
location_domain,
Expand Down
2 changes: 1 addition & 1 deletion crates/flowistry/src/mir/placeinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for LoanCollector<'_, 'tcx> {
RegionKind::ReStatic => RegionVid::from_usize(0),
// TODO: do we need to handle bound regions?
// e.g. shows up with closures, for<'a> ...
RegionKind::ReErased | RegionKind::ReLateBound(_, _) => {
RegionKind::ReErased | RegionKind::ReBound(..) => {
return ControlFlow::Continue(());
}
_ => unreachable!("{region:?}"),
Expand Down
8 changes: 4 additions & 4 deletions crates/flowistry_ide/src/spans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@ struct Callbacks {
}

impl rustc_driver::Callbacks for Callbacks {
fn after_parsing<'tcx>(
fn after_crate_root_parsing<'tcx>(
&mut self,
compiler: &rustc_interface::interface::Compiler,
_compiler: &rustc_interface::interface::Compiler,
queries: &'tcx rustc_interface::Queries<'tcx>,
) -> rustc_driver::Compilation {
queries.global_ctxt().unwrap().enter(|tcx| {
let spans = find_bodies(tcx).into_iter().map(|(span, _)| span);

self.output = Some((|| {
let source_map = compiler.session().source_map();
let source_map = tcx.sess.source_map();
let source_file = Filename::intern(&self.filename)
.find_source_file(source_map)
.map_err(|_| FlowistryError::FileNotFound)?;

let spans = spans
.into_iter()
.filter(|span| {
source_map.lookup_source_file(span.lo()).name_hash == source_file.name_hash
source_map.lookup_source_file(span.lo()).name == source_file.name
})
.filter_map(|span| CharRange::from_span(span, source_map).ok())
.collect::<Vec<_>>();
Expand Down
2 changes: 1 addition & 1 deletion crates/flowistry_ifc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl rustc_driver::Callbacks for Callbacks {
config.override_queries = Some(borrowck_facts::override_queries);
}

fn after_parsing<'tcx>(
fn after_crate_root_parsing<'tcx>(
&mut self,
_compiler: &rustc_interface::interface::Compiler,
queries: &'tcx rustc_interface::Queries<'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2023-08-25"
channel = "nightly-2024-01-06"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
Loading