Skip to content

std::thread::Thread grew from one to two pointer sizesΒ #132619

@ginnyTheCat

Description

Caused by the changes in #123550 the size of std::thread::Thread grew from one to two pointer sizes.

The docs don't promise Thread to have a certain size so I'm not quite sure whether this would be considered a breaking change. It doesn't seem however like this was noticed/acknowledged in the PR, as having a larger thread handle might negate the benefits that PR brought with it.

Code

I tried this code:

let pointer_size = size_of::<*const ()>();
let thread_size = size_of::<std::thread::Thread>();
assert_eq!(pointer_size, thread_size);

I expected to see this happen: it to run successfully

Instead, this happened: the assert is unfulfilled and it panics

Version it worked on

It most recently worked on: Rust 1.82

Version with regression

rustc --version --verbose:

rustc 1.84.0-nightly (b8c8287a2 2024-11-03)
binary: rustc
commit-hash: b8c8287a229cd79604aa84c25e1235fc78cd5f2e
commit-date: 2024-11-03
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3

Activity

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

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.T-libsRelevant to the library 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