This repository has been archived on 2026-08-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
donglora/vendor/zerocopy-derive/tests/issue_2915.rs
T
swaitsandClaude Opus 4.6 3102fc747a feat: add display UI with splash screen, dashboard, and RSSI sparkline
Implement full SSD1306 OLED display support:
- Splash screen on boot (1.5s) with project name, version, board
- Dashboard showing radio state, config, counters, RSSI/SNR
- RSSI history sparkline (64-sample ring buffer, 2px-wide bars)
- DisplayOn/DisplayOff host commands routed via dedicated channel
- Pure render functions against generic DrawTarget (no hardware coupling)
- Display on/off control bypasses radio task entirely

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 20:42:54 -06:00

79 lines
2.1 KiB
Rust

// Copyright 2026 The Fuchsia Authors
//
// Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
// <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
// This file may not be copied, modified, or distributed except according to
// those terms.
#![no_implicit_prelude]
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]
include!("include.rs");
// Original reproducer from #2915
#[derive(imp::TryFromBytes)]
#[zerocopy(crate = "zerocopy_renamed")]
#[repr(u8)]
enum MyEnum {
Type,
OtherWithData(u8),
}
// Tests for all other associated types which may be problematic in our codebase
// as of this commit.
#[derive(imp::FromBytes, imp::IntoBytes, imp::Unaligned, imp::Immutable, imp::KnownLayout)]
#[zerocopy(crate = "zerocopy_renamed")]
#[repr(C)]
pub struct StructCollision {
pub Type: u8,
pub LAYOUT: u8,
pub PointerMetadata: u8,
pub Tag: u8,
pub tag: u8,
pub variants: u8,
}
impl StructCollision {
pub const Type: () = ();
pub const LAYOUT: () = ();
pub const PointerMetadata: () = ();
}
#[derive(imp::FromZeros, imp::Immutable, imp::KnownLayout)]
#[zerocopy(crate = "zerocopy_renamed")]
#[repr(C)]
pub enum EnumCollision {
Type { x: u8 },
LAYOUT { x: u8 },
PointerMetadata { x: u8 },
Tag { x: u8 },
tag { x: u8 },
variants { x: u8 },
}
// Case where generic parameter has associated type colliding with internal usage
pub trait AmbiguousTrait {
type Type;
const LAYOUT: usize;
type PointerMetadata;
}
#[derive(imp::FromBytes, imp::IntoBytes, imp::Unaligned, imp::Immutable, imp::KnownLayout)]
#[zerocopy(crate = "zerocopy_renamed")]
#[repr(C)]
pub struct GenericCollision<T: AmbiguousTrait> {
pub field: u8,
pub typ: T::Type,
pub pointer_metadata: T::PointerMetadata,
pub _marker: imp::PhantomData<T>,
}
#[test]
fn test_compilation() {
// If the derives compile, we are good.
let _ = StructCollision { Type: 0, LAYOUT: 0, PointerMetadata: 0, Tag: 0, tag: 0, variants: 0 };
let _ = EnumCollision::Type { x: 0 };
}