Debian Codegraph @

debian/missing-sources/zerocopy/tests/ui-stable/ptr-is-invariant-over-v.rs

raw
1 // Copyright 2025 The Fuchsia Authors
2 //
3 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
4 // https://opensource.org/license/bsd-2-clause>, Apache License, Version 2.0
5 // <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
6 // license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
7 // This file may not be copied, modified, or distributed except according to
8 // those terms.
9
10 use zerocopy::pointer::{
11 invariant::{Aligned, Exclusive, Shared, Valid},
12 Ptr,
13 };
14
15 fn _when_exclusive<'big: 'small, 'small>(
16 big: Ptr<'small, &'big u32, (Exclusive, Aligned, Valid)>,
17 mut _small: Ptr<'small, &'small u32, (Exclusive, Aligned, Valid)>,
18 ) {
19 _small = big;
20 }
21
22 fn _when_shared<'big: 'small, 'small>(
23 big: Ptr<'small, &'big u32, (Shared, Aligned, Valid)>,
24 mut _small: Ptr<'small, &'small u32, (Shared, Aligned, Valid)>,
25 ) {
26 _small = big;
27 }
28
29 fn main() {}