diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-02-03 13:57:03 +0100 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-02-11 15:08:17 +0100 |
| commit | 33bf81eec018ec717bffc4468faf8d2a3bde1892 (patch) | |
| tree | da20ccfafa6310898226f49b7b8c5844a47ea831 /src/libsyntax/ext | |
| parent | d3c212c5527f901fcb44d59d031695248762c340 (diff) | |
| download | rust-33bf81eec018ec717bffc4468faf8d2a3bde1892.tar.gz rust-33bf81eec018ec717bffc4468faf8d2a3bde1892.zip | |
Ease the transition to requiring features by just warning if there's no feature list
while we could make this change (it's all unstable after all), there are crates.io crates that use the feature and that the compiler depends upon. We can instead roll out this feature while still supporting the old way.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 4409bf13b6c..a79f3271fcb 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -379,14 +379,20 @@ pub fn compile( let allow_internal_unstable = attr::find_by_name(&def.attrs, "allow_internal_unstable") .map_or(Vec::new(), |attr| attr .meta_item_list() - .unwrap_or_else(|| sess.span_diagnostic.span_bug( - attr.span, "allow_internal_unstable expects list of feature names", - )) - .iter() - .map(|it| it.name().unwrap_or_else(|| sess.span_diagnostic.span_bug( - it.span, "allow internal unstable expects feature names", - ))) - .collect() + .map(|list| list.iter() + .map(|it| it.name().unwrap_or_else(|| sess.span_diagnostic.span_bug( + it.span, "allow internal unstable expects feature names", + ))) + .collect() + ) + .unwrap_or_else(|| { + sess.span_diagnostic.span_warn( + attr.span, "allow_internal_unstable expects list of feature names. In the \ + future this will become a hard error. Please use `allow_internal_unstable(\ + foo, bar)` to only allow the `foo` and `bar` features", + ); + vec![Symbol::intern("allow_internal_unstable_backcompat_hack")] + }) ); let allow_internal_unsafe = attr::contains_name(&def.attrs, "allow_internal_unsafe"); let mut local_inner_macros = false; |
