Skip to content
Open
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
2 changes: 1 addition & 1 deletion tools/hermes/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod errors;
mod parse;
mod resolve;
mod shadow;
mod transform;

mod ui_test_shim;

use clap::Parser;
Expand Down
9 changes: 2 additions & 7 deletions tools/hermes/src/shadow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use walkdir::WalkDir;
use crate::{
parse,
resolve::{HermesTargetKind, HermesTargetName, Roots},
transform,
};

pub struct HermesArtifact {
Expand Down Expand Up @@ -207,13 +206,11 @@ fn process_file_recursive<'a>(
fs::create_dir_all(parent)?;
}

// Walk the AST, collecting edits and new modules to process.
let mut edits = Vec::new();
// Walk the AST, collecting new modules to process.
let (source_code, unloaded_modules) =
parse::read_file_and_scan_compilation_unit(src_path, |_src, item_result| {
match item_result {
Ok(parsed_item) => {
transform::append_edits(&parsed_item, &mut edits);
if let Some(item_name) = parsed_item.item.name() {
// Calculate the full path to this item.
let mut full_path = module_prefix.clone();
Expand All @@ -234,9 +231,7 @@ fn process_file_recursive<'a>(
})
.context(format!("Failed to parse {:?}", src_path))?;

// Apply edits in-place before writing to disk.
let mut buffer = source_code.into_bytes();
transform::apply_edits(&mut buffer, &edits);
let buffer = source_code.into_bytes();
fs::write(&dest_path, &buffer)
.context(format!("Failed to write shadow file {:?}", dest_path))?;

Expand Down
178 changes: 0 additions & 178 deletions tools/hermes/src/transform.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// ```lean
/// model foo
/// ```
fn foo() -> i32 {
unsafe fn foo() -> i32 {
1 + 1
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
failure
success
10 changes: 0 additions & 10 deletions tools/hermes/tests/fixtures/unsafe_redaction/expected_stderr.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
× mismatched types
╭─[[PROJECT_ROOT]/src/lib.rs:4:11]
3 │ /// ```
4 │ unsafe fn foo() -> i32 {
· ─┬─ ─┬─
· │ ╰── expected `i32`, found `()`
· ╰── implicitly returns `()` as its body has no tail or `return` expression
5 │ 1 + 1
╰────

[External Info] For more information about this error, try `rustc --explain E0308`.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/// ```lean
/// model async_foo
/// ```
async fn async_foo() -> i32 { }
async unsafe fn async_foo() -> i32 { 0 }

/// ```lean
/// model const_foo
/// ```
const fn const_foo() -> i32 { }
const unsafe fn const_foo() -> i32 { 0 }

/// ```lean
/// model extern_foo
/// ```
extern "C" fn extern_foo() -> i32 { }
unsafe extern "C" fn extern_foo() -> i32 { 0 }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// ```lean
/// model main
/// ```
fn main()
unsafe fn main() {}
Loading