Skip to content

Add help suggestion for inline attribute with invalid argument #101712

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
Rageking8 opened this issue Sep 12, 2022 · 1 comment · Fixed by #101904
Closed

Add help suggestion for inline attribute with invalid argument #101712

Rageking8 opened this issue Sep 12, 2022 · 1 comment · Fixed by #101904
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Rageking8
Copy link
Contributor

Rageking8 commented Sep 12, 2022

Given the following code: link

#[inline(Always)]
fn foo() { }

fn main() {

}

The current output is:

Compiling playground v0.0.1 (/playground)
error[[E0535]](https://doc.rust-lang.org/nightly/error-index.html#E0535): invalid argument
 --> src/main.rs:4:10
  |
1 | #[inline(Always)]
  |          ^^^^^^

For more information about this error, try `rustc --explain E0535`.
error: could not compile `playground` due to previous error

Since attributes like repr already have a help suggestion that states the list of valid arguments when an invalid argument is passed in, I think we should be able to extend this to the inline attribute as well.


Hence, the ideal output will have a help suggestion stating the list of valid arguments (for inline), just like how repr does this (e.g. help: valid reprs are C, align, packed, transparent, simd, i8, u8, i16, u16, i32, u32, i64, u64, i128, u128, isize, usize). Thanks.

@Rageking8 Rageking8 added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 12, 2022
@Rageking8 Rageking8 changed the title Add help suggestion for inline and derive attributes when not recoverable by the Levenshtein algo Add help suggestion for inlineattribute with invalid argument Sep 16, 2022
@Rageking8 Rageking8 changed the title Add help suggestion for inlineattribute with invalid argument Add help suggestion for inline attribute with invalid argument Sep 16, 2022
@Rageking8
Copy link
Contributor Author

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant