Repository: rune-rs/rune (language: rust)

Issue:
Heads-up: #[start] is being removed
We are planning to remove the unstable `#[start]` attribute from the compiler, see https://github.com/rust-lang/rust/pull/134299 for rationale and further details. This repo showed up in a search for users of the attribute in [this file](https://github.com/rune-rs/rune/blob/main/no-std/examples/minimal.rs). For all we know, there's no good reason to use this attribute and you can do the following instead:
```rust
#![no_main]

#[no_mangle]
extern "C" fn main(argc: core::ffi::c_int, argv: *const *const u8) -> core::ffi::c_int {
  // ...
}
```

If that for some reason does not work, please let us know!


Discussion / hints:

Fix patch:
diff --git a/crates/rune/src/runtime/from_value.rs b/crates/rune/src/runtime/from_value.rs
index bab86b080..5fecbaed6 100644
--- a/crates/rune/src/runtime/from_value.rs
+++ b/crates/rune/src/runtime/from_value.rs
@@ -153,9 +153,13 @@ where
 ///     field: u64,
 /// }
 ///
-/// let mut sources = rune::sources!(entry => {
-///     pub fn main() { #{field: 42} }
-/// });
+/// let mut sources = rune::sources! {
+///     entry => {
+///         pub fn main() {
+///             #{field: 42}
+///         }
+///     }
+/// };
 ///
 /// let unit = rune::prepare(&mut sources).build()?;
 ///
diff --git a/no-std/Cargo.toml b/no-std/Cargo.toml
index 43342e257..94f4303d4 100644
--- a/no-std/Cargo.toml
+++ b/no-std/Cargo.toml
@@ -12,4 +12,4 @@ rune = { path = "../crates/rune", default-features = false, features = ["alloc"]
 wee_alloc = "0.4.5"
 # Pull in your own critical-section implementation.
 # See: https://github.com/rust-embedded/critical-section/tree/main#usage-in-no-std-binaries
-critical-section = { version = "1.1.2", default-features = false }
+critical-section = { version = "1.2.0", default-features = false }
diff --git a/no-std/examples/minimal.rs b/no-std/examples/minimal.rs
index 7c3d503c0..b7bc7d43d 100644
--- a/no-std/examples/minimal.rs
+++ b/no-std/examples/minimal.rs
@@ -1,5 +1,6 @@
 #![no_std]
-#![feature(alloc_error_handler, start, core_intrinsics, lang_items, link_cfg)]
+#![no_main]
+#![feature(alloc_error_handler, core_intrinsics, lang_items, link_cfg)]
 #![allow(internal_features)]
 
 extern crate alloc;
@@ -33,6 +34,8 @@ extern "C" fn eh_personality() {}
 #[no_mangle]
 pub extern "C" fn _Unwind_Resume() {}
 
+use core::ffi::c_int;
+
 use alloc::sync::Arc;
 
 use rune::{Diagnostics, Vm};
@@ -53,10 +56,10 @@ unsafe impl critical_section::Impl for MyCriticalSection {
     unsafe fn release(_: RawRestoreState) {}
 }
 
-#[start]
-fn main(_argc: isize, _argv: *const *const u8) -> isize {
+#[no_mangle]
+extern "C" fn main(_argc: c_int, _argv: *const *const u8) -> c_int {
     match inner_main() {
-        Ok(output) => output as isize,
+        Ok(output) => output as c_int,
         Err(..) => -1,
     }
 }
@@ -64,13 +67,13 @@ fn main(_argc: isize, _argv: *const *const u8) -> isize {
 fn inner_main() -> rune::support::Result<i32> {
     let context = rune::Context::with_default_modules()?;
 
-    let mut sources = rune::sources!(
+    let mut sources = rune::sources! {
         entry => {
             pub fn main(number) {
                 number + 10
             }
         }
-    );
+    };
 
     let mut diagnostics = Diagnostics::new();
 


Test patch: