diff options
| author | Adam Perry <adam.n.perry@gmail.com> | 2019-10-23 19:30:21 -0700 |
|---|---|---|
| committer | Adam Perry <adam.n.perry@gmail.com> | 2019-10-27 12:50:58 -0700 |
| commit | aec97e050ea5247fa13612399a7a812dbce89ec9 (patch) | |
| tree | ad7ba453a36edd6d6c530dc1fa8eb947b99fdeca /src/librustc_mir | |
| parent | 743964ad3fe566ca2ce5c2de14f8733887d283fd (diff) | |
| download | rust-aec97e050ea5247fa13612399a7a812dbce89ec9.tar.gz rust-aec97e050ea5247fa13612399a7a812dbce89ec9.zip | |
Panicking infra uses &core::panic::Location.
This allows us to remove `static_panic_msg` from the SSA<->LLVM boundary, along with its fat pointer representation for &str. Also changes the signature of PanicInfo::internal_contructor to avoid copying. Closes #65856.
Diffstat (limited to 'src/librustc_mir')
| -rw-r--r-- | src/librustc_mir/interpret/intrinsics.rs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/librustc_mir/interpret/intrinsics.rs b/src/librustc_mir/interpret/intrinsics.rs index 5fc23b4a69e..20cb2926d66 100644 --- a/src/librustc_mir/interpret/intrinsics.rs +++ b/src/librustc_mir/interpret/intrinsics.rs @@ -301,18 +301,19 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { ) -> InterpResult<'tcx, bool> { let def_id = instance.def_id(); if Some(def_id) == self.tcx.lang_items().panic_fn() { - assert!(args.len() == 1); - // &(&'static str, &'static str, u32, u32) - let place = self.deref_operand(args[0])?; - let (msg, file, line, col) = ( - self.mplace_field(place, 0)?, - self.mplace_field(place, 1)?, - self.mplace_field(place, 2)?, - self.mplace_field(place, 3)?, - ); + // &'static str, &core::panic::Location { &'static str, u32, u32 } + assert!(args.len() == 2); - let msg_place = self.deref_operand(msg.into())?; + let msg_place = self.deref_operand(args[0])?; let msg = Symbol::intern(self.read_str(msg_place)?); + + let location = self.deref_operand(args[1])?; + let (file, line, col) = ( + self.mplace_field(location, 0)?, + self.mplace_field(location, 1)?, + self.mplace_field(location, 2)?, + ); + let file_place = self.deref_operand(file.into())?; let file = Symbol::intern(self.read_str(file_place)?); let line = self.read_scalar(line.into())?.to_u32()?; |
