rust/library/alloc
Dylan DPC 72e6d51583
Rollup merge of #81154 - dylni:improve-design-of-assert-len, r=KodrAus
Improve design of `assert_len`

It was discussed in the [tracking issue](https://github.com/rust-lang/rust/issues/76393#issuecomment-761765448) that `assert_len`'s name and usage are confusing. This PR improves them based on a suggestion by ``@scottmcm`` in that issue.

I also improved the documentation to make it clearer when you might want to use this method.

Old example:

```rust
let range = range.assert_len(slice.len());
```

New example:

```rust
let range = range.ensure_subset_of(..slice.len());
```

Fixes #81157
2021-02-23 02:51:43 +01:00
..
benches
src Rollup merge of #81154 - dylni:improve-design-of-assert-len, r=KodrAus 2021-02-23 02:51:43 +01:00
tests Added tests to drain an empty vec 2021-02-13 11:18:36 +08:00
Cargo.toml Update compiler_builtins to 0.1.39 2021-01-07 16:16:36 +09:00