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

Error when #![staged_api] crates are missing stability markers #21910

Merged
merged 9 commits into from
Feb 4, 2015

Conversation

Manishearth
Copy link
Member

Currently, if a #![staged_api] crate contains an exported item without a stability marker (or inherited stability),
the item is useless.

This change introduces a check to ensure that all exported items have a defined stability.

it also introduces the unmarked_api feature, which lets users import unmarked features. While this PR should in theory forbid these from existing,
in practice we can't be so sure; so this lets users bypass this check instead of having to wait for the library and/or compiler to be fixed (since otherwise this is a hard error).

r? @aturon

}

impl<'a> Annotator<'a> {
// Determine the stability for a node based on its attributes and inherited
// stability. The stability is recorded in the index and used as the parent.
fn annotate<F>(&mut self, id: NodeId, use_parent: bool,
attrs: &Vec<Attribute>, item_sp: Span, f: F) where
attrs: &Vec<Attribute>, item_sp: Span, f: F, error: bool) where
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can error be renamed to something more descriptive: required

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(addressed)

@Manishearth Manishearth force-pushed the missing_stability branch 3 times, most recently from 42d0cff to d02d4c3 Compare February 3, 2015 21:00
@Manishearth
Copy link
Member Author

I tweaked it so that it ignores errors when compiling tests. We don't need errors about testing when there are #[cfg(test)] pub fn test_foo(){} lying around.

A more fine-grained option is to make the visitor not recurse for #[cfg(test)] mods, fns, and impls.

@aturon
Copy link
Member

aturon commented Feb 3, 2015

@bors: r+ a5ddacf

Nice work, @Manishearth!

cc @SimonSapin

@SimonSapin
Copy link
Contributor

\o/

@SimonSapin
Copy link
Contributor

Fixes #21884

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Feb 4, 2015
Currently, if a `#![staged_api]` crate contains an exported item without a stability marker (or inherited stability),
the item is useless.

This change introduces a check to ensure that all exported items have a defined stability.

it also introduces the `unmarked_api` feature, which lets users import unmarked features. While this PR should in theory forbid these from existing,
in practice we can't be so sure; so this lets users bypass this check instead of having to wait for the library and/or compiler to be fixed (since otherwise this is a hard error).

r? @aturon
@bors bors merged commit a5ddacf into rust-lang:master Feb 4, 2015
@Manishearth Manishearth deleted the missing_stability branch February 4, 2015 09:03
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

Successfully merging this pull request may close these issues.

4 participants