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

Compilation error in the vulkano crate on nightly expected isize, found i32 #137662

Closed
ogoffart opened this issue Feb 26, 2025 · 10 comments · Fixed by #137758
Closed

Compilation error in the vulkano crate on nightly expected isize, found i32 #137662

ogoffart opened this issue Feb 26, 2025 · 10 comments · Fixed by #137758
Assignees
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-repr Area: the `#[repr(stuff)]` attribute C-bug Category: This is a bug. P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. S-has-bisection Status: a bisection has been found for this issue S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue

Comments

@ogoffart
Copy link
Contributor

ogoffart commented Feb 26, 2025

Compiling the vulkano crate fails with the latest nightly.

Error:

error[E0308]: mismatched types
   --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/vulkano-0.34.1/src/macros.rs:658:48
    |
658 |                   $flag_name = ash::vk::$ty_ffi::$flag_name_ffi.as_raw(),
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `i32`
    |
   ::: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/vulkano-0.34.1/src/acceleration_structure.rs:315:1
    |
315 | / vulkan_enum! {
316 | |     #[non_exhaustive]
317 | |
318 | |     /// The type of an acceleration structure.
...   |
330 | |     Generic = GENERIC,
331 | | }
    | |_- in this macro invocation
    |
    = note: this error originates in the macro `vulkan_enum` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
    --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/vulkano-0.34.1/src/macros.rs:658:48
     |
658  |                   $flag_name = ash::vk::$ty_ffi::$flag_name_ffi.as_raw(),
     |                                                  ^^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `i32`
     |
    ::: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/vulkano-0.34.1/src/acceleration_structure.rs:1591:1
     |
1591 | / vulkan_enum! {
1592 | |     #[non_exhaustive]
1593 | |
1594 | |     /// What mode an acceleration structure copy command should operate in.
...    |
1618 | |     Deserialize = DESERIALIZE,
1619 | | }
     | |_- in this macro invocation
     |
     = note: this error originates in the macro `vulkan_enum` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
    --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/vulkano-0.34.1/src/macros.rs:658:48
     |
658  |                   $flag_name = ash::vk::$ty_ffi::$flag_name_ffi.as_raw(),
     |                                                  ^^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `i32`
     |
    ::: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/vulkano-0.34.1/src/acceleration_structure.rs:1621:1
     |
1621 | / vulkan_enum! {
1622 | |     #[non_exhaustive]
1623 | |
1624 | |     /// Where the building of an acceleration structure will take place.
...    |
1634 | |     HostOrDevice = HOST_OR_DEVICE,
1635 | | }
     | |_- in this macro invocation
     |
     = note: this error originates in the macro `vulkan_enum` (in Nightly builds, run with -Z macro-backtrace for more info)

(... skipped more of the same ...)

This is using the version 0.34.1 of vulkano but I have verified this also fails in the master branch of https://github.com/vulkano-rs/vulkano/

The error was noticed because we build with nightly on our CI, and we depends on that crate

Version it worked on

Works on nightly-2025-02-24

rustc 1.87.0-nightly (f8a913b 2025-02-23)

Version with regression

Current nightly

rustc 1.87.0-nightly (85abb27 2025-02-25)

@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged

@ogoffart ogoffart added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Feb 26, 2025
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. and removed regression-untriaged Untriaged performance or correctness regression. labels Feb 26, 2025
ogoffart added a commit to slint-ui/slint that referenced this issue Feb 26, 2025
@Noratrieb Noratrieb added E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 26, 2025
@Noratrieb
Copy link
Member

Thank you for the report! It would be useful to bisect the regression using cargo-bisect-rustc to make it easier to figure out what happened and ping the relevant people.
@rustbot label E-needs-bisection

@cyrgani
Copy link
Contributor

cyrgani commented Feb 26, 2025

working on reducing this

@cyrgani
Copy link
Contributor

cyrgani commented Feb 26, 2025

reduction:

macro_rules! vulkan_enum {
    {
        $repr:ty
    } => {
        #[repr($repr)]
        pub enum Foo {
            Bar = 0i32,
        }
    }
}

vulkan_enum! {
    i32
}

bisection:

searched nightlies: from nightly-2025-02-24 to nightly-2025-02-26
regressed nightly: nightly-2025-02-26
searched commit range: 617aad8...85abb27
regressed commit: 7d8c6e7

bisected with cargo-bisect-rustc v0.6.9

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start=2025-02-24 
cc @jdonszelmann

@rustbot label:S-has-mcve -E-needs-mcve S-has-bisection -E-needs-bisection

@rustbot rustbot added S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue S-has-bisection Status: a bisection has been found for this issue and removed E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc labels Feb 26, 2025
@jdonszelmann
Copy link
Contributor

@rustbot claim

Oops, I'll fix this

@jieyouxu jieyouxu added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-repr Area: the `#[repr(stuff)]` attribute labels Feb 26, 2025
@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

(just signaling that this should not getting into the next stable, but given that this is a very recent regression, I think that's no problem)

@rustbot label -I-prioritize +P-critical

@rustbot rustbot added P-critical Critical priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Feb 26, 2025
@Oughie
Copy link

Oughie commented Feb 26, 2025

Same issue here.

@jdonszelmann
Copy link
Contributor

The simple fix is to make it a tt instead of a ty btw. I've fixed this locally but might not have time to make the pr tonight.

@Noratrieb
Copy link
Member

Given that this is in a crate, that's not that easily applicable 😄. But it's fine if you take another day, people can just wait a bit with their nightly upgrades, or install an older nightly in the meantime.

@jdonszelmann
Copy link
Contributor

#137517 this pr will also fix the bug by reworking how interpolated tokens work. I was just reviewing it and it removes exactly the code I was modifying to fix it. We could wait for that too but that could be too slow

@Noratrieb
Copy link
Member

pushing your fix first is probably reasonable

jdonszelmann added a commit to jdonszelmann/rust that referenced this issue Feb 27, 2025
jdonszelmann added a commit to jdonszelmann/rust that referenced this issue Feb 28, 2025
tgross35 added a commit to tgross35/rust that referenced this issue Mar 3, 2025
…cote

fix usage of ty decl macro fragments in attributes

See the test case. Due to one missing code path (and also the changes in rust-lang#137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way.

Closes rust-lang#137662
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 4, 2025
…cote

fix usage of ty decl macro fragments in attributes

See the test case. Due to one missing code path (and also the changes in rust-lang#137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way.

Closes rust-lang#137662
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 4, 2025
…cote

fix usage of ty decl macro fragments in attributes

See the test case. Due to one missing code path (and also the changes in rust-lang#137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way.

Closes rust-lang#137662
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Mar 4, 2025
…cote

fix usage of ty decl macro fragments in attributes

See the test case. Due to one missing code path (and also the changes in rust-lang#137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way.

Closes rust-lang#137662
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Mar 5, 2025
…cote

fix usage of ty decl macro fragments in attributes

See the test case. Due to one missing code path (and also the changes in rust-lang#137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way.

Closes rust-lang#137662
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Mar 5, 2025
…cote

fix usage of ty decl macro fragments in attributes

See the test case. Due to one missing code path (and also the changes in rust-lang#137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way.

Closes rust-lang#137662
jieyouxu added a commit to jieyouxu/rust that referenced this issue Mar 5, 2025
…cote

fix usage of ty decl macro fragments in attributes

See the test case. Due to one missing code path (and also the changes in rust-lang#137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way.

Closes rust-lang#137662
jieyouxu added a commit to jieyouxu/rust that referenced this issue Mar 5, 2025
…cote

fix usage of ty decl macro fragments in attributes

See the test case. Due to one missing code path (and also the changes in rust-lang#137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way.

Closes rust-lang#137662
jieyouxu added a commit to jieyouxu/rust that referenced this issue Mar 5, 2025
…cote

fix usage of ty decl macro fragments in attributes

See the test case. Due to one missing code path (and also the changes in rust-lang#137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way.

Closes rust-lang#137662
compiler-errors added a commit to compiler-errors/rust that referenced this issue Mar 6, 2025
…cote

fix usage of ty decl macro fragments in attributes

See the test case. Due to one missing code path (and also the changes in rust-lang#137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way.

Closes rust-lang#137662
Noratrieb added a commit to Noratrieb/rust that referenced this issue Mar 6, 2025
…cote

fix usage of ty decl macro fragments in attributes

See the test case. Due to one missing code path (and also the changes in rust-lang#137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way.

Closes rust-lang#137662
@bors bors closed this as completed in 34d273b Mar 7, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 7, 2025
Rollup merge of rust-lang#137758 - jdonszelmann:fix-137662, r=nnethercote

fix usage of ty decl macro fragments in attributes

See the test case. Due to one missing code path (and also the changes in rust-lang#137517), using $ty or other specific fragments as part of an attr wouldn't work. $tt used to work since it wouldn't be parsed anywhere along the way.

Closes rust-lang#137662
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-repr Area: the `#[repr(stuff)]` attribute C-bug Category: This is a bug. P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. S-has-bisection Status: a bisection has been found for this issue S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants