-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cfg(no_128_bit) to core: removes most u128/i128 operations
- Loading branch information
Showing
10 changed files
with
97 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
include ../tools.mk | ||
|
||
all: | ||
$(RUSTC) --edition=2021 --crate-type=rlib --crate-name=core ../../../library/core/src/lib.rs --cfg no_128_bit | ||
$(RUSTC) --edition=2021 --crate-type=staticlib --crate-name=demo --sysroot=. -C panic=abort lib.rs | ||
# Expect that objdump succeeds and grep fails. The grep pattern is for names like __multi3. | ||
# There is no pipefail on dash so echo a string that will fail the test if objump fails. | ||
(objdump -t $(TMPDIR)/libdemo.a || echo __objdumpfailedti) | (! grep -w '__[a-z]\+ti[0-9]\?') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#![feature(no_core)] | ||
|
||
#![no_std] | ||
#![no_core] // supress compiler-builtins | ||
extern crate core; | ||
use core::prelude::rust_2021::*; | ||
use core::fmt::Write; | ||
|
||
// An empty file might be sufficient here, but since formatting is one of the | ||
// features affected by no_128_bit it seems worth including some. | ||
|
||
struct X(pub usize); | ||
impl core::fmt::Write for X { | ||
fn write_str(&mut self, s: &str) -> core::fmt::Result { | ||
self.0 += s.len(); | ||
Ok(()) | ||
} | ||
} | ||
|
||
#[no_mangle] | ||
extern "C" fn demo() -> usize { | ||
let mut x = X(0); | ||
// Writes "i128 u128 foo" due to the removal of u/i128 formatting. | ||
core::write!(x, "{:?} {:?} {}", i128::MAX, u128::MIN, "foo").unwrap(); | ||
x.0 | ||
} | ||
|
||
#[panic_handler] | ||
fn panic(_: &core::panic::PanicInfo) -> ! { | ||
loop {} | ||
} |