Skip to content

Unions are not PointerLike - #119708

Merged
bors merged 1 commit into
rust-lang:masterfrom
compiler-errors:pointer-like
Jan 8, 2024
Merged

Unions are not PointerLike#119708
bors merged 1 commit into
rust-lang:masterfrom
compiler-errors:pointer-like

Conversation

@compiler-errors

@compiler-errorscompiler-errors commented Jan 7, 2024

Copy link
Copy Markdown
Contributor

I introduced the PointerLike trait to enforce dyn* coercions only from types that share the same ABI as a pointer. On top of needing to be scalar, they also should not be unions, since CTFE chokes on scalar reads for union types.

Fixes#119695

@rustbot

Copy link
Copy Markdown
Collaborator

r? @wesleywiser

(rustbot has picked a reviewer for you, use r? to override)

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 7, 2024

@NoratriebNoratrieb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me with or without the comment change

Comment threadcompiler/rustc_target/src/abi/mod.rs Outdated
Comment threadcompiler/rustc_abi/src/layout.rs Outdated
@compiler-errors

Copy link
Copy Markdown
ContributorAuthor

@bors r=Nilstrieb rollup

@bors

bors commented Jan 7, 2024

Copy link
Copy Markdown
Collaborator

📌 Commit 68bb766 has been approved by Nilstrieb

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 7, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 8, 2024
…iaskrgr
Rollup of 5 pull requests
Successful merges:
- rust-lang#116129 (Rewrite `pin` module documentation to clarify usage and invariants)
- rust-lang#119703 (Impl trait diagnostic tweaks)
- rust-lang#119705 (Support `~const` in associated functions in trait impls)
- rust-lang#119708 (Unions are not `PointerLike`)
- rust-lang#119711 (Delete unused makefile in tests/ui)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 2676860 into rust-lang:masterJan 8, 2024
@rustbotrustbot added this to the 1.77.0 milestone Jan 8, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 8, 2024
Rollup merge of rust-lang#119708 - compiler-errors:pointer-like, r=Nilstrieb
Unions are not `PointerLike`
I introduced the `PointerLike` trait to enforce `dyn*` coercions only from types that share the same ABI as a pointer. On top of needing to be scalar, they also should not be unions, since CTFE chokes on scalar reads for union types.
Fixesrust-lang#119695
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE with dyn* when trait is implemented for union

5 participants

@compiler-errors@rustbot@bors@Noratrieb@wesleywiser