//! This test used to ICE: #123917 //! The reason was that while the AST knows about two fields //! named `ptr`, only one exists at the layout level, so accessing //! `_extra_field` would use an oob index //@ compile-flags: -Zmir-opt-level=5 -Zpolymorphize=on struct NonNull(*mut T); struct Token { ptr: *mut T, ptr: NonNull, //~^ ERROR: `ptr` is already declared _extra_field: (), } fn tokenize(item: *mut T) -> Token { Token { ptr: NonNull(item), _extra_field: () } } fn main() {}