Skip to content

Wrong error when derive(CoercePointee) is used with cfg_attr'ed pointee and 2+ generic argument type #20500

Description

@WaffleLapkin

rust-analyzer version: rust-analyzer 1.91.0-nightly (425a9c0 2025-08-17)

rustc version: rustc 1.91.0-nightly (425a9c0a0 2025-08-17)

editor or extension: helix

code snippet to reproduce:

#![feature(derive_coerce_pointee)]
use std::marker::CoercePointee;
use std::ptr::NonNull;

#[derive(CoercePointee)]
#[repr(transparent)]
pub struct Ptr<T, #[cfg_attr(all(), pointee)] V: ?Sized> {
    ptr: NonNull<V>,
    _ghost: PhantomData<T>,
}

r-a emits an error saying "exactly one generic type parameter must be marked as #[pointee] to derive CoercePointee", rustc compiles this code successfully.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions