Skip to content

Commit

Permalink
Merge branch 'main' into optimized-graph-construction
Browse files Browse the repository at this point in the history
  • Loading branch information
JustusAdam committed May 10, 2024
2 parents eaf438e + 074d847 commit 9ac73be
Show file tree
Hide file tree
Showing 35 changed files with 238 additions and 751 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
git config --local user.email "docmaster+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Install cargo-make
run: cargo install --force --debug cargo-make
run: rustup run stable cargo install --force --debug cargo-make
- name: Prepare
run: |
cargo doc --document-private-items
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
target/
key: ${{ runner.os }}-rust-deps-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml') }}
- name: Install cargo-make
run: cargo install --force --debug cargo-make
run: rustup run stable cargo install --force --debug cargo-make
- name: Build
run: cargo make install
- name: Run tests
Expand All @@ -54,7 +54,7 @@ jobs:
path: ~/.rustup
key: ${{ runner.os }}-rust-toolchain-${{ hashFiles('rust-toolchain.toml') }}
- name: Install cargo-make
run: cargo install --force --debug cargo-make
run: rustup run stable cargo install --force --debug cargo-make
- name: Run checks
run: cargo make format-check-all

Expand All @@ -79,7 +79,7 @@ jobs:
target/
key: ${{ runner.os }}-rust-deps-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml') }}
- name: Install cargo-make
run: cargo install --force --debug cargo-make
run: rustup run stable cargo install --force --debug cargo-make
- name: Here come the complaints
run: cargo make clippy-check-all

Expand All @@ -104,6 +104,6 @@ jobs:
target/
key: ${{ runner.os }}-rust-deps-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml') }}
- name: Install cargo-make
run: cargo install --force --debug cargo-make
run: rustup run stable cargo install --force --debug cargo-make
- name: Here come the complaints
run: cargo make doc-check
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ flow-graph.json
*.flowistry-pdg.pdf

*.mir
*.o
55 changes: 31 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ args = ["install", "--locked", "--path", "crates/paralegal-flow"]

[tasks.pdg-tests]
description = "The suite of synthetic tests for the PDG and the policy framweork."
dependencies = [
"analyzer-tests",
"policy-framework-tests",
"guide-project",
"integration-tests",
]
dependencies = ["analyzer-tests", "policy-framework-tests", "guide-project"]

[tasks.check-all]
description = "Perform all formatting-like checks. This is the same set that runs in the CI."
Expand Down Expand Up @@ -77,10 +72,6 @@ description = "Tests related to the correctness of the policy framework."
command = "cargo"
args = ["test", "-p", "paralegal-policy", "--lib"]

[tasks.integration-tests]
command = "cargo"
args = ["test", "--test", "lemmy", "--test", "websubmit", "--no-fail-fast"]

[tasks.guide-project]
description = "Build and run the policy from the guide."
cwd = "guide/deletion-policy"
Expand Down Expand Up @@ -222,3 +213,11 @@ mv ${source_path} docs/compiler
[tasks.get-rustc-docs]
command = "rustup"
args = ["component", "add", "rustc-docs"]
dependencies = ["clean-rustc-docs-location"]

[tasks.clean-rustc-docs-location]
command = "rm"
args = [
"-rf",
"${RUSTUP_HOME}/toolchains/${RUSTUP_TOOLCHAIN}/share/doc/rust/html/rustc",
]
2 changes: 1 addition & 1 deletion crates/flowistry_pdg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ cfg-if = "1.0.0"
internment = { version = "0.7.4", features = ["serde"] }

strum = { workspace = true }
serde = { workspace = true }
serde = { workspace = true, features = ["derive"] }
2 changes: 1 addition & 1 deletion crates/flowistry_pdg/src/rustc_portable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! The idea is that you can then define your data structure over this
//! (including serialization) like so, using `cfg_attr:
//!
//! ```
//! ```ignore
//! pub struct GlobalLocationS {
//! #[cfg_attr(feature = "rustc", serde(with = "rustc_proxies::BodyId"))]
//! pub function: BodyId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use rustc_middle::{
ty::TyCtxt,
};

use crate::async_support::AsyncInfo;
use crate::construct::CallKind;
use crate::{async_support::AsyncInfo, utils};

pub enum CallingConvention<'tcx, 'a> {
Direct(&'a [Operand<'tcx>]),
Expand Down
13 changes: 6 additions & 7 deletions crates/flowistry_pdg_construction/src/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,18 @@ impl<'tcx> PdgParams<'tcx> {
/// ```
/// # #![feature(rustc_private)]
/// # extern crate rustc_middle;
/// # use flowistry_pdg_construction::{PdgParams, SkipCall, CallChanges};
/// # use flowistry_pdg_construction::{PdgParams, SkipCall, CallChanges, CallChangeCallbackFn};
/// # use rustc_middle::ty::TyCtxt;
/// # const THRESHOLD: usize = 5;
/// # fn f<'tcx>(tcx: TyCtxt<'tcx>, params: PdgParams<'tcx>) -> PdgParams<'tcx> {
/// params.with_call_change_callback(|info| {
/// params.with_call_change_callback(CallChangeCallbackFn::new(|info| {
/// let skip = if info.call_string.len() > THRESHOLD {
/// SkipCall::Skip
/// } else {
/// SkipCall::NoSkip
/// };
/// CallChanges::default().with_skip(skip)
/// })
/// }))
/// # }
/// ```
pub fn with_call_change_callback(self, f: impl CallChangeCallback<'tcx> + 'tcx) -> Self {
Expand All @@ -126,12 +126,11 @@ impl<C> DebugWithContext<C> for InstructionState<'_> {}

impl<'tcx> df::JoinSemiLattice for InstructionState<'tcx> {
fn join(&mut self, other: &Self) -> bool {
let b3 = utils::hashmap_join(
utils::hashmap_join(
&mut self.last_mutation,
&other.last_mutation,
utils::hashset_join,
);
b3
)
}
}

Expand Down Expand Up @@ -560,7 +559,7 @@ impl<'tcx> GraphConstructor<'tcx> {
.root
.try_monomorphize(tcx, param_env, &body_with_facts.body);

if params.dump_mir || log_enabled!(log::Level::Trace) {
if params.dump_mir {
use std::io::Write;
let path = tcx.def_path_str(def_id) + ".mir";
let mut f = std::fs::File::create(path.as_str()).unwrap();
Expand Down
Loading

0 comments on commit 9ac73be

Please sign in to comment.