diff options
| author | Zack M. Davis <code@zackmdavis.net> | 2017-08-22 17:27:00 -0700 |
|---|---|---|
| committer | Zack M. Davis <code@zackmdavis.net> | 2017-08-22 20:39:56 -0700 |
| commit | 35c449419cfbd2bc1abc81077c95ef43ed766f97 (patch) | |
| tree | f8f5facf0819d103607dd504896e9a5ea9d91cec /src/libsyntax | |
| parent | 8492ad2479379d2e07ccf2d3439ec29b19d164b8 (diff) | |
| download | rust-35c449419cfbd2bc1abc81077c95ef43ed766f97.tar.gz rust-35c449419cfbd2bc1abc81077c95ef43ed766f97.zip | |
fn_must_use soft feature-gate warning on methods too, not only functions
This continues to be in the matter of #43302.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 79f15f2fe19..09574d5ba12 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1318,7 +1318,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { and possibly buggy"); } - ast::ItemKind::Impl(_, polarity, defaultness, _, _, _, _) => { + ast::ItemKind::Impl(_, polarity, defaultness, _, _, _, ref impl_items) => { if polarity == ast::ImplPolarity::Negative { gate_feature_post!(&self, optin_builtin_traits, i.span, @@ -1331,6 +1331,16 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { i.span, "specialization is unstable"); } + + for impl_item in impl_items { + if let ast::ImplItemKind::Method(..) = impl_item.node { + if attr::contains_name(&impl_item.attrs[..], "must_use") { + gate_feature_post!(&self, fn_must_use, impl_item.span, + "`#[must_use]` on methods is experimental", + GateStrength::Soft); + } + } + } } ast::ItemKind::MacroDef(ast::MacroDef { legacy: false, .. }) => { |
