Debian Codegraph @

debian/missing-sources/zerocopy-derive/tests/ui-nightly/absence_of_deprecated_warning.rs

raw
1 // Copyright 2024 The Fuchsia Authors
2 //
3 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
4 // <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
5 // license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
6 // This file may not be copied, modified, or distributed except according to
7 // those terms.
8
9 //! See: https://github.com/google/zerocopy/issues/553
10 //! zerocopy must still allow derives of deprecated types.
11 //! This test has a hand-written impl of a deprecated type, and should result in a compilation
12 //! error. If zerocopy does not tack an allow(deprecated) annotation onto its impls, then this
13 //! test will fail because more than one compile error will be generated.
14 #![deny(deprecated)]
15
16 extern crate zerocopy_renamed;
17
18 use zerocopy_renamed::IntoBytes;
19
20 #[deprecated = "Do not use"]
21 #[derive(IntoBytes)]
22 #[zerocopy(crate = "zerocopy_renamed")]
23 #[repr(C)]
24 struct OldHeader {
25 field_a: usize,
26 collection: [u8; 8],
27 }
28
29 trait T {}
30
31 // Intentionally trigger a deprecation error
32 impl T for OldHeader {}
33
34 fn main() {}