Skip to content

Commit b4a6676

Browse files
committed
Fix tests
1 parent 765274b commit b4a6676

File tree

8 files changed

+58
-5
lines changed

8 files changed

+58
-5
lines changed

src/asm.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,8 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
537537
}
538538
if dest.is_none() && options.contains(InlineAsmOptions::NORETURN) {
539539
let builtin_unreachable = self.context.get_builtin_function("__builtin_unreachable");
540-
let builtin_unreachable: RValue<'gcc> = unsafe {
541-
std::mem::transmute(builtin_unreachable)
542-
};
540+
let builtin_unreachable: RValue<'gcc> =
541+
unsafe { std::mem::transmute(builtin_unreachable) };
543542
self.call(self.type_void(), None, None, builtin_unreachable, &[], None, None);
544543
}
545544

src/intrinsic/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,11 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
675675
let step3 = self.or(left, right);
676676

677677
// Fourth step.
678-
if width == 8 { step3 } else { self.gcc_bswap(step3, width) }
678+
if width == 8 {
679+
step3
680+
} else {
681+
self.gcc_bswap(step3, width)
682+
}
679683
}
680684
128 => {
681685
// TODO(antoyo): find a more efficient implementation?

src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,10 @@ impl WriteBackendMethods for GccCodegenBackend {
413413
back::write::codegen(cgcx, dcx, module, config)
414414
}
415415

416-
fn prepare_thin(_module: ModuleCodegen<Self::Module>, _emit_summary: bool) -> (String, Self::ThinBuffer) {
416+
fn prepare_thin(
417+
_module: ModuleCodegen<Self::Module>,
418+
_emit_summary: bool,
419+
) -> (String, Self::ThinBuffer) {
417420
unimplemented!();
418421
}
419422

tests/run/array.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,17 @@ impl Sub for i16 {
205205
}
206206
}
207207

208+
#[track_caller]
209+
#[lang = "panic_const_add_overflow"]
210+
pub fn panic_const_add_overflow() -> ! {
211+
panic("attempt to add with overflow");
212+
}
213+
214+
#[track_caller]
215+
#[lang = "panic_const_sub_overflow"]
216+
pub fn panic_const_sub_overflow() -> ! {
217+
panic("attempt to subtract with overflow");
218+
}
208219

209220
/*
210221
* Code

tests/run/assign.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ impl Add for isize {
120120
}
121121
}
122122

123+
#[track_caller]
124+
#[lang = "panic_const_add_overflow"]
125+
pub fn panic_const_add_overflow() -> ! {
126+
panic("attempt to add with overflow");
127+
}
128+
123129
/*
124130
* Code
125131
*/

tests/run/closure.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ pub fn panic(_msg: &'static str) -> ! {
189189
}
190190
}
191191

192+
#[track_caller]
193+
#[lang = "panic_const_add_overflow"]
194+
pub fn panic_const_add_overflow() -> ! {
195+
panic("attempt to add with overflow");
196+
}
197+
192198
/*
193199
* Code
194200
*/

tests/run/mut_ref.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ impl Add for isize {
122122
}
123123
}
124124

125+
#[track_caller]
126+
#[lang = "panic_const_add_overflow"]
127+
pub fn panic_const_add_overflow() -> ! {
128+
panic("attempt to add with overflow");
129+
}
130+
125131
/*
126132
* Code
127133
*/

tests/run/operations.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,24 @@ impl Mul for isize {
207207
}
208208
}
209209

210+
#[track_caller]
211+
#[lang = "panic_const_add_overflow"]
212+
pub fn panic_const_add_overflow() -> ! {
213+
panic("attempt to add with overflow");
214+
}
215+
216+
#[track_caller]
217+
#[lang = "panic_const_sub_overflow"]
218+
pub fn panic_const_sub_overflow() -> ! {
219+
panic("attempt to subtract with overflow");
220+
}
221+
222+
#[track_caller]
223+
#[lang = "panic_const_mul_overflow"]
224+
pub fn panic_const_mul_overflow() -> ! {
225+
panic("attempt to multiply with overflow");
226+
}
227+
210228
/*
211229
* Code
212230
*/

0 commit comments

Comments
 (0)