rust/tests
Matthias Krüger ea6daca3cb
Rollup merge of #118234 - tgross35:type_name_of_value, r=dtolnay
Stabilize `type_name_of_val`

Make the following API stable:

```rust
// in core::any
pub fn type_name_of_val<T: ?Sized>(_val: &T) -> &'static str
```

This is a convenience method to get the type name of a value, as opposed to `type_name` that takes a type as a generic.

Const stability is not added because this relies on `type_name` which is also not const. That has a blocking issue https://github.com/rust-lang/rust/issues/97156.

Wording was also changed to direct most of the details to `type_name` so we don't have as much duplicated documentation.

Fixes tracking issue #66359.

There were two main concerns in the tracking issue:

1. Naming: `type_name_of` and `type_name_of_val` seem like the only mentioned options. Differences in opinion here come from `std::mem::{size_of, align_of, size_of_val, align_of_val}`. This PR leaves the name as `type_name_of_val`, but I can change if desired since it is pretty verbose.
2. What this displays for `&dyn`: I don't think that having `type_name_of_val` function resolve those is worth the headache it would be, see https://github.com/rust-lang/rust/issues/66359#issuecomment-1718480774 for some workarounds. I also amended the docs wording to leave it open-ended, in case we have means to change that behavior in the future.

``@rustbot`` label -T-libs +T-libs-api +needs-fcp
r? libs-api
2023-12-15 20:19:53 +01:00
..
assembly Auto merge of #118491 - cuviper:aarch64-stack-probes, r=wesleywiser 2023-12-14 02:01:13 +00:00
auxiliary
codegen Auto merge of #118417 - anforowicz:default-hidden-visibility, r=TaKO8Ki 2023-12-14 09:16:15 +00:00
codegen-units Automatically enable cross-crate inlining for small functions 2023-10-17 19:53:51 -04:00
coverage coverage: Use Waker::noop in async tests 2023-12-15 17:17:20 +11:00
coverage-run-rustdoc coverage: Rename the run-coverage test mode to coverage-run 2023-11-08 16:41:24 +11:00
debuginfo Check alignment of pointers only when read/written through 2023-11-04 13:01:32 -04:00
incremental tests: CGU tests require build-pass, not check-pass (remove FIXME) 2023-12-12 15:48:48 +01:00
mir-opt End locals' live range before suspending coroutine 2023-12-11 23:11:20 +01:00
pretty Improve print_tts by changing tokenstream::Spacing. 2023-12-11 09:19:09 +11:00
run-make Improve print_tts by changing tokenstream::Spacing. 2023-12-11 09:19:09 +11:00
run-make-fulldeps Merge Queries::{ongoing_codegen,linker}. 2023-11-22 13:22:49 +11:00
run-pass-valgrind
rustdoc Rollup merge of #113091 - GuillaumeGomez:prevent-cfg-merge-reexport, r=rustdoc 2023-12-15 11:51:23 +01:00
rustdoc-gui Rollup merge of #115660 - notriddle:notriddle/sidebar-resize, r=GuillaumeGomez 2023-12-15 11:51:23 +01:00
rustdoc-js rustdoc-search: use set ops for ranking and filtering 2023-12-13 10:37:15 -07:00
rustdoc-js-std Auto merge of #118077 - calebzulawski:sync-portable-simd-2023-11-19, r=workingjubilee 2023-12-02 18:04:01 +00:00
rustdoc-json rustdoc-json: Fix test so it actuall checks things 2023-11-09 12:13:16 +00:00
rustdoc-ui Auto merge of #118213 - Urgau:check-cfg-diagnostics-rustc-cargo, r=petrochenkov 2023-12-13 19:45:57 +00:00
ui Rollup merge of #118234 - tgross35:type_name_of_value, r=dtolnay 2023-12-15 20:19:53 +01:00
ui-fulldeps Address PR comments 2023-12-14 17:56:33 -08:00
COMPILER_TESTS.md