diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2032ce36e..78adcb7e4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,7 +49,7 @@ jobs: - uses: actions/checkout@v1 - uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2023-04-12 + toolchain: nightly-2023-08-25 components: rust-src, rustc-dev, llvm-tools-preview target: ${{ matrix.target }} profile: minimal diff --git a/Cargo.toml b/Cargo.toml index df9c712c7..c54172a45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,7 @@ [workspace] members = ["crates/*"] exclude = ["ide/src/tests/mock_project"] +resolver = "2" [profile.bench] -debug = true - -[patch.crates-io] -rustc_plugin = { git = "https://github.com/cognitive-engineering-lab/rustc_plugin", branch = "charpos-fix" } -rustc_utils = { git = "https://github.com/cognitive-engineering-lab/rustc_plugin", branch = "charpos-fix" } \ No newline at end of file +debug = true \ No newline at end of file diff --git a/README.md b/README.md index 4c2cd8878..d546f09cf 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,8 @@ The documentation is published here: https://willcrichton.net/flowistry/flowistr ## Usage -Note that the latest Flowistry has a [**Maximum** Supported Rust Version](https://github.com/cognitive-engineering-lab/rustc_plugin/tree/main#maximum-supported-rust-version) of **Rust 1.69**. -Flowistry is not guaranteed to work with features implemented after 1.69. +Note that the latest Flowistry has a [**Maximum** Supported Rust Version](https://github.com/cognitive-engineering-lab/rustc_plugin/tree/main#maximum-supported-rust-version) of **Rust 1.73**. +Flowistry is not guaranteed to work with features implemented after 1.73. ### Startup diff --git a/crates/flowistry/Cargo.toml b/crates/flowistry/Cargo.toml index a2beb93d6..4aed2265d 100644 --- a/crates/flowistry/Cargo.toml +++ b/crates/flowistry/Cargo.toml @@ -20,7 +20,7 @@ log = "0.4" fluid-let = "1.0" cfg-if = "1.0" serde = {version = "1", features = ["derive"]} -rustc_utils = "0.6.3-nightly-2023-04-12" +rustc_utils = "0.7.0-nightly-2023-08-25" # For local debugging html-escape = {version = "0.2", optional = true} diff --git a/crates/flowistry/examples/example.rs b/crates/flowistry/examples/example.rs index c6362db6a..0efc3cd2f 100644 --- a/crates/flowistry/examples/example.rs +++ b/crates/flowistry/examples/example.rs @@ -25,7 +25,7 @@ extern crate rustc_span; use std::process::Command; use flowistry::{indexed::impls::LocationOrArg, infoflow::Direction}; -use rustc_borrowck::BodyWithBorrowckFacts; +use rustc_borrowck::consumers::BodyWithBorrowckFacts; use rustc_hir::{BodyId, ItemKind}; use rustc_middle::{ mir::{Local, Place}, diff --git a/crates/flowistry/src/indexed/mod.rs b/crates/flowistry/src/indexed/mod.rs index 1b26dfe79..f3c1e56a9 100644 --- a/crates/flowistry/src/indexed/mod.rs +++ b/crates/flowistry/src/indexed/mod.rs @@ -9,7 +9,7 @@ //! Therefore if we want to encode a set of locations (e.g. for the [`FlowDomain`](crate::infoflow::FlowDomain)), //! then we can assign each `Location` a numeric index and use a compact bit-set instead of, say, //! a hash set. Concretely, this means: -//! 1. Defining a type `LocationOrArgIndex` that implements the [`Idx`](rustc_index::vec::Idx) trait. +//! 1. Defining a type `LocationOrArgIndex` that implements the [`Idx`](rustc_index::Idx) trait. //! 2. Creating a mapping ("domain") from `Location`s to `LocationOrArgIndex`. //! 3. Constructing a `LocationSet` out of a [`BitSet`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_index/bit_set/struct.BitSet.html)``. //! @@ -35,10 +35,7 @@ use std::{ }; use rustc_data_structures::fx::FxHashMap as HashMap; -use rustc_index::{ - bit_set::BitSet, - vec::{Idx, IndexVec}, -}; +use rustc_index::{bit_set::BitSet, Idx, IndexVec}; use rustc_mir_dataflow::{fmt::DebugWithContext, JoinSemiLattice}; pub mod impls; diff --git a/crates/flowistry/src/infoflow/analysis.rs b/crates/flowistry/src/infoflow/analysis.rs index 0d1ec3ab3..890bb3fd6 100644 --- a/crates/flowistry/src/infoflow/analysis.rs +++ b/crates/flowistry/src/infoflow/analysis.rs @@ -234,7 +234,7 @@ impl<'a, 'tcx> AnalysisDomain<'tcx> for FlowAnalysis<'a, 'tcx> { impl<'a, 'tcx> Analysis<'tcx> for FlowAnalysis<'a, 'tcx> { fn apply_statement_effect( - &self, + &mut self, state: &mut Self::Domain, statement: &Statement<'tcx>, location: Location, @@ -245,30 +245,32 @@ impl<'a, 'tcx> Analysis<'tcx> for FlowAnalysis<'a, 'tcx> { .visit_statement(statement, location); } - fn apply_terminator_effect( - &self, + fn apply_terminator_effect<'mir>( + &mut self, state: &mut Self::Domain, - terminator: &Terminator<'tcx>, + terminator: &'mir Terminator<'tcx>, location: Location, - ) { + ) -> TerminatorEdges<'mir, 'tcx> { if matches!(terminator.kind, TerminatorKind::Call { .. }) && is_extension_active(|mode| mode.context_mode == ContextMode::Recurse) && self.recurse_into_call(state, &terminator.kind, location) { - return; + return terminator.edges(); } ModularMutationVisitor::new(&self.place_info, |_, mutations| { self.transfer_function(state, mutations, location) }) .visit_terminator(terminator, location); + + terminator.edges() } fn apply_call_return_effect( - &self, + &mut self, _state: &mut Self::Domain, _block: BasicBlock, - _return_places: rustc_mir_dataflow::CallReturnPlaces<'_, 'tcx>, + _return_places: CallReturnPlaces<'_, 'tcx>, ) { } } diff --git a/crates/flowistry/src/infoflow/mod.rs b/crates/flowistry/src/infoflow/mod.rs index e4480b37b..d18906feb 100644 --- a/crates/flowistry/src/infoflow/mod.rs +++ b/crates/flowistry/src/infoflow/mod.rs @@ -6,7 +6,7 @@ use std::cell::RefCell; use log::debug; -use rustc_borrowck::BodyWithBorrowckFacts; +use rustc_borrowck::consumers::BodyWithBorrowckFacts; use rustc_hir::BodyId; use rustc_middle::ty::TyCtxt; use rustc_utils::{block_timer, BodyExt}; diff --git a/crates/flowistry/src/infoflow/recursive.rs b/crates/flowistry/src/infoflow/recursive.rs index 62be72b01..1a51511e3 100644 --- a/crates/flowistry/src/infoflow/recursive.rs +++ b/crates/flowistry/src/infoflow/recursive.rs @@ -1,7 +1,7 @@ use log::{debug, info}; use rustc_middle::{ mir::*, - ty::{subst::GenericArgKind, ClosureKind, TyKind}, + ty::{ClosureKind, GenericArgKind, TyKind}, }; use rustc_mir_dataflow::JoinSemiLattice; use rustc_utils::{mir::borrowck_facts::get_body_with_borrowck_facts, PlaceExt}; diff --git a/crates/flowistry/src/mir/aliases.rs b/crates/flowistry/src/mir/aliases.rs index e4a0e7708..a2b219166 100644 --- a/crates/flowistry/src/mir/aliases.rs +++ b/crates/flowistry/src/mir/aliases.rs @@ -12,7 +12,7 @@ use rustc_data_structures::{ use rustc_hir::def_id::DefId; use rustc_index::{ bit_set::{HybridBitSet, SparseBitMatrix}, - vec::IndexVec, + IndexVec, }; use rustc_middle::{ mir::{visit::Visitor, *}, @@ -87,7 +87,7 @@ impl<'a, 'tcx> Aliases<'a, 'tcx> { let start = Instant::now(); let body = &body_with_facts.body; let static_region = RegionVid::from_usize(0); - let subset_base = &body_with_facts.input_facts.subset_base; + let subset_base = &body_with_facts.input_facts.as_ref().unwrap().subset_base; let all_pointers = body .local_decls() diff --git a/crates/flowistry/src/mir/engine.rs b/crates/flowistry/src/mir/engine.rs index 6751ce450..bd7bc1444 100644 --- a/crates/flowistry/src/mir/engine.rs +++ b/crates/flowistry/src/mir/engine.rs @@ -15,7 +15,7 @@ use std::rc::Rc; use either::Either; use rustc_data_structures::{graph::WithSuccessors, work_queue::WorkQueue}; -use rustc_index::vec::IndexVec; +use rustc_index::IndexVec; use rustc_middle::{ mir::{traversal, Body, Location}, ty::TyCtxt, @@ -39,7 +39,7 @@ pub struct AnalysisResults<'tcx, A: Analysis<'tcx>> { impl<'tcx, A: Analysis<'tcx>> AnalysisResults<'tcx, A> { pub fn visit_reachable_with<'mir, V>(&self, body: &'mir Body<'tcx>, visitor: &mut V) where - V: ResultsVisitor<'mir, 'tcx, FlowState = A::Domain>, + V: ResultsVisitor<'mir, 'tcx, Self, FlowState = A::Domain>, { for (block, data) in traversal::reachable(body) { for statement_index in 0 ..= data.statements.len() { @@ -51,17 +51,19 @@ impl<'tcx, A: Analysis<'tcx>> AnalysisResults<'tcx, A> { let state = &self.state[loc_index]; if statement_index == 0 { - visitor.visit_block_start(state, data, block); + visitor.visit_block_start(self, state, data, block); } if statement_index == data.statements.len() { visitor.visit_terminator_after_primary_effect( + self, state, data.terminator(), location, ) } else { visitor.visit_statement_after_primary_effect( + self, state, &data.statements[statement_index], location, @@ -85,7 +87,7 @@ pub fn iterate_to_fixpoint<'tcx, A: Analysis<'tcx>>( _tcx: TyCtxt<'tcx>, body: &Body<'tcx>, location_domain: Rc, - analysis: A, + mut analysis: A, ) -> AnalysisResults<'tcx, A> { let bottom_value = analysis.bottom_value(body); diff --git a/crates/flowistry/src/mir/placeinfo.rs b/crates/flowistry/src/mir/placeinfo.rs index b546c4c51..bb09ac721 100644 --- a/crates/flowistry/src/mir/placeinfo.rs +++ b/crates/flowistry/src/mir/placeinfo.rs @@ -144,9 +144,7 @@ impl<'a, 'tcx> PlaceInfo<'a, 'tcx> { fn collect_loans(&self, ty: Ty<'tcx>, mutability: Mutability) -> PlaceSet<'tcx> { let mut collector = LoanCollector { aliases: &self.aliases, - unknown_region: self - .tcx - .mk_region_from_kind(RegionKind::ReVar(UNKNOWN_REGION)), + unknown_region: Region::new_var(self.tcx, UNKNOWN_REGION), target_mutability: mutability, stack: vec![], loans: PlaceSet::default(), diff --git a/crates/flowistry/src/test_utils.rs b/crates/flowistry/src/test_utils.rs index 574517d3e..069ca00c5 100644 --- a/crates/flowistry/src/test_utils.rs +++ b/crates/flowistry/src/test_utils.rs @@ -5,7 +5,7 @@ use std::{fs, io, panic, path::Path}; use anyhow::Result; use fluid_let::fluid_set; use log::info; -use rustc_borrowck::BodyWithBorrowckFacts; +use rustc_borrowck::consumers::BodyWithBorrowckFacts; use rustc_data_structures::fx::FxHashSet as HashSet; use rustc_hir::BodyId; use rustc_middle::ty::TyCtxt; diff --git a/crates/flowistry_ide/Cargo.toml b/crates/flowistry_ide/Cargo.toml index e535412bc..d72e6c91c 100644 --- a/crates/flowistry_ide/Cargo.toml +++ b/crates/flowistry_ide/Cargo.toml @@ -24,8 +24,8 @@ serde = {version = "1", features = ["derive"]} serde_json = "1" flate2 = "1" base64 = "0.21" -rustc_utils = {version = "0.6.3-nightly-2023-04-12", features = ["serde"]} -rustc_plugin = "0.6.3-nightly-2023-04-12" +rustc_utils = {version = "0.7.0-nightly-2023-08-25", features = ["serde"]} +rustc_plugin = "0.7.0-nightly-2023-08-25" # Decompose petgraph = {version = "0.6", default-features = false, optional = true} @@ -33,4 +33,4 @@ rayon = {version = "1.5", optional = true} # For binaries env_logger = {version = "0.9", default-features = false} -clap = {version = "4", default-features = false, features = ["std", "derive"]} \ No newline at end of file +clap = {version = "4.4", default-features = false, features = ["std", "derive"]} \ No newline at end of file diff --git a/crates/flowistry_ide/src/playground.rs b/crates/flowistry_ide/src/playground.rs index bdf476e18..4ef98e89d 100644 --- a/crates/flowistry_ide/src/playground.rs +++ b/crates/flowistry_ide/src/playground.rs @@ -17,9 +17,8 @@ pub fn playground(tcx: TyCtxt, body_id: BodyId) -> Result { let body = &body_with_facts.body; debug!("{}", body.to_string(tcx).unwrap()); - let outlives = body_with_facts - .input_facts - .subset_base + let subset_base = &body_with_facts.input_facts.as_ref().unwrap().subset_base; + let outlives = subset_base .iter() .map(|(sup, sub, _)| (format!("{sup:?}"), format!("{sub:?}"))) .collect::>(); diff --git a/crates/flowistry_ide/src/plugin.rs b/crates/flowistry_ide/src/plugin.rs index c228bf5e7..0ebc7c238 100644 --- a/crates/flowistry_ide/src/plugin.rs +++ b/crates/flowistry_ide/src/plugin.rs @@ -18,6 +18,7 @@ use rustc_hir::BodyId; use rustc_interface::interface::Result as RustcResult; use rustc_middle::ty::TyCtxt; use rustc_plugin::{CrateFilter, RustcPlugin, RustcPluginArgs, Utf8Path}; +use rustc_span::ErrorGuaranteed; use rustc_utils::{ mir::borrowck_facts, source_map::{ @@ -218,9 +219,7 @@ fn postprocess(result: FlowistryResult) -> RustcResult<()> { let result = match result { Ok(output) => Ok(output), Err(e) => match e { - FlowistryError::BuildError => { - return Err(rustc_errors::ErrorGuaranteed::unchecked_claim_error_was_emitted()); - } + FlowistryError::BuildError(e) => return Err(e), e => Err(e), }, }; @@ -249,7 +248,7 @@ pub fn run_with_callbacks( ); let compiler = rustc_driver::RunCompiler::new(&args, callbacks); - compiler.run().map_err(|_| FlowistryError::BuildError) + compiler.run().map_err(FlowistryError::BuildError) } fn run( @@ -281,7 +280,7 @@ fn run( #[derive(Debug, Serialize)] #[serde(tag = "type")] pub enum FlowistryError { - BuildError, + BuildError(#[serde(skip_serializing)] ErrorGuaranteed), AnalysisError { error: String }, FileNotFound, } diff --git a/crates/flowistry_ifc/Cargo.toml b/crates/flowistry_ifc/Cargo.toml index 0e4aa328d..07dc26055 100644 --- a/crates/flowistry_ifc/Cargo.toml +++ b/crates/flowistry_ifc/Cargo.toml @@ -13,5 +13,5 @@ env_logger = "0.9" termcolor = "1.1" anyhow = "1" log = "0.4" -rustc_plugin = "0.6.3-nightly-2023-04-12" -rustc_utils = "0.6.3-nightly-2023-04-12" \ No newline at end of file +rustc_plugin = "0.7.0-nightly-2023-08-25" +rustc_utils = "0.7.0-nightly-2023-08-25" \ No newline at end of file diff --git a/rust-toolchain.toml b/rust-toolchain.toml index a9dabd650..d9d396bd2 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2023-04-12" +channel = "nightly-2023-08-25" components = ["rust-src", "rustc-dev", "llvm-tools-preview"] \ No newline at end of file