Skip to content

#[target_feature(enable = "simd128")] does not work properly on 1.73, but work fine on 1.72.1 #116516

Description

@mrDIMAS

Code

I tried this code on 1.73:

use std::arch::wasm32::*;

#[target_feature(enable = "simd128")]
fn foo() {
	const FOO: v128 = i8x16(0, 1, -1, -1, -1, -1, -1, -1, 2, 3, -1, -1, -1, -1, -1, -1);
	println!("{:?}", FOO);
}

fn main() {
    foo();
}

Compiled it with cargo build --target=wasm32-unknown-unknown, I expected it to compile fine as on previous 1.72.1, but it gave me these errors:

$ cargo build --target=wasm32-unknown-unknown
   Compiling regression_test v0.1.0 (C:\Users\123\Desktop\regression_test)
error[E0080]: evaluation of constant value failed
 --> src\main.rs:5:20
  |
5 |     const FOO: v128 = i8x16(0, 1, -1, -1, -1, -1, -1, -1, 2, 3, -1, -1, -1, -1, -1, -1);
  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a function that requires unavailable target features: simd128

note: erroneous constant used
 --> src\main.rs:6:19
  |
6 |     println!("{:?}", FOO);
  |                      ^^^

note: erroneous constant used
 --> src\main.rs:6:19
  |
6 |     println!("{:?}", FOO);
  |                      ^^^
  |
  = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0080`.
error: could not compile `regression_test` (bin "regression_test") due to previous error

Version it worked on

It most recently worked on: 1.72.1

Output:

$ cargo build --target=wasm32-unknown-unknown
Compiling regression_test v0.1.0 (C:\Users\123\Desktop\regression_test)
    Finished dev [unoptimized + debuginfo] target(s) in 0.13s

Version with regression

rustc --version --verbose:

$ rustc --version --verbose
rustc 1.73.0 (cc66ad468 2023-10-03)
binary: rustc
commit-hash: cc66ad468955717ab92600c770da8c1601a4ff33
commit-date: 2023-10-03
host: x86_64-pc-windows-msvc
release: 1.73.0
LLVM version: 17.0.2

Other

I read release notes for 1.73 and couldn't find anything that could be related to this, also tried to search for an existing issue about this - no luck. This issue also broke compilation of fast_image_resize crate and transitively, Fyrox game engine.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.P-mediumMedium priorityregression-untriagedUntriaged performance or correctness regression.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions