Files
rust/library
Jonathan Brouwer 25e6f5cda7 Rollup merge of #151119 - reflect-pointers, r=oli-obk
Support pointers in type reflection

Tracking issue: rust-lang/rust#146922

This PR adds support for inspecting pointers `*const T` and `*mut T` through type reflection. It does so by adding the new `Pointer` struct + variant:

```rust
pub struct Pointer {
    /// The type of the value being pointed to.
    pub ty: TypeId,
    /// Whether this pointer is mutable or not.
    pub mutable: bool,
}
```

This can be gathered using `Type::of`, for example:

```rust
match const { Type::of::<*const u8>() }.kind {
    TypeKind::Pointer(pointer) => {
        assert_eq!(pointer.ty, TypeId::of::<u8>());
        assert!(!pointer.mutable);
    }
    _ => unreachable!(),
}
```
2026-01-19 20:53:22 +01:00
..
2025-06-16 07:00:13 +00:00
2026-01-19 09:42:55 -06:00
2025-07-01 10:55:49 -07:00
2026-01-08 15:02:42 +00:00
2025-12-13 16:31:09 +09:00