• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

facet-rs / facet / 15085905564

17 May 2025 02:00PM UTC coverage: 56.937% (+0.2%) from 56.732%
15085905564

push

github

fasterthanlime
Introduce `'shape` lifetime, allowing non-'static shapes.

Closes #455.

402 of 615 new or added lines in 70 files covered. (65.37%)

31 existing lines in 3 files now uncovered.

9176 of 16116 relevant lines covered (56.94%)

126.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/facet-core/src/types/ty/pointer.rs
1
use crate::FunctionPointerDef;
2

3
use super::Shape;
4

5
/// Describes all pointer types
6
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
7
#[repr(C)]
8
pub enum PointerType<'shape> {
9
    /// Describees bound const and mut references (`&`/`&mut`)
10
    Reference(ValuePointerType<'shape>),
11
    /// Describes raw pointers
12
    ///
13
    /// Dereferencing invalid raw pointers may lead to undefined behavior
14
    Raw(ValuePointerType<'shape>),
15
    /// Describes function pointers
16
    Function(FunctionPointerDef),
17
}
18

19
/// Describes the raw/reference pointer
20
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
21
#[repr(C)]
22
#[non_exhaustive]
23
pub struct ValuePointerType<'shape> {
24
    /// Is the pointer mutable or not.
25
    pub mutable: bool,
26

27
    /// Describes whether the pointer is wider or not
28
    ///
29
    /// Note: if the pointer is wide, then the `target` shape will have `ShapeLayout::Unsized`, and
30
    /// the vtables of the target shape will expect the pointer to _this_ pointer, rather than the
31
    /// resulting address of unsized data. This is because wide pointer's metadata information is
32
    /// an undefined implementation detail, at this current moment.
33
    ///
34
    /// See: <https://github.com/rust-lang/rust/issues/81513>
35
    pub wide: bool,
36

37
    /// Shape of the pointer's pointee
38
    ///
39
    /// This needs to be indirect (behind a function), in order to allow recursive types without
40
    /// overflowing the const-eval system.
41
    pub target: fn() -> &'shape Shape<'shape>,
42
}
43

44
impl<'shape> ValuePointerType<'shape> {
45
    /// Returns the shape of the pointer's pointee.
NEW
46
    pub fn target(&self) -> &'shape Shape<'shape> {
×
47
        (self.target)()
×
48
    }
×
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc