Skip to content

generic_const_exprs suggestion to add bound interacts poorly with legacy const generics #108382

Description

@asquared31415

Code

#![allow(incomplete_features)]
#![feature(generic_const_exprs)]

use std::arch::x86_64::*;
fn uwu<const N: i32>() {
    unsafe {
        let a = _mm_setzero_ps();
        let b = _mm_setzero_ps();
        _mm_shuffle_ps(a, b, N + 1);
    }
}

Current output

error: unconstrained generic constant
 --> src/lib.rs:9:30
  |
9 |         _mm_shuffle_ps(a, b, N + 1);
  |                              ^^^^^
  |
  = help: try adding a `where` bound using this expression: `where [(); _mm_shuffle_ps]:`

Desired output

error: unconstrained generic constant
 --> src/lib.rs:9:30
  |
9 |         _mm_shuffle_ps(a, b, N + 1);
  |                              ^^^^^
  |
  = help: try adding a `where` bound using this expression: `where [(); N + 1]:`

Rationale and extra context

No response

Other cases

No response

Anything else?

No response

Activity

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

Metadata

Metadata

Assignees

Labels

A-const-genericsArea: const generics (parameters and arguments)A-diagnosticsArea: Messages for errors, warnings, and lintsF-generic_const_exprs`#![feature(generic_const_exprs)]`P-lowLow priorityT-compilerRelevant to the compiler 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