rustc: do not inherit #[stable] - #18887
Conversation
This patch tweaks the stability inheritance infrastructure so that
`#{stable]` attributes are not inherited. Doing so solves two problems:
1. It allows us to mark module *names* as stable without accidentally
marking the items they contain as stable.
2. It means that a `#[stable]` attribution must always appear directly
on the item it applies to, which makes it easier for reviewers to catch
changes to stable APIs.
Fixes rust-lang#17484
|
This means I'll need to litter my library with stable attributes when I mark it 1.0? |
|
@seanmonstar The intended use of stability attributes is to give finer-grained control over semver; not everything needs to (or should) be marked stable at a 1.0 release unless you really want to make all of those promises. In general, the intended approach is to slowly annotate items over time with greater stability, even before 1.0 -- this was what we're doing for the standard library, for example. By not inheriting
Hope that helps. This is definitely something we can tweak over time. |
|
Would it be worth considering a |
|
I'm more thinking of smaller libraries with a hand full of methods or structs. One that I'm pretty confident won't change, I'd just stick a |
That's what I was going to do at first, but it seemed like overkill. Certainly something we can add. But we definitely want a way to not inherit
Fair enough. We can take something like @gankro's suggestion if this turns out to be painful in practice. |
This patch tweaks the stability inheritance infrastructure so that
`#{stable]` attributes are not inherited. Doing so solves two problems:
1. It allows us to mark module *names* as stable without accidentally
marking the items they contain as stable.
2. It means that a `#[stable]` attribution must always appear directly
on the item it applies to, which makes it easier for reviewers to catch
changes to stable APIs.
Fixes #17484
…ompletions_tests refactor test helpers within ide-completions
This patch tweaks the stability inheritance infrastructure so that
#{stable]attributes are not inherited. Doing so solves two problems:marking the items they contain as stable.
#[stable]attribution must always appear directlyon the item it applies to, which makes it easier for reviewers to catch
changes to stable APIs.
Fixes #17484