Skip to content

Commit

Permalink
Remove use of the start feature
Browse files Browse the repository at this point in the history
`#![feature(start)]` was removed in [1], but we make use of it in the
intrinsics example. Replace use of this feature with `#[no_mangle]`
applied to `#[main]`.

We don't actually run this example so it is not a problem if this is not
entirely accurate. Currently the example does not run to completion,
instead invoking `rust_begin_unwind`.

[1]: rust-lang/rust#134299
  • Loading branch information
tgross35 committed Jan 27, 2025
1 parent ee92690 commit 5ae9411
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions examples/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@

#![allow(unused_features)]
#![allow(internal_features)]
#![cfg_attr(thumb, no_main)]
#![deny(dead_code)]
#![feature(allocator_api)]
#![feature(f128)]
#![feature(f16)]
#![feature(lang_items)]
#![feature(start)]
#![no_std]
#![no_main]

extern crate panic_handler;

use core::ffi::c_int;

#[cfg(all(not(thumb), not(windows), not(target_arch = "wasm32")))]
#[link(name = "c")]
extern "C" {}
Expand Down Expand Up @@ -630,11 +631,10 @@ fn run() {
extern "C" {
fn rust_begin_unwind(x: usize);
}
// if bb(false) {

unsafe {
rust_begin_unwind(0);
}
// }
}

fn something_with_a_dtor(f: &dyn Fn()) {
Expand All @@ -649,15 +649,15 @@ fn something_with_a_dtor(f: &dyn Fn()) {
f();
}

#[no_mangle]
#[cfg(not(thumb))]
#[start]
fn main(_: isize, _: *const *const u8) -> isize {
fn main(_argc: c_int, _argv: *const *const u8) -> c_int {
run();
0
}

#[cfg(thumb)]
#[no_mangle]
#[cfg(thumb)]
pub fn _start() -> ! {
run();
loop {}
Expand Down

0 comments on commit 5ae9411

Please sign in to comment.