about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-03-22 15:21:24 +0100
committerGitHub <noreply@github.com>2021-03-22 15:21:24 +0100
commit83faac9da458d8f451611b4587e0c807d1db4af5 (patch)
treee7cc15d9c3dd824df5c18da9ed8eb3edeebe94c3 /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
parent7bf8f82f72599528c82ad4c29dd9408645725f6a (diff)
parentb45855032b3aad0ea0a48894f56cb9bb8fa361f2 (diff)
downloadrust-83faac9da458d8f451611b4587e0c807d1db4af5.tar.gz
rust-83faac9da458d8f451611b4587e0c807d1db4af5.zip
Rollup merge of #82683 - jturner314:int-div-rem-doc-panic, r=nikomatsakis
Document panicking cases for integer division and remainder

This PR documents the cases when integer division and remainder operations panic. These operations panic in two cases: division by zero and overflow.

It's surprising that these operations always panic on overflow, unlike most other arithmetic operations, which panic on overflow only when `debug_assertions` is enabled. The panic on overflow for the remainder is also surprising because a return value of `0` would be reasonable in this case. ("Overflow" occurs only for `MIN % -1`.) Since the panics on overflow are somewhat surprising, they should be documented.

I guess it's worth asking: is panic on overflow (even when `debug_assertions` is disabled) the intended behavior? If not, what's the best way forward?
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions