Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.dot text eol=lf
*.fixed text eol=lf
*.rs text eol=lf
*.sh text eol=lf
*.stderr text eol=lf
*.toml text eol=lf
33 changes: 26 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,45 @@ on:
- 'README.md'
- 'CONTRIBUTING.md'
- '.vscode/**'
workflow_dispatch:

defaults:
run:
shell: bash

jobs:
build:
name: Cargo Test, Clippy and Format
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
# Unsetting this would make so that any malicious package could get our Github Token
persist-credentials: false
- run: cargo fmt --check
- run: cargo test --all
- run: cargo test --all
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Format check
run: cargo fmt --check
- name: Test rpl with embedded patterns
run: cargo test --all
- name: Test rpl with external patterns (actually the same with embedded ones)
run: cargo test --all
env:
RPL_PATS: docs/patterns-pest
- run: cargo clippy -- -D warnings
- run: cargo install --path .
- run: cargo rpl --workspace --all-targets
- name: Run Clippy
run: cargo clippy -- -D warnings
- name: Install rpl
run: cargo install --path . --verbose
- name: Test installed rpl
run: cargo rpl --workspace --all-targets --verbose
# - uses: actions-rust-lang/audit@v1.2.4
88 changes: 45 additions & 43 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ color-print = "0.3.4"
anstream = "0.6.0"

[dev-dependencies]
ui_test = "0.29.2"
ui_test = "0.30.4"
tester = "0.9"
regex = "1.5"
toml.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The toolchain of RPL, which is a custom configuration of Rust compiler, enables

## Quick Start

1. Clone the repository and enter the directory: `git clone https://github.com/RPL-Toolchain/RPL.git && cd RPL`
1. Clone the repository and enter the directory: `git clone https://github.com/RPL-Toolchain/RPL.git && cd RPL` (When used on Windows, you should first set your RUSTUP_HOME environment variable, normally `%USERPROFILE%\.rustup`)

2. Install RPL as a cargo subcommand: `cargo install --path .`

Expand Down
3 changes: 2 additions & 1 deletion crates/rpl_parser/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ fn find_rustfmt_path() -> Result<String, Box<dyn std::error::Error>> {
{
continue; // Use only the nightly toolchain from 2025-02-14
}
let rustfmt_candidate = toolchain.join("bin/rustfmt");
let rustfmt_executable = if cfg!(windows) { "rustfmt.exe" } else { "rustfmt" };
let rustfmt_candidate = toolchain.join("bin").join(rustfmt_executable);
if rustfmt_candidate.exists() {
return Ok(rustfmt_candidate.to_str().unwrap().to_string());
}
Expand Down
13 changes: 11 additions & 2 deletions tests/compile-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ use std::path::{Path, PathBuf};
use ui_test::custom_flags::edition::Edition;
use ui_test::custom_flags::rustfix::RustfixMode;
use ui_test::spanned::Spanned;
use ui_test::{Args, Config, error_on_output_conflict, status_emitter};
use ui_test::status_emitter::StatusEmitter;
use ui_test::{Args, Config, Match, error_on_output_conflict};

// Test dependencies may need an `extern crate` here to ensure that they show up
// in the depinfo file (otherwise cargo thinks they are unused)
Expand Down Expand Up @@ -196,6 +197,14 @@ impl TestContext {

config.program.program = profile_path.join(if cfg!(windows) { "rpl-driver.exe" } else { "rpl-driver" });

config
.comment_defaults
.base()
.normalize_stderr
.push((Match::from(env::current_dir().unwrap().as_path()), b"$DIR".into()));

config.fill_host_and_target().unwrap();

config
}
}
Expand All @@ -207,7 +216,7 @@ fn run_ui(cx: &TestContext) {
vec![config],
ui_test::default_file_filter,
ui_test::default_per_file_config,
status_emitter::Text::from(cx.args.format),
Box::<dyn StatusEmitter>::from(cx.args.format),
)
.unwrap();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/cve/cve_2021_27376/src/adjusted.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@ revisions: inline regular
//@[inline] compile-flags: -Z inline-mir=true
//@[regular] compile-flags: -Z inline-mir=false

//@ignore-target: windows
extern crate libc;

use libc::{sockaddr, sockaddr_storage, socklen_t};
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/cve/cve_2021_27376/src/lib.inline.stderr
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
error: wrong assumption of layout compatibility from `std::net::SocketAddrV4` to `libc::sockaddr`
--> tests/ui/cve/cve_2021_27376/src/lib.rs:70:38
--> tests/ui/cve/cve_2021_27376/src/lib.rs:71:38
|
LL | ... SocketAddr::V4(addr) => (addr as *const _ as *const _, mem::size_of_val(addr) as _),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ casted to `libc::sockaddr` here
|
= help: it's not guaranteed by Rust standard library. See https://github.com/rust-lang/rust/pull/78802
note: casted from this
--> tests/ui/cve/cve_2021_27376/src/lib.rs:70:38
--> tests/ui/cve/cve_2021_27376/src/lib.rs:71:38
|
LL | ... SocketAddr::V4(addr) => (addr as *const _ as *const _, mem::size_of_val(addr) as _),
| ^^^^
= note: `#[deny(rpl::wrong_assumption_of_layout_compatibility)]` on by default

error: wrong assumption of layout compatibility from `std::net::SocketAddrV6` to `libc::sockaddr`
--> tests/ui/cve/cve_2021_27376/src/lib.rs:71:38
--> tests/ui/cve/cve_2021_27376/src/lib.rs:72:38
|
LL | ... SocketAddr::V6(addr) => (addr as *const _ as *const _, mem::size_of_val(addr) as _),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ casted to `libc::sockaddr` here
|
= help: it's not guaranteed by Rust standard library. See https://github.com/rust-lang/rust/pull/78802
note: casted from this
--> tests/ui/cve/cve_2021_27376/src/lib.rs:71:38
--> tests/ui/cve/cve_2021_27376/src/lib.rs:72:38
|
LL | ... SocketAddr::V6(addr) => (addr as *const _ as *const _, mem::size_of_val(addr) as _),
| ^^^^
Expand Down
Loading