Skip to content

Commit

Permalink
chore: make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Chronostasys committed Dec 19, 2024
1 parent 1ac1b1b commit 22b3e21
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/npmpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: install rust
run: cargo install wasm-pack
- name: build wasm
run: wasm-pack build --target bundler --no-default-features --scope pivot-lang --release
run: wasm-pack build --target bundler --no-default-features --scope pivot-lang --release --locked
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
CARGO_TARGET_DIR: ${{ matrix.CARGO_TARGET_DIR }}
KAGARI_LIB_ROOT: ${{ github.workspace }}${{ matrix.KAGARI_LIB_ROOT }}
PL_ROOT: ${{ github.workspace }}${{ matrix.PL_ROOT }}
GC_LOG: warn
GC_LOG: trace
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path vm/Cargo.toml --target-dir target -vv
args: --manifest-path vm/Cargo.toml --target-dir target -vv --no-default-features --features "static,immix,jitdylib"

# - name: build plc
# uses: actions-rs/cargo@v1
Expand Down
4 changes: 1 addition & 3 deletions src/ast/ctx/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,7 @@ impl<'a, 'ctx> Ctx<'a> {
if let PLType::Union(u) = &*target_pltype.borrow() {
let mut union_members = vec![];
for tp in &u.sum_types {
let tp = self.run_in_type_mod(u, |ctx,u|{
tp.get_type(ctx, builder, true)
})?;
let tp = self.run_in_type_mod(u, |ctx, _| tp.get_type(ctx, builder, true))?;
union_members.push(tp);
}
for (i, tp) in union_members.iter().enumerate() {
Expand Down
7 changes: 6 additions & 1 deletion src/ast/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,12 +510,17 @@ fn test_compile() {
let exe = crate::utils::canonicalize(&exe)
.unwrap_or_else(|_| panic!("static compiled file not found {:?}", exe));
eprintln!("exec: {:?}", exe);
eprintln!(
"start: {:?}",
std::time::SystemTime::now().duration_since(std::time::SystemTime::UNIX_EPOCH)
);
let mut child = Command::new(exe.to_str().unwrap())
.env("GC_LOG", "info")
.spawn()
.expect("failed to execute compiled program");

let o = child
.wait_timeout(std::time::Duration::from_secs(50))
.wait_timeout(std::time::Duration::from_secs(500))
.expect("failed to wait on child");
if o.is_none() {
child.kill().expect("failed to kill child");
Expand Down
5 changes: 4 additions & 1 deletion test/test/std_test.pi
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl Task<i64> for CustomTask {

pub fn test_std() void {
iter::test_generator();
println!("test_gen done");
let re = "abcde".index_of("cde");
let chars = [1,2,3];
let subchars = [3];
Expand Down Expand Up @@ -72,7 +73,7 @@ pub fn test_std() void {
let mi = math::min(1.0, 2.0);
panic::assert(mi==1.0);
panic::assert((math::cos(math::PI) - -1.0).abs() < 0.0000001);

println!("math done");
let task = async_f1();
task.poll(||=>{
return;
Expand Down Expand Up @@ -103,7 +104,9 @@ pub fn test_std() void {
});
panic::assert(b == 100);
fn1(test{a:9999});
println!("async done");
test_json();
println!("json done");
return;
}

Expand Down
11 changes: 7 additions & 4 deletions vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ fn printi64ln(i: i64) {
println!("{}", i);
}

#[is_runtime]
fn eprinti64ln(i: i64) {
eprintln!("{}", i);

Check warning on line 33 in vm/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

vm/src/lib.rs#L32-L33

Added lines #L32 - L33 were not covered by tests
}

#[is_runtime]
fn pl_panic() {
println!("pivot lang panic occured!");
Expand Down Expand Up @@ -91,21 +96,19 @@ fn vm_ftoa(f: f32, rec: *mut u8) {
}

#[is_runtime]
fn new_thread(f: *mut i128, sp:*mut u8) {
fn new_thread(f: *mut i128, sp: *mut u8) {

Check warning on line 99 in vm/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

vm/src/lib.rs#L99

Added line #L99 was not covered by tests
// f's first 8 byte is fn pointer, next 8 byte is data pointer
let ptr = f as *const i64;
let f_ptr = ptr as *const extern "C" fn(i64);
let data_ptr = unsafe { *ptr.offset(1) };
let func = unsafe { *f_ptr };
let (s, r) = channel::<()>();
let ptr_i = ptr as i64;
// let ptr_i = ptr as i64;
immix::pin(data_ptr as _);
// immix::gc_keep_live(data_ptr as _);

Check warning on line 108 in vm/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

vm/src/lib.rs#L106-L108

Added lines #L106 - L108 were not covered by tests
// immix::gc_add_root(data_ptr as *mut _, ObjectType::Pointer.int_value());
let c = move || {
// thread::sleep(std::time::Duration::from_secs(1));
let sp = immix::Collector::current_sp();
immix::set_high_sp(sp);
// immix::gc_keep_live(data_ptr as _);

Check warning on line 112 in vm/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

vm/src/lib.rs#L112

Added line #L112 was not covered by tests
// immix::set_evacuation(false);
// immix::gc_add_root(&mut f as *mut _ as *mut _, ObjectType::Trait.int_value());
Expand Down

0 comments on commit 22b3e21

Please sign in to comment.