| 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; |
| 17 |
|
| 18 |
use zerocopy::IntoBytes; |
| 19 |
|
| 20 |
#[deprecated = "Do not use"] |
| 21 |
#[derive(IntoBytes)] |
| 22 |
#[repr(C)] |
| 23 |
struct OldHeader { |
| 24 |
field_a: usize, |
| 25 |
collection: [u8; 8], |
| 26 |
} |
| 27 |
|
| 28 |
trait T {} |
| 29 |
|
| 30 |
// Intentionally trigger a deprecation error |
| 31 |
impl T for OldHeader {} |
| 32 |
|
| 33 |
fn main() {} |