about summary refs log tree commit diff
path: root/library/coretests
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-09-03 23:08:06 +1000
committerGitHub <noreply@github.com>2025-09-03 23:08:06 +1000
commitf4b946a14788df30b693a28e96aa18c9bee618ad (patch)
tree01fa921df7f0c97a99915eb3fc706a60089fc5b8 /library/coretests
parent51ff895062ba60a7cba53f57af928c3fb7b0f2f4 (diff)
parent1c64d3e6d1fe6256cb11b8dd455ccad1b5f9848c (diff)
downloadrust-f4b946a14788df30b693a28e96aa18c9bee618ad.tar.gz
rust-f4b946a14788df30b693a28e96aa18c9bee618ad.zip
Rollup merge of #145279 - clarfonthey:const-convert-initial, r=tgross35
Constify conversion traits (part 1)

This is the first part of rust-lang/rust#144289 being split into smaller pieces. It adds/moves constness of several traits under the `const_convert` feature:

* `From`
* `Into`
* `TryFrom`
* `TryInto`
* `FromStr`
* `AsRef`
* `AsMut`
* `Borrow`
* `BorrowMut`
* `Deref`
* `DerefMut`

There are a few methods that are intrinsically tied to these traits which I've included in the feature. Particularly, those which are wrappers over `AsRef`:

* `ByteStr::new` (unstable under `bstr` feature)
* `OsStr::new`
* `Path::new`

Those which directly use `Into`:

* `Result::into_ok`
* `Result::into_err`

And those which use `Deref` and `DerefMut`:

* `Pin::as_ref`
* `Pin::as_mut`
* `Pin::as_deref_mut`
* `Option::as_deref`
* `Option::as_deref_mut`
* `Result::as_deref`
* `Result::as_deref_mut`

(note: the `Option` and `Result` methods were suggested by ``@npmccallum`` initially as rust-lang/rust#146101)

The parts which are missing from this PR are:

* Anything that involves heap-allocated types
* Making any method const than the ones listed above
* Anything that could rely on the above, *or* could rely on system-specific code for `OsStr` or `Path` (note: this mostly makes these methods useless since `str` doesn't implement `AsRef<OsStr>` yet, but it's better to track the method for now and add impls later, IMHO)

r? ``@tgross35`` (who mostly already reviewed this)
Diffstat (limited to 'library/coretests')
-rw-r--r--library/coretests/tests/lib.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/library/coretests/tests/lib.rs b/library/coretests/tests/lib.rs
index bf0a3ae7870..ffb96b5a7cf 100644
--- a/library/coretests/tests/lib.rs
+++ b/library/coretests/tests/lib.rs
@@ -15,10 +15,9 @@
 #![feature(cfg_target_has_reliable_f16_f128)]
 #![feature(char_max_len)]
 #![feature(clone_to_uninit)]
-#![feature(const_deref)]
+#![feature(const_convert)]
 #![feature(const_destruct)]
 #![feature(const_eval_select)]
-#![feature(const_from)]
 #![feature(const_ops)]
 #![feature(const_option_ops)]
 #![feature(const_ref_cell)]