rust/syn/drops.rs

Source file repositories/reference/linux-study-clean/rust/syn/drops.rs

File Facts

System
Linux kernel
Corpus path
rust/syn/drops.rs
Extension
.rs
Size
1455 bytes
Lines
61
Domain
Rust Kernel Layer
Bucket
Rust API Membrane
Inferred role
Rust Kernel Layer: implementation source
Status
source implementation candidate

Why This File Exists

Rust-side wrappers and abstractions around kernel C APIs, ownership contracts, allocation, synchronization, and module integration.

Dependency Surface

Detected Declarations

Annotated Snippet

fn test_needs_drop() {
    use std::mem::needs_drop;

    struct NeedsDrop;

    impl Drop for NeedsDrop {
        fn drop(&mut self) {}
    }

    assert!(needs_drop::<NeedsDrop>());

    // Test each of the types with a handwritten TrivialDrop impl above.
    assert!(!needs_drop::<iter::Empty<NeedsDrop>>());
    assert!(!needs_drop::<slice::Iter<NeedsDrop>>());
    assert!(!needs_drop::<slice::IterMut<NeedsDrop>>());
    assert!(!needs_drop::<option::IntoIter<&NeedsDrop>>());
    assert!(!needs_drop::<option::IntoIter<&mut NeedsDrop>>());
}

Annotation

Implementation Notes