Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

ices/98010.rs: fixed with errors #1639

Merged
merged 1 commit into from
Oct 15, 2023
Merged

ices/98010.rs: fixed with errors #1639

merged 1 commit into from
Oct 15, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Aug 5, 2023

Issue: rust-lang/rust#98010

#![no_std]
#![no_core]
#![no_main]
#![feature(no_core, lang_items)]

#[lang = "sized"]
trait Sized {}
#[lang = "sync"]
trait Sync {}
#[lang = "copy"]
trait Copy {}
#[lang = "freeze"]
trait Freeze {}

impl Sync for u32 {}
impl Sync for i32 {}

// impl Copy for u32 {} // if remove, it cause rustc crash

#[lang = "drop_in_place"]
#[allow(unconditional_recursion)]
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
    unsafe { drop_in_place(to_drop) }
}

#[link(name = "Kernel32")]
extern "system" {
    pub fn ExitProcess(uexitcode: u32) -> !;
}

fn exit_process(exit_code: u32) -> ! {
    // Copying is necessary to pass the value through the function argument, and if this is avoided, there will be no error either.
    unsafe {
        ExitProcess(exit_code);
    }
}

#[no_mangle]
pub extern "C" fn wWinMainCRTStartup() -> i32 {
    exit_process(0);
}

#[no_mangle]
pub static _fltused: i32 = 1;

fn main() {}
=== stdout ===
=== stderr ===
error: the feature `lang_items` is internal to the compiler or standard library
 --> /home/runner/work/glacier/glacier/ices/98010.rs:4:21
  |
4 | #![feature(no_core, lang_items)]
  |                     ^^^^^^^^^^
  |
  = note: using it is strongly discouraged
  = note: `#[deny(internal_features)]` on by default

warning: function `main` is never used
  --> /home/runner/work/glacier/glacier/ices/98010.rs:46:4
   |
46 | fn main() {}
   |    ^^^^
   |
   = note: `#[warn(dead_code)]` on by default

error: aborting due to previous error; 1 warning emitted

==============

=== stdout ===
=== stderr ===
error: the feature `lang_items` is internal to the compiler or standard library
 --> /home/runner/work/glacier/glacier/ices/98010.rs:4:21
  |
4 | #![feature(no_core, lang_items)]
  |                     ^^^^^^^^^^
  |
  = note: using it is strongly discouraged
  = note: `#[deny(internal_features)]` on by default

warning: function `main` is never used
  --> /home/runner/work/glacier/glacier/ices/98010.rs:46:4
   |
46 | fn main() {}
   |    ^^^^
   |
   = note: `#[warn(dead_code)]` on by default

error: aborting due to previous error; 1 warning emitted

==============
@JohnTitor JohnTitor merged commit f1da057 into master Oct 15, 2023
@JohnTitor JohnTitor deleted the autofix/ices/98010.rs branch October 15, 2023 03:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants