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

Better syntax checking on attributes #16974

Closed
kmcallister opened this issue Sep 3, 2014 · 1 comment
Closed

Better syntax checking on attributes #16974

kmcallister opened this issue Sep 3, 2014 · 1 comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@kmcallister
Copy link
Contributor

For example, #![crate_type(lib)] produces

error: main function not found
error: aborting due to previous error

which is not a very good clue to the correct syntax #![crate_type="lib"].

@kmcallister kmcallister added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-diagnostics Area: Messages for errors, warnings, and lints labels Sep 27, 2014
Manishearth added a commit to Manishearth/rust that referenced this issue May 10, 2015
… r=alexcrichton

Fixes the problem in rust-lang#16974 with unhelpful error messages when accidentally using the wrong syntax for the `crate_type="lib"` attribute. The attribute syntax error now shows up instead of "main function not found".
Manishearth added a commit to Manishearth/rust that referenced this issue May 10, 2015
… r=alexcrichton

Fixes the problem in rust-lang#16974 with unhelpful error messages when accidentally using the wrong syntax for the `crate_type="lib"` attribute. The attribute syntax error now shows up instead of "main function not found".
@steveklabnik
Copy link
Member

This example now shows

hello.rs:1:1: 1:20 error: `crate_type` requires a value
hello.rs:1 #![crate_type(lib)]
           ^~~~~~~~~~~~~~~~~~~
note: for example: `#![crate_type="lib"]`
error: aborting due to previous error

Showing off the exact syntax.

bors added a commit to rust-lang-ci/rust that referenced this issue Mar 31, 2024
…lnicola

refactor: Implement len and is_empty method in generic_params
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

2 participants