-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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(never)] vs #[inline(never)] #69365
Comments
Many built-in attributes are not validated that they appear in correct locations, particularly for the codegen attributes. I don't think there is a single issue tracking this, but I think #55112 is probably the closest? There are a number of other issues reporting similar confusion about attributes being ignored: #54044, #47725, #54584, #53901, #64734, #65128. The lint control attributes (allow/warn/deny) are particularly gnarly since they can go anywhere, but don't always do what people expect (#61552, #59144 among others). |
#64734 is especially relevant because, as discussion there immediately identified, |
Thanks for the insights! It would occasionally be convenient to be able to say "inline nothing in this module", if that was easy to provide. I wrote |
Such a feature might not be hard to provide, but we need fix the bug in attribute checking anyway (since it affects other attributes too), and IMO we should do that first. I'd like at least one release where rustc highlights potential pre-existing typos such as ///! This is a simple crate with a few functions, one of which is `#[inline]`.
#![some_crate_attribute]
#![inline] // typo: a ! snuck in
fn foo() {
// ...
}
// ... other functions, which aren't intended to be #[inline] |
…l, r=matthewjasper Add check for doc alias attribute at crate level Fixes rust-lang#76298, rust-lang#64734, rust-lang#69365. r? @ollie27
Consider this code:
and the resulting assembly:
I know I was hoping for a lot there, and I know that
#[inline(never)]
is just a suggestion. That said, given that I didn't get a warning here I would have expected removing the!
to produce the same output. Butyields
If
#![inline(never)]
is supposed to work, it would be nice to have it work here. If it is not, it would be nice to get a warning lint.(It would also be nice if
inline(never)
was a requirement, not just a suggestion. But that's a separate issue, I think.)Meta
Built on the playground in release mode. Same behavior with
rustc
stable1.41.0
and1.43.0-nightly (2020-02-20 2c462a2f776b899d4674)
The text was updated successfully, but these errors were encountered: