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

#[inline] should be a warning or error if used above non-functions #45568

Closed
mtak- opened this issue Oct 27, 2017 · 3 comments
Closed

#[inline] should be a warning or error if used above non-functions #45568

mtak- opened this issue Oct 27, 2017 · 3 comments

Comments

@mtak-
Copy link
Contributor

mtak- commented Oct 27, 2017

Adding #[inline] above arbitrary statements does not issue a warning or error.

I found this confusing. I was guessing at a loop unrolling attribute when I discovered this, and thought the lack of warnings/errors meant it might actually unroll the loop, but checking the ASM output proves it does not: https://godbolt.org/g/sNEnfa

#[inline]
fn foo() {} // ok

fn bar() {
  #[inline] // pointless, but no warning/error
  ()
}
@mtak- mtak- changed the title #[inline] should be a warning or error if used for above non-functions #[inline] should be a warning or error if used above non-functions Oct 27, 2017
@zackmdavis
Copy link
Member

Could be part of the unused-attribute lint? Potentially related: #14407 and #14408

@oyvindln
Copy link
Contributor

Possibly a duplicate of #43988 ?

@mtak-
Copy link
Contributor Author

mtak- commented Oct 30, 2017

@oyvindln Oops, I'd say it is definitely a dupe your issue (#43988). closing

@mtak- mtak- closed this as completed Oct 30, 2017
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

3 participants