Skip to content
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

cannot find macro compile_error in this scope #1427

Closed
smoelius opened this issue Mar 27, 2023 · 0 comments · Fixed by #1431
Closed

cannot find macro compile_error in this scope #1427

smoelius opened this issue Mar 27, 2023 · 0 comments · Fixed by #1431

Comments

@smoelius
Copy link
Contributor

A custom inner attribute (specifically, this one) applied at the crate root produces an error message like this:

error: cannot find macro `compile_error` in this scope
 --> src/main.rs:2:1
  |
2 | / #![feature(custom_inner_attributes, proc_macro_hygiene)]
3 | |
4 | | #![cast_checks::enable]
5 | |
6 | |
7 | | fn main() {
8 | | }
  | |_^
  |
  = help: consider importing one of these items:
          std::compile_error
          core::compile_error

I think the reason for the error message is that compile_error! is not qualified here:

TokenTree::Ident(Ident::new("compile_error", start)),

In other words, I think it should be std::compile_error!.

To be clear, I don't think that making this error go away will make the crate-level, custom inner attribute work---I think there are other problems.

But making this error go away would help to expose those other problems and make them easier to diagnose.

Would you agree?

I could submit a PR, but I would need a pointer or two on how to change the referenced code. My attempts to add std:: thus far have been unsuccessful.

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

Successfully merging a pull request may close this issue.

1 participant