Skip to content

Commit f42ac3b

Browse files
committed
panic reimplementation & partialEq macro
1 parent 461c183 commit f42ac3b

File tree

2 files changed

+52
-19
lines changed

2 files changed

+52
-19
lines changed

tests/auxiliary/minicore.rs

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,47 @@ macro_rules! stringify {
111111
};
112112
}
113113

114+
#[macro_export]
115+
macro_rules! partialEq {
116+
($($ty:ty),* $(,)?) => {
117+
$(
118+
impl PartialEq for $ty {
119+
#[inline]
120+
fn eq(&self, other: &$ty) -> bool {
121+
(*self) == (*other)
122+
}
123+
#[inline]
124+
fn ne(&self, other: &$ty) -> bool {
125+
(*self) != (*other)
126+
}
127+
}
128+
)*
129+
}
130+
}
131+
132+
partialEq!(
133+
bool, char, isize, i8, i16, i32, i64, i128, usize, u8, u16, u32, u64, u128, f16, f32, f64, f128
134+
);
135+
136+
#[lang = "panic"]
137+
//#[rustc_const_panic_str]
138+
#[inline(never)]
139+
#[cold]
140+
#[track_caller]
141+
#[rustc_nounwind]
142+
const fn panic(expr: &'static str) -> ! {
143+
abort()
144+
}
145+
146+
#[lang = "panic_fmt"]
147+
const fn panic_fmt(fmt: &str) -> ! {
148+
abort()
149+
}
150+
114151
#[macro_export]
115152
macro_rules! panic {
116-
($msg:literal) => {
117-
$crate::panic(&$msg)
153+
($msg:expr) => {
154+
$crate::panic($msg)
118155
};
119156
}
120157

@@ -131,12 +168,6 @@ pub const fn abort() -> ! {
131168
loop {}
132169
}
133170

134-
#[lang = "panic"]
135-
#[rustc_const_panic_str]
136-
const fn panic(expr: &&'static str) -> ! {
137-
abort();
138-
}
139-
140171
#[lang = "eq"]
141172
pub trait PartialEq<Rhs: ?Sized = Self> {
142173
fn eq(&self, other: &Rhs) -> bool;
@@ -145,17 +176,17 @@ pub trait PartialEq<Rhs: ?Sized = Self> {
145176
}
146177
}
147178

148-
impl PartialEq for usize {
149-
fn eq(&self, other: &usize) -> bool {
150-
(*self) == (*other)
151-
}
152-
}
153-
154-
impl PartialEq for bool {
155-
fn eq(&self, other: &bool) -> bool {
156-
(*self) == (*other)
157-
}
158-
}
179+
//impl PartialEq for usize {
180+
// fn eq(&self, other: &usize) -> bool {
181+
// (*self) == (*other)
182+
// }
183+
//}
184+
//
185+
//impl PartialEq for bool {
186+
// fn eq(&self, other: &bool) -> bool {
187+
// (*self) == (*other)
188+
// }
189+
//}
159190

160191
#[lang = "not"]
161192
pub trait Not {

tests/run-make/core-ffi-typecheck-clang/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ fn main() {
4242

4343
preprocess_core_ffi();
4444

45+
// Print the list of target JSON files, which will be used to match Rust target strings to LLVM
46+
4547
let targets_json =
4648
rustc().arg("--print").arg("all-target-specs-json").arg("-Z").arg("unstable-options").run();
4749
let targets_json_str =

0 commit comments

Comments
 (0)