Skip to content

Commit 4422820

Browse files
committed
[WIP]
1 parent b597848 commit 4422820

File tree

3 files changed

+3
-54
lines changed

3 files changed

+3
-54
lines changed

example/std_example.rs

+1-53
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,7 @@ use std::io::Write;
44
use std::intrinsics;
55

66
fn main() {
7-
let _ = ::std::iter::repeat('a' as u8).take(10).collect::<Vec<_>>();
8-
let stderr = ::std::io::stderr();
9-
let mut stderr = stderr.lock();
10-
11-
writeln!(stderr, "some {} text", "<unknown>").unwrap();
12-
13-
let _ = std::process::Command::new("true").env("c", "d").spawn();
14-
15-
println!("cargo:rustc-link-lib=z");
16-
17-
static ONCE: std::sync::Once = std::sync::ONCE_INIT;
18-
ONCE.call_once(|| {});
19-
20-
LoopState::Continue(()) == LoopState::Break(());
21-
22-
// Make sure ByValPair values with differently sized components are correctly passed
23-
map(None::<(u8, Box<Instruction>)>);
24-
25-
println!("{}", 2.3f32.exp());
26-
println!("{}", 2.3f32.exp2());
27-
println!("{}", 2.3f32.abs());
28-
println!("{}", 2.3f32.sqrt());
29-
println!("{}", 2.3f32.floor());
30-
println!("{}", 2.3f32.ceil());
31-
println!("{}", 2.3f32.min(1.0));
32-
println!("{}", 2.3f32.max(1.0));
33-
34-
assert_eq!(0b0000000000000000000000000010000010000000000000000000000000000000_0000000000100000000000000000000000001000000000000100000000000000u128.leading_zeros(), 26);
35-
assert_eq!(0b0000000000000000000000000010000000000000000000000000000000000000_0000000000000000000000000000000000001000000000000000000010000000u128.trailing_zeros(), 7);
36-
37-
checked_div_i128(0i128, 2i128);
38-
checked_div_u128(0u128, 2u128);
39-
assert_eq!(1u128 + 2, 3);
40-
41-
assert_eq!(0b100010000000000000000000000000000u128 >> 10, 0b10001000000000000000000u128);
42-
assert_eq!(0xFEDCBA987654321123456789ABCDEFu128 >> 64, 0xFEDCBA98765432u128);
43-
assert_eq!(0xFEDCBA987654321123456789ABCDEFu128 as i128 >> 64, 0xFEDCBA98765432i128);
44-
assert_eq!(353985398u128 * 932490u128, 330087843781020u128);
7+
println!("{:?}", 0u128.checked_div(2u128));
458
}
469

4710
#[derive(PartialEq)]
@@ -61,18 +24,3 @@ fn map(a: Option<(u8, Box<Instruction>)>) -> Option<Box<Instruction>> {
6124
Some((_, instr)) => Some(instr),
6225
}
6326
}
64-
65-
fn checked_div_i128(lhs: i128, rhs: i128) -> Option<i128> {
66-
if rhs == 0 || (lhs == -170141183460469231731687303715884105728 && rhs == -1) {
67-
None
68-
} else {
69-
Some(unsafe { intrinsics::unchecked_div(lhs, rhs) })
70-
}
71-
}
72-
73-
fn checked_div_u128(lhs: u128, rhs: u128) -> Option<u128> {
74-
match rhs {
75-
0 => None,
76-
rhs => Some(unsafe { intrinsics::unchecked_div(lhs, rhs) })
77-
}
78-
}

hello_world_mt.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn main() { std::thread::spawn(move || println!("Hello World!")).join().unwrap(); }

src/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ fn codegen_fn_content<'a, 'tcx: 'a>(fx: &mut FunctionCx<'a, 'tcx, impl Backend>)
164164
} else {
165165
fx.bcx.ins().brz(cond, target, &[]);
166166
};
167-
trap_panic(fx, format!("[panic] Assert {:?} failed.", msg));
167+
trap_panic(fx, format!("[panic] Assert {:?} at {:?} failed.", msg, bb_data.terminator().source_info.span));
168168
}
169169

170170
TerminatorKind::SwitchInt {

0 commit comments

Comments
 (0)