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

Validate usage of inline attributes #2809

Closed
catamorphism opened this issue Jul 5, 2012 · 8 comments
Closed

Validate usage of inline attributes #2809

catamorphism opened this issue Jul 5, 2012 · 8 comments
Labels
A-attributes Area: #[attributes(..)]

Comments

@catamorphism
Copy link
Contributor

syntax::attr::find_inline_attr has a FIXME saying "validate the usage of #[inline] and #[inline(always)]".

@pcwalton
Copy link
Contributor

I don't believe this is backwards incompatible, renominating.

@pcwalton
Copy link
Contributor

Also I don't know what this means.

@catamorphism
Copy link
Contributor Author

I can't tell where the comment originally came from, but I'm assuming it means checking that #[inline] doesn't get used to annotate something that can't be inlined (because it's not a function).

@graydon
Copy link
Contributor

graydon commented Jun 6, 2013

just a bug, removing milestone/nomination.

@nikomatsakis
Copy link
Contributor

Consensus is that this means a lint pass detecting #[inline] being applied
to bad code.

@graydon
Copy link
Contributor

graydon commented Aug 15, 2013

Visiting for triage, nontrivial amount of work so leaving as properly classified for now.

@steveklabnik
Copy link
Member

Amusingly, today this says

    // FIXME (#2809)---validate the usage of #[inline] and #[inline]

No more always, but it's still there.

@nagisa
Copy link
Member

nagisa commented Feb 19, 2015

#22490 validates well-formedness of the inline attribute, but it is still unknown whether there’s any ways to misuse #[inline] attribute in a way which would be invalid (e.g. not on a function).

If the comment in original report happens to have referred to validation of attribute well-formedness, this issue can then be closed. Do not forget to remove the FIXME comment too.

bors added a commit that referenced this issue Oct 2, 2015
This is technically a [breaking-change].

Fix #2809.
Fix #22746.
saethlin pushed a commit to saethlin/rust that referenced this issue Mar 16, 2023
Implement round_ties_even

For tests, I just copied over the standard library's tests for this feature. It looks like the library uses an approximate equality check for most/all float tests, and I've replaced that check with our float equality check pattern.
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
…ust-lang#2809)

This adds support for verifying the contracts of recursive functions
inductively.

The idea is quite simple. We use a global variable to track whether
we're reentering a function and depending on that value we either
continue with checking the contract or assume the hypothesis by using
its replacement.

The precise mechanism that I implemented is explained in the
documentation
[here](https://github.com/JustusAdam/kani/blob/a31176c79098205ca0b2c2b199cdf06653754551/library/kani_macros/src/sysroot/contracts.rs#L126)

Resolves rust-lang#2724 

**Open Question:** to facilitate induction the return type of the
function must implement `kani::Arbitrary`. Since we can't discriminate
between recursive and non-recursive functions in the proc-macro this
means that this applies to all functions with contracts, not just
recursive ones. This may be an unacceptable restriction. We could
consider making inductive verification explicit with an annotation like
`#[kani::inductive]` or conversely make inductive the default and let
users opt-out with `#[kani::no_inductive]`. This is now tracked in rust-lang#2823

I had to remove the names of the functions in which the messages occur
in the test cases, since they are now generated, hard to read names

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.

---------

Co-authored-by: Zyad Hassan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: #[attributes(..)]
Projects
None yet
Development

No branches or pull requests

7 participants