about summary refs log tree commit diff
path: root/library/alloc/src/lib.rs
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-02-23 02:51:43 +0100
committerGitHub <noreply@github.com>2021-02-23 02:51:43 +0100
commit72e6d51583ed5fa97ee06fe0259b82b28367874e (patch)
treebe6b57edecd15a58858b257ca6573b550936363f /library/alloc/src/lib.rs
parent1c2a949736a85810127b73dbc1006565689d6fe4 (diff)
parentfe4fe19ddc38a2da883e1e38d18c821ad1c26fc5 (diff)
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
Diffstat (limited to 'library/alloc/src/lib.rs')
-rw-r--r--library/alloc/src/lib.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs
index 99c42a4ba44..c020a969f1f 100644
--- a/library/alloc/src/lib.rs
+++ b/library/alloc/src/lib.rs
@@ -115,7 +115,6 @@
 #![feature(or_patterns)]
 #![feature(pattern)]
 #![feature(ptr_internals)]
-#![feature(range_bounds_assert_len)]
 #![feature(rustc_attrs)]
 #![feature(receiver_trait)]
 #![cfg_attr(bootstrap, feature(min_const_generics))]
@@ -123,6 +122,7 @@
 #![feature(set_ptr_value)]
 #![feature(slice_ptr_get)]
 #![feature(slice_ptr_len)]
+#![feature(slice_range)]
 #![feature(staged_api)]
 #![feature(str_internals)]
 #![feature(trusted_len)]