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

Feature gate custom attributes #22364

Merged
merged 12 commits into from
Feb 18, 2015
Merged

Conversation

Manishearth
Copy link
Member

fixes #22203

r? @nikomatsakis

This breaks code that might be using attributes randomly, so it's technically a

[breaking-change]

@Manishearth
Copy link
Member Author

cc @nick29581

@Manishearth
Copy link
Member Author

This doesn't completely implement the backwards compatibility we need for attributes. There's also the case of attributes like #[must_use] being used places where they shouldn't be (eg mods).

But the requirements for each of the builtin attributes are different so I don't see a way of doing this here. Adding some sort of individual check for each sounds doable though.

@Manishearth Manishearth force-pushed the rfc-572-forbid-attr branch 3 times, most recently from 79b3c9b to d5c3194 Compare February 16, 2015 06:18
 - We shouldn't be using `check_name` here at all
 - `contains_name(ref_slice(foo), bar)` is redundant, `contains_name` just iterates over its first arg and calls `check_name`
 - match would be better than a bunch of ifs
unknown to the the compiler and \
may have meaning \
added to it in the future",
attr.name()).as_slice());
Copy link
Contributor

Choose a reason for hiding this comment

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

The interaction between #22336 and this is interesting. I think I'd like a way to include something in the table of custom attributes but still declare that it requires a (perhaps generic) feature-gate. This would be the case for things like rustc_move_fragments and rustc_variance. Or we could add them to the list above, but it seems a bit redundant. (It might also be nice to be able to just write something like FeatureGate("tag") and get a generic message like "The attribute {} has unstable semantics and requires the feature-gate {}".

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, Gated("tag") (and perhaps even Deprecated("reason")) sound like useful additions to the list.

Copy link
Member Author

Choose a reason for hiding this comment

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

(fixed)

@nikomatsakis
Copy link
Contributor

@Manishearth ok r+ with the addition of Gated("tag"), which should be used for rustc_* (and perhaps Deprecated("reason"))

@eddyb
Copy link
Member

eddyb commented Feb 16, 2015

@bors r=nikomatsakis 0112 aka cute little fibonacci

@nikomatsakis
Copy link
Contributor

@bors r+ 1fffdaf

@nikomatsakis
Copy link
Contributor

@bors r- until rustc_variance and friends are feature-gated

@nikomatsakis
Copy link
Contributor

@bors r+ 917fce2

@nikomatsakis
Copy link
Contributor

@bors r+ f64d71b

Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 17, 2015
…nikomatsakis

 fixes rust-lang#22203

r? @nikomatsakis

This breaks code that might be using attributes randomly, so it's technically a

[breaking-change]
@huonw huonw merged commit f64d71b into rust-lang:master Feb 18, 2015
@Manishearth Manishearth deleted the rfc-572-forbid-attr branch September 3, 2015 17:46
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.

Tracking issue for RFC #572: feature gate unused attributes
4 participants