Skip to content

Add help suggestion for inline attribute with invalid argument #101712

Closed
@Rageking8

Description

@Rageking8

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.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions