Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
TyPR124 opened this issue Jul 6, 2020 · 1 comment · Fixed by #74109
Closed

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

TyPR124 opened this issue Jul 6, 2020 · 1 comment · Fixed by #74109
Assignees
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-layout Area: Memory layout of types C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@TyPR124
Copy link
Contributor

TyPR124 commented Jul 6, 2020

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.

@TyPR124 TyPR124 added the C-bug Category: This is a bug. label Jul 6, 2020
@jonas-schievink jonas-schievink added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-layout Area: Memory layout of types T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 6, 2020
@nbdd0121
Copy link
Contributor

nbdd0121 commented Jul 6, 2020

Should be a easy fix.

@rustbot claim

@rustbot rustbot self-assigned this Jul 6, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 7, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 8, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 8, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 8, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 9, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 9, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 10, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 10, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 10, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 10, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 11, 2020
Manishearth added a commit to Manishearth/rust that referenced this issue Jul 11, 2020
@bors bors closed this as completed in 8efa197 Jul 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-layout Area: Memory layout of types C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants