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

Decide on (and implement) which parts of the AST can get stability attributes #8967

Closed
huonw opened this issue Sep 3, 2013 · 4 comments
Closed
Labels
A-attributes Area: #[attributes(..)] A-lint Area: Lints (warnings about flaws in source code) such as unused_mut.

Comments

@huonw
Copy link
Member

huonw commented Sep 3, 2013

As of #8921, the compiler checks the attributes on structs, enum variants (not enums themselves) and functions. Definitely required: methods (#8961) and mods (#8962).

Up for discussion:

  • traits
  • enums
  • impls (both impl Type and impl Trait for Type)
  • struct fields
  • type aliases.
  • foreign fns
  • anything else that can take attributes in the ast

(Part of #6875.)

@brson
Copy link
Contributor

brson commented Sep 5, 2013

Anything that might be named should probably have stability levels. From your list the two that I see that might not need them are fields (stability can apply to the entire struct) and impls (methods may be enough).

Traits are important and especially tricky though, since there are multiple ways for them to be used. It would be great if calling trait methods and implementing traits could be considered separately. As long as the trait has a stable name, and you don't implement the trait, then just calling a method doesn't require all methods on the trait to be stable. Hard to represent all that subtlety though. If we can't then basically you have to declare an entire trait stable at once, which will make stabilizing things like str and vec pretty tough - I can foresee traits like OwnedVector2, OwnedVector3 in our future.

@huonw
Copy link
Member Author

huonw commented Sep 6, 2013

I was assuming that trait methods would be checked (presumably only annotations on the original trait, otherwise it will act differently for generics and concrete types), and that it would be useful to mark trait impls, i.e. "don't use this trait on this type"; although, to be 100% useful, it would have to check whenever it was used in a context that assumed this trait (i.e. generics, casting to a trait object, calling a method) which might be tricky.

@emberian
Copy link
Member

Traits and enums definitely, but I don't think the rest are going to be useful.

@steveklabnik
Copy link
Member

I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized.

This issue has been moved to the RFCs repo: rust-lang/rfcs#687

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: #[attributes(..)] A-lint Area: Lints (warnings about flaws in source code) such as unused_mut.
Projects
None yet
Development

No branches or pull requests

4 participants