diff options
| author | Ralf Jung <post@ralfj.de> | 2020-03-09 11:16:23 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2020-03-09 11:16:23 +0100 |
| commit | 1a9fc18e830dc57731e2976edb5c5f0fabc5019c (patch) | |
| tree | d4f91a1fa34e83789172d7fbc8fc0a5bf45f47eb /src/librustc_codegen_ssa | |
| parent | 2cb0b8582ebbf9784db9cec06fff517badbf4553 (diff) | |
| download | rust-1a9fc18e830dc57731e2976edb5c5f0fabc5019c.tar.gz rust-1a9fc18e830dc57731e2976edb5c5f0fabc5019c.zip | |
panic_bounds_check: use caller_location, like PanicFnLangItem
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/mir/block.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index a1b54607b80..f22c0216a78 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -415,11 +415,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { AssertKind::BoundsCheck { ref len, ref index } => { let len = self.codegen_operand(&mut bx, len).immediate(); let index = self.codegen_operand(&mut bx, index).immediate(); - (lang_items::PanicBoundsCheckFnLangItem, vec![location, index, len]) + // It's `fn panic_bounds_check(index: usize, len: usize)`, and + // `#[track_caller]` adds an implicit third argument. + (lang_items::PanicBoundsCheckFnLangItem, vec![index, len, location]) } _ => { let msg_str = Symbol::intern(msg.description()); let msg = bx.const_str(msg_str); + // It's `pub fn panic(expr: &str)`, with the wide reference being passed + // as two arguments, and `#[track_caller]` adds an implicit third argument. (lang_items::PanicFnLangItem, vec![msg.0, msg.1, location]) } }; |
