Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rust] Updated dependencies #3952

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions src/Fable.Transforms/Rust/Fable2Rust.fs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ module TypeInfo =
[ ty ] |> makeImportType com ctx "Native" "Arc"

let makeBoxTy com ctx (ty: Rust.Ty) : Rust.Ty =
[ ty ] |> makeImportType com ctx "Native" "Box"
[ ty ] |> makeImportType com ctx "Native" (rawIdent "Box")

let makeMutTy com ctx (ty: Rust.Ty) : Rust.Ty =
[ ty ] |> makeImportType com ctx "Native" "MutCell"
Expand Down Expand Up @@ -1511,7 +1511,7 @@ module Util =
[ value ] |> makeNew com ctx "Native" "Arc"

let makeBoxValue com ctx (value: Rust.Expr) =
[ value ] |> makeNew com ctx "Native" "Box"
[ value ] |> makeNew com ctx "Native" (rawIdent "Box")

let makeMutValue com ctx (value: Rust.Expr) =
[ value ] |> makeNew com ctx "Native" "MutCell"
Expand Down
2 changes: 1 addition & 1 deletion src/fable-library-rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ default = ["bigint", "datetime", "decimal", "enum_func", "enum_string", "guid",
chrono = { version = "0.4", optional = true }
futures = { version = "0.3", features = ["executor", "thread-pool"], default-features = false, optional = true }
futures-timer = { version = "3.0", optional = true }
hashbrown = { version = "0.14", optional = true }
hashbrown = { version = "0.15", optional = true }
num-bigint = { version = "0.4", optional = true }
num-integer = { version = "0.1", optional = true }
num-traits = { version = "0.2", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion src/fable-library-rust/src/Exception.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub mod Exception_ {
use crate::Native_::{Any, Box_, Func0, LrcPtr};
use crate::Native_::{Any, Box, Func0, LrcPtr};
use crate::String_::{fromSlice, string};
use crate::System::Exception;
use crate::Util_::new_Exception;
Expand Down
13 changes: 11 additions & 2 deletions src/fable-library-rust/src/Native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub mod Native_ {

// re-export at module level
// pub use alloc::borrow::Cow;
pub use alloc::boxed::Box as Box_;
pub use alloc::boxed::Box;
pub use alloc::rc::Rc;
pub use alloc::string::{String, ToString};
pub use alloc::sync::Arc;
Expand Down Expand Up @@ -111,7 +111,7 @@ pub mod Native_ {

pub fn getHashCode<T: Hash>(x: T) -> i32 {
#[cfg(feature = "no_std")]
let mut hasher = hashbrown::hash_map::DefaultHashBuilder::default().build_hasher();
let mut hasher = hashbrown::DefaultHashBuilder::default().build_hasher();
#[cfg(not(feature = "no_std"))]
let mut hasher = std::collections::hash_map::DefaultHasher::new();
x.hash(&mut hasher);
Expand Down Expand Up @@ -163,6 +163,15 @@ pub mod Native_ {
)
}

#[cfg(feature = "no_std")]
pub fn get_args(argc: isize, argv: *const *const u8) -> impl Iterator<Item = &'static str> {
(0..argc as usize).map(move |i| unsafe {
let curr_argv = argv.add(i).read_volatile();
let c_str = core::ffi::CStr::from_ptr(curr_argv as *const _);
c_str.to_str().unwrap()
})
}

// -----------------------------------------------------------
// IEqualityComparer key wrapper
// -----------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion tests/Rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ edition = "2021"
no_std = ["fable_library_rust/no_std"]
static_do_bindings = ["fable_library_rust/static_do_bindings"]
threaded = ["fable_library_rust/threaded"]
# default = ["threaded"] # Uncomment when attempting to debug/use rust analyzer to switch to threaded mode
# default = ["no_std"] # Uncomment to default to "no_std" mode
# default = ["threaded"] # Uncomment to default to "threaded" mode

[dependencies]
fable_library_rust = { path = "./fable_modules/fable-library-rust" }
Loading