| Age | Commit message (Collapse) | Author | Lines |
|
|
|
functions with a `const` modifier
|
|
Fixed the documentation for any as is a trait rather than a type.
|
|
add fn type_name_of_val
This function is often useful during testing and mirrors `align_of_val` and `size_of_val`.
# Example
Showing the default type of integers.
```rust
let x = 7;
println!("per default, integers have the type: {}", std::any::type_name_of_val(&x));
```
To my knowledge this can currently not be done without defining a function similar to `type_name_of_val`.
|
|
|
|
|
|
|
|
|
|
Co-Authored-By: Jonas Schievink <jonasschievink@gmail.com>
|
|
I noticed that in documentation to `Any` trait the old trait object syntax is used, which could be confusing for newcomers, since we generally recommend using `dyn Trait` instead of just `Trait`. This PR changes the documentation comment, so that it uses `&dyn Any`, `&mut dyn Any` and `Box<dyn Any>`, correspondingly.
|
|
|
|
|
|
|
|
Specifically the `#[rustc_const_unstable(feature = "const_type_name")]` attribute, as well as marking the actual function as `const`.
|
|
Closes rust-lang/rfcs#1428
|
|
|
|
|
|
|
|
FCP: https://github.com/rust-lang/rust/issues/27745#issuecomment-373906749
|
|
|
|
|
|
|
|
|
|
This changes the docs referring to where a user should be wary of depending on "Any" trait impls from warning about relying on them "outside" of their code to warning about relying on them "inside" of their code.
|
|
Make the Any+Send+Sync examples use the right trait bounds, and fix a small whitespace issue.
|
|
Implement `is`, `downcast_ref`, `downcast_mut` and `Debug` for
`Any + Send + Sync`.
|
|
|
|
Add rustc_const_unstable attribute for `any::TypeId::of`
Add test for `const fn TypeId::of`
|
|
|
|
Add PartialOrd, Ord derivations to TypeId
I want to be able to sort a `Vec` of types which contain `TypeId`s, so an `Ord` derivation would be very useful to me. `Hash` and `PartialEq`/`Eq` already exist, so the missing `PartialOrd` and `Ord` derivations feel like an oversight to me.
|
|
|
|
We should teach conversion from `str` to `String` using `to_string`
rather than the legacy `to_owned`.
|
|
I want to be able to sort a `Vec` of types which contain `TypeId`s, so an `Ord` derivation would be very useful to me. `Hash` already exists, so the missing `PartialOrd` and `Ord` derivations feel like an oversight to me.
|
|
|
|
[tracking issue](https://github.com/rust-lang/rust/issues/27749)
|
|
|
|
|
|
|
|
|
|
A few categories:
* Links into compiler docs were just all removed as we're not generating
compiler docs.
* Move up one more level to forcibly go to std docs to fix inlined documentation
across the facade crates.
|
|
This is a bit weird since unsized types can't be used in trait objects,
but Any is *also* used as pure marker trait since Reflect isn't stable.
There are many cases (e.g. TypeMap) where all you need is a TypeId.
|
|
|
|
|
|
Fixes #27958
|
|
|
|
The replacements are functions that usually use a single `mem::transmute` in
their body and restrict input and output via more concrete types than `T` and
`U`. Worth noting are the `transmute` functions for slices and the `from_utf8*`
family for mutable slices. Additionally, `mem::transmute` was often used for
casting raw pointers, when you can already cast raw pointers just fine with
`as`.
|
|
|
|
|
|
Also, the info is repeated in the following paragraph
|
|
This commit shards the broad `core` feature of the libcore library into finer
grained features. This split groups together similar APIs and enables tracking
each API separately, giving a better sense of where each feature is within the
stabilization process.
A few minor APIs were deprecated along the way:
* Iterator::reverse_in_place
* marker::NoCopy
|