Skip to content

Wrong error message for using the wrong macro "style" for the autodiff macro #185

@sYgbpNA5UEVufjsHNwF3Xvf9ANZi5bNs

Description

rustc +enzyme -vV output:

rustc 1.84.0-nightly (1203575 2024-10-30)
binary: rustc
commit-hash: 1203575
commit-date: 2024-10-30
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.1

example:

#![feature(autodiff)]
use std::autodiff::autodiff;

#[autodiff = "Forward"]
fn f(x: f32) -> f32 {
    x * x
}
#[autodiff]
fn g(x: f32) -> f32 {
    x * x
}

fn main() {}

complilation error:

error: autodiff must be applied to function
 --> src/main.rs:5:1
  |
5 | / fn f(x: f32) -> f32 {
6 | |     x * x
7 | | }
  | |_^

error: autodiff must be applied to function
  --> src/main.rs:9:1
   |
9  | / fn g(x: f32) -> f32 {
10 | |     x * x
11 | | }
   | |_^

error: could not compile `enzyme-test` (bin "enzyme-test") due to 2 previous errors

while both are wrong the error message stating the macro must be applied to functions only doesn't make sense here.

I don't know how the macro styles like #[foo] as opposed to #[foo(Bar)] are referred to hence the "style" in the title

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions