Skip to content

target_feature attribute should only be applied to unsafe functions #4234

@lucasly-ba

Description

@lucasly-ba

code:

#[target_feature]
fn foo_sse() {}

expected output:

error: malformed `target_feature` attribute input
 --> a.rs:2:1
  |
2 | #[target_feature]
  | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[target_feature(enable = "name")]`

error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions
 --> a.rs:2:1
  |
2 | #[target_feature]
  | ^^^^^^^^^^^^^^^^^
3 | fn foo_sse() {}
  | ------------ not an `unsafe` function
  |
  = note: see issue #69098 <https://github.com/rust-lang/rust/issues/69098> for more information

error: aborting due to 2 previous errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions