Skip to content

Compiler allows #[repr(i/u128)] on structs #74082

Closed
@TyPR124

Description

@TyPR124

I tried this code:

#[repr(i128)]
#[repr(u128)]
struct Foo;
fn main() {
    println!("{}", std::mem::size_of::<Foo>());
}

I expected to see this happen: compilation failure

Instead, this happened: Compiles, outputs "0"

Meta

rustc --version --verbose:

rustc 1.44.0 (49cae5576 2020-06-01)
binary: rustc
commit-hash: 49cae55760da0a43428eba73abcb659bb70cf2e4
commit-date: 2020-06-01
host: x86_64-pc-windows-msvc
release: 1.44.0
LLVM version: 9.0

Also: playground

This issue has been assigned to @nbdd0121 via this comment.

Metadata

Metadata

Assignees

Labels

A-attributesArea: Attributes (`#[…]`, `#![…]`)A-layoutArea: Memory layout of typesC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions