-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
When split_at_mut
is called with mid > len
, an internal assertion fails. However, it doesn't track its caller, so RUST_BACKTRACE=1
is required to determine the call site.
I tried this code:
fn main() {
let mut x = [1];
x.split_at_mut(2);
}
I expected to see this happen:
An error of the form thread 'main' panicked at 'split index (is 2) should be <= len (is 1)'
.
Instead, this happened:
thread 'main' panicked at 'assertion failed: mid <= self.len()', /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/slice/mod.rs:1279:9
Meta
This occurs on stable (1.50.0), beta (1.51.0-beta.8) and nightly (1.53.0-nightly 2021-03-21).
Tested on playground.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.