Skip to content

Commit

Permalink
chore: bump rust toolchain version to 1.83 (#1832)
Browse files Browse the repository at this point in the history
* chore: bump rust toolchain version to 1.84

Signed-off-by: zongz <[email protected]>

* fix: rm useless code changes

Signed-off-by: zongz <[email protected]>

* fix: make fmt

Signed-off-by: zongz <[email protected]>

* fix: mv 'rustup target add wasm32-wasi' to 'rustup target add wasm32-wasip1'

Signed-off-by: zongz <[email protected]>

* fix: fix wasm build command to target 'wasm32-wasip1'

Signed-off-by: zongz <[email protected]>

* fix: downgrade rust toolchains version to 1.83

Signed-off-by: zongz <[email protected]>

* fix: fix linux-arm64 image

Signed-off-by: zongz <[email protected]>

---------

Signed-off-by: zongz <[email protected]>
  • Loading branch information
zong-zhe authored Feb 5, 2025
1 parent 6affc15 commit 9860f3f
Show file tree
Hide file tree
Showing 43 changed files with 428 additions and 390 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test-macos-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79
toolchain: 1.83
override: true
components: clippy, rustfmt
- name: Set up python
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-test-ubuntu-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ jobs:

- name: Pull custom ARM64 Docker image
run: |
docker pull --platform linux/arm64 kcllang/kcl-builder-arm64
docker pull --platform linux/arm64 ghcr.io/kcl-lang/kcl-builder-arm64
- name: Build in Docker
run: |
docker run --rm --platform linux/arm64 \
-v ${{ github.workspace }}:/workspace -w /workspace \
kcllang/kcl-builder-arm64 \
ghcr.io/kcl-lang/kcl-builder-arm64 \
/bin/bash -c "export KCL_BUILD_GIT_SHA=$(git rev-parse HEAD) && git config --global --add safe.directory /workspace && git config --global user.name 'GitHub Action' && git config --global user.email '[email protected]' && make && make release && _build/dist/linux/kclvm/bin/kclvm_cli version"
- name: Read VERSION file
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79
toolchain: 1.83
override: true
components: clippy, rustfmt
- name: Code format check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mingw_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79
toolchain: 1.83
override: true
components: clippy, rustfmt

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_compiler_base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79
toolchain: 1.83
override: true
components: clippy, rustfmt
- name: Rust code format check
Expand All @@ -43,7 +43,7 @@ jobs:
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79
toolchain: 1.83
override: true
components: clippy, rustfmt
- name: Compiler_base rust unit test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79
toolchain: 1.83
override: true
components: clippy, rustfmt
- name: Code format check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wasm_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79
toolchain: 1.83
override: true
components: clippy, rustfmt

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79
toolchain: 1.83
override: true
components: clippy, rustfmt

Expand Down
2 changes: 1 addition & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{

#[link(name = "kclvm_cli_cdylib")]
#[allow(improper_ctypes)]
extern "C" {
extern "C-unwind" {
fn kclvm_cli_main(argc: c_int, argv: *const *const c_char) -> *mut ExitCode;
}

Expand Down
2 changes: 1 addition & 1 deletion kclvm/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub fn call_with_plugin_agent<'a>(
/// the Protobuf byte sequence and length of the calling parameter, and the return parameter is the byte sequence and
/// length of Protobuf.
#[no_mangle]
pub extern "C" fn call_native(
pub extern "C-unwind" fn call_native(
name_ptr: *const u8,
name_len: usize,
args_ptr: *const u8,
Expand Down
10 changes: 5 additions & 5 deletions kclvm/api/src/service/capi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn c_char_to_vec(args: *const c_char, args_len: usize) -> Vec<u8> {

/// Create an instance of kclvm_service and return its pointer
#[no_mangle]
pub extern "C" fn kclvm_service_new(plugin_agent: u64) -> *mut kclvm_service {
pub extern "C-unwind" fn kclvm_service_new(plugin_agent: u64) -> *mut kclvm_service {
let serv = kclvm_service { plugin_agent };
Box::into_raw(Box::new(serv))
}
Expand All @@ -31,7 +31,7 @@ pub extern "C" fn kclvm_service_new(plugin_agent: u64) -> *mut kclvm_service {
/// This function should not be called twice on the same ptr.
/// Delete KclvmService
#[no_mangle]
pub unsafe extern "C" fn kclvm_service_delete(serv: *mut kclvm_service) {
pub unsafe extern "C-unwind" fn kclvm_service_delete(serv: *mut kclvm_service) {
if !serv.is_null() {
unsafe {
drop(Box::from_raw(serv));
Expand All @@ -44,7 +44,7 @@ pub unsafe extern "C" fn kclvm_service_delete(serv: *mut kclvm_service) {
/// This function should not be called twice on the same ptr.
/// Free memory for string returned to the outside
#[no_mangle]
pub unsafe extern "C" fn kclvm_service_free_string(res: *mut c_char) {
pub unsafe extern "C-unwind" fn kclvm_service_free_string(res: *mut c_char) {
if !res.is_null() {
unsafe {
let _ = CString::from_raw(res);
Expand Down Expand Up @@ -90,7 +90,7 @@ macro_rules! call {
/// result: [*const c_char]
/// Result of the call serialized as protobuf byte sequence
#[no_mangle]
pub extern "C" fn kclvm_service_call(
pub extern "C-unwind" fn kclvm_service_call(
serv: *mut kclvm_service,
name: *const c_char,
args: *const c_char,
Expand Down Expand Up @@ -120,7 +120,7 @@ pub extern "C" fn kclvm_service_call(
/// result: [*const c_char]
/// Result of the call serialized as protobuf byte sequence
#[no_mangle]
pub extern "C" fn kclvm_service_call_with_length(
pub extern "C-unwind" fn kclvm_service_call_with_length(
serv: *mut kclvm_service,
name: *const c_char,
args: *const c_char,
Expand Down
14 changes: 7 additions & 7 deletions kclvm/runner/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ impl LibRunner {
) -> Result<()> {
// get kclvm_plugin_init
let kclvm_plugin_init: libloading::Symbol<
unsafe extern "C" fn(
fn_ptr: extern "C" fn(
unsafe extern "C-unwind" fn(
fn_ptr: extern "C-unwind" fn(
method: *const c_char,
args_json: *const c_char,
kwargs_json: *const c_char,
Expand All @@ -324,12 +324,12 @@ impl LibRunner {
// get plugin_method
let plugin_method_ptr = plugin_method_ptr;
let plugin_method_ptr = (plugin_method_ptr as *const u64) as *const ()
as *const extern "C" fn(
as *const extern "C-unwind" fn(
method: *const c_char,
args: *const c_char,
kwargs: *const c_char,
) -> *const c_char;
let plugin_method: extern "C" fn(
let plugin_method: extern "C-unwind" fn(
method: *const c_char,
args: *const c_char,
kwargs: *const c_char,
Expand All @@ -345,7 +345,7 @@ impl LibRunner {
args: &ExecProgramArgs,
) -> Result<ExecProgramResult> {
let kcl_run: libloading::Symbol<
unsafe extern "C" fn(
unsafe extern "C-unwind" fn(
kclvm_main_ptr: u64, // main.k => kclvm_main
option_len: kclvm_size_t,
option_keys: *const *const kclvm_char_t,
Expand Down Expand Up @@ -512,7 +512,7 @@ impl FastRunner {
#[cfg(not(target_arch = "wasm32"))]
let prev_hook = std::panic::take_hook();
#[cfg(not(target_arch = "wasm32"))]
std::panic::set_hook(Box::new(|info: &std::panic::PanicInfo| {
std::panic::set_hook(Box::new(|info: &std::panic::PanicHookInfo| {
KCL_RUNTIME_PANIC_RECORD.with(|record| {
let mut record = record.borrow_mut();
record.kcl_panic_info = true;
Expand All @@ -536,7 +536,7 @@ impl FastRunner {
if self.opts.plugin_agent_ptr > 0 {
#[cfg(not(target_arch = "wasm32"))]
unsafe {
let plugin_method: extern "C" fn(
let plugin_method: extern "C-unwind" fn(
method: *const c_char,
args: *const c_char,
kwargs: *const c_char,
Expand Down
6 changes: 3 additions & 3 deletions kclvm/runtime/src/_kcl_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ fn new_ctx_with_opts(opts: FFIRunOptions, path_selector: &[String]) -> Context {
#[no_mangle]
#[runtime_fn]
#[allow(clippy::too_many_arguments)]
pub unsafe extern "C" fn _kcl_run(
pub unsafe extern "C-unwind" fn _kcl_run(
kclvm_main_ptr: u64, // main.k => kclvm_main
option_len: kclvm_size_t,
option_keys: *const *const kclvm_char_t,
Expand All @@ -110,7 +110,7 @@ pub unsafe extern "C" fn _kcl_run(
kclvm_builtin_option_init(ctx, option_keys[i], option_values[i]);
}
let prev_hook = std::panic::take_hook();
std::panic::set_hook(Box::new(|info: &std::panic::PanicInfo| {
std::panic::set_hook(Box::new(|info: &std::panic::PanicHookInfo| {
KCL_RUNTIME_PANIC_RECORD.with(|record| {
let mut record = record.borrow_mut();
record.kcl_panic_info = true;
Expand Down Expand Up @@ -172,7 +172,7 @@ unsafe fn _kcl_run_in_closure(
kclvm_main_ptr: u64, // main.k => kclvm_main
) {
let kclvm_main = (&kclvm_main_ptr as *const u64) as *const ()
as *const extern "C" fn(
as *const extern "C-unwind" fn(
ctx: *mut kclvm_context_t,
scope: *mut kclvm_eval_scope_t,
) -> *mut kclvm_value_ref_t;
Expand Down
4 changes: 2 additions & 2 deletions kclvm/runtime/src/_kclvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
extern "C-unwind" {
#endif

// please keep same as 'kclvm/runtime/src/kind/mod.rs#Kind'
Expand Down Expand Up @@ -724,7 +724,7 @@ kclvm_value_ref_t* kclvm_yaml_encode_all(kclvm_context_t* ctx, kclvm_value_ref_t
kclvm_value_ref_t* kclvm_yaml_validate(kclvm_context_t* ctx, kclvm_value_ref_t* args, kclvm_value_ref_t* kwargs);

#ifdef __cplusplus
} // extern "C"
} // extern "C-unwind"
#endif

#endif // _kclvm_h_
4 changes: 2 additions & 2 deletions kclvm/runtime/src/base64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::*;

#[no_mangle]
#[runtime_fn]
pub extern "C" fn kclvm_base64_encode(
pub extern "C-unwind" fn kclvm_base64_encode(
ctx: *mut kclvm_context_t,
args: *const kclvm_value_ref_t,
kwargs: *const kclvm_value_ref_t,
Expand All @@ -24,7 +24,7 @@ pub extern "C" fn kclvm_base64_encode(

#[no_mangle]
#[runtime_fn]
pub extern "C" fn kclvm_base64_decode(
pub extern "C-unwind" fn kclvm_base64_decode(
ctx: *mut kclvm_context_t,
args: *const kclvm_value_ref_t,
kwargs: *const kclvm_value_ref_t,
Expand Down
2 changes: 1 addition & 1 deletion kclvm/runtime/src/collection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::*;

#[no_mangle]
#[runtime_fn]
pub extern "C" fn kclvm_value_union_all(
pub extern "C-unwind" fn kclvm_value_union_all(
ctx: *mut kclvm_context_t,
args: *const kclvm_value_ref_t,
_kwargs: *const kclvm_value_ref_t,
Expand Down
Loading

0 comments on commit 9860f3f

Please sign in to comment.