Skip to content

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

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

Closed
sYgbpNA5UEVufjsHNwF3Xvf9ANZi5bNs opened this issue Nov 5, 2024 · 1 comment

Comments

@sYgbpNA5UEVufjsHNwF3Xvf9ANZi5bNs

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

@sYgbpNA5UEVufjsHNwF3Xvf9ANZi5bNs sYgbpNA5UEVufjsHNwF3Xvf9ANZi5bNs changed the title Wrong error message for using the wrong macro "style" Wrong error message for using the wrong macro "style" for the autodiff macro Nov 5, 2024
Zalathar added a commit to Zalathar/rust that referenced this issue Apr 10, 2025
…eyouxu

emit a better error message for using the macro incorrectly

fixing: EnzymeAD#185
I feel like it's not a perfect message either, so I'm open to suggestions.
But at the end of the day users will need to read the docs anyway, and emitting
multi-line errors each time this gets triggered can probably become annoying?

r? `@jieyouxu` since you've reviewed my frontend work back in the days.

Tracking:

- rust-lang#124509
Zalathar added a commit to Zalathar/rust that referenced this issue Apr 10, 2025
…eyouxu

emit a better error message for using the macro incorrectly

fixing: EnzymeAD#185
I feel like it's not a perfect message either, so I'm open to suggestions.
But at the end of the day users will need to read the docs anyway, and emitting
multi-line errors each time this gets triggered can probably become annoying?

r? `@jieyouxu` since you've reviewed my frontend work back in the days.

Tracking:

- rust-lang#124509
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Apr 10, 2025
…eyouxu

emit a better error message for using the macro incorrectly

fixing: EnzymeAD#185
I feel like it's not a perfect message either, so I'm open to suggestions.
But at the end of the day users will need to read the docs anyway, and emitting
multi-line errors each time this gets triggered can probably become annoying?

r? ``@jieyouxu`` since you've reviewed my frontend work back in the days.

Tracking:

- rust-lang#124509
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 10, 2025
Rollup merge of rust-lang#139563 - EnzymeAD:better-autodiff-err, r=jieyouxu

emit a better error message for using the macro incorrectly

fixing: EnzymeAD#185
I feel like it's not a perfect message either, so I'm open to suggestions.
But at the end of the day users will need to read the docs anyway, and emitting
multi-line errors each time this gets triggered can probably become annoying?

r? ``@jieyouxu`` since you've reviewed my frontend work back in the days.

Tracking:

- rust-lang#124509
@ZuseZ4
Copy link
Collaborator

ZuseZ4 commented Apr 14, 2025

@sYgbpNA5UEVufjsHNwF3Xvf9ANZi5bNs Both of your issues should be resolved now, but please let me know if you find other ways to break it. Frontend bugs are a great way to get new contributors started, so I always appreciate them.

@ZuseZ4 ZuseZ4 closed this as completed Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants