Skip to content

builder: allow unsigned integers in neg and exactsdiv.#562

Draft
eddyb wants to merge 2 commits intomainfrom
eddyb/unsigned-neg-exactsdiv
Draft

builder: allow unsigned integers in neg and exactsdiv.#562
eddyb wants to merge 2 commits intomainfrom
eddyb/unsigned-neg-exactsdiv

Conversation

@eddyb
Copy link
Copy Markdown
Member

@eddyb eddyb commented Apr 13, 2026

rustc_codegen_ssa relies on signed operations on unsigned integers for e.g. size_of_val.


TODO: move this from the compute shader (see diff) to a proper test:

core::mem::size_of_val(
    const {
        struct S<T: ?Sized>(T);
        &S([]) as &S<[()]>
    },
)

@Firestar99 Firestar99 force-pushed the eddyb/unsigned-neg-exactsdiv branch from 7ff8561 to af8bf6f Compare April 14, 2026 16:36
Comment on lines +1 to +23
error: unsupported unsized `[struct () { }]` constant
|
= note: used by unnamed global (%68)
= note: used by unnamed global (%69)
note: used from within `size_of_val_unsized::main`
--> <$DIR/size_of_val_unsized.rs>:5:12
|
LL | *out = core::mem::size_of_val(
| ____________^
LL | | const {
LL | | struct S<T: ?Sized>(T);
LL | | &S([]) as &S<[()]>
LL | | },
LL | | );
| |_____^
note: called by `main`
--> <$DIR/size_of_val_unsized.rs>:4:8
|
LL | pub fn main(out: &mut usize) {
| ^^^^

error: aborting due to 1 previous error

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.

I think the patch is fine, saw the todo, moved it to a compiletest and it resulted in this interesting error

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants