]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #55510 - bitshifter:repr-feature-gate-fix, r=petrochenkov
authorkennytm <kennytm@gmail.com>
Wed, 7 Nov 2018 10:01:53 +0000 (18:01 +0800)
committerGitHub <noreply@github.com>
Wed, 7 Nov 2018 10:01:53 +0000 (18:01 +0800)
Fix feature gate only being checked on first repr attr.

Reported in https://github.com/rust-lang/rust/issues/33158#issuecomment-412185357.

1  2 
src/libsyntax/feature_gate.rs

index cb15c517c178564bbbdee5561234e04e9d96370a,d4dc1f8b50851d30ce7a2e2c0d5fe61861016188..55652c481bd3f07478d90588229b6c3ae755825a
@@@ -349,7 -349,7 +349,7 @@@ declare_features! 
      (active, abi_thiscall, "1.19.0", None, None),
  
      // Allows a test to fail without failing the whole suite
 -    (active, allow_fail, "1.19.0", Some(42219), None),
 +    (active, allow_fail, "1.19.0", Some(46488), None),
  
      // Allows unsized tuple coercion.
      (active, unsized_tuple_coercion, "1.20.0", Some(42877), None),
      (active, non_exhaustive, "1.22.0", Some(44109), None),
  
      // `crate` as visibility modifier, synonymous to `pub(crate)`
 -    (active, crate_visibility_modifier, "1.23.0", Some(45388), None),
 +    (active, crate_visibility_modifier, "1.23.0", Some(53120), None),
  
      // extern types
      (active, extern_types, "1.23.0", Some(43467), None),
      (active, generic_associated_types, "1.23.0", Some(44265), None),
  
      // `extern` in paths
 -    (active, extern_in_paths, "1.23.0", Some(44660), None),
 +    (active, extern_in_paths, "1.23.0", Some(55600), None),
  
      // Use `?` as the Kleene "at most one" operator
      (active, macro_at_most_once_rep, "1.25.0", Some(48075), None),
  
      // Infer static outlives requirements; RFC 2093
 -    (active, infer_static_outlives_requirements, "1.26.0", Some(44493), None),
 +    (active, infer_static_outlives_requirements, "1.26.0", Some(54185), None),
  
      // Multiple patterns with `|` in `if let` and `while let`
      (active, if_while_or_patterns, "1.26.0", Some(48215), None),
      // Integer match exhaustiveness checking
      (active, exhaustive_integer_patterns, "1.30.0", Some(50907), None),
  
 -    // RFC 2070: #[panic_implementation] / #[panic_handler]
 -    (active, panic_implementation, "1.28.0", Some(44489), None),
 -
      // #[doc(keyword = "...")]
      (active, doc_keyword, "1.28.0", Some(51315), None),
  
      (active, test_2018_feature, "1.31.0", Some(0), Some(Edition::Edition2018)),
  
      // Support for arbitrary delimited token streams in non-macro attributes
 -    (active, unrestricted_attribute_tokens, "1.30.0", Some(44690), None),
 +    (active, unrestricted_attribute_tokens, "1.30.0", Some(55208), None),
  
      // Allows `use x::y;` to resolve through `self::x`, not just `::x`
      (active, uniform_paths, "1.30.0", Some(53130), None),
      (active, underscore_const_names, "1.31.0", Some(54912), None),
  
      // `extern crate foo as bar;` puts `bar` into extern prelude.
 -    (active, extern_crate_item_prelude, "1.31.0", Some(54658), None),
 +    (active, extern_crate_item_prelude, "1.31.0", Some(55599), None),
  
      // `reason = ` in lint attributes and `expect` lint attribute
      (active, lint_reasons, "1.31.0", Some(54503), None),
@@@ -538,8 -541,6 +538,8 @@@ declare_features! 
       Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
      (removed, proc_macro_gen, "1.27.0", Some(54727), None,
       Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
 +    (removed, panic_implementation, "1.28.0", Some(44489), None,
 +     Some("subsumed by `#[panic_handler]`")),
  );
  
  declare_features! (
@@@ -1159,6 -1160,16 +1159,6 @@@ pub const BUILTIN_ATTRIBUTES: &'static 
                                     "infer 'static lifetime requirements",
                                     cfg_fn!(infer_static_outlives_requirements))),
  
 -    // RFC 2070 (deprecated attribute name)
 -    ("panic_implementation",
 -     Normal,
 -     Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/44489\
 -                                  #issuecomment-415140224",
 -                                 Some("replace this attribute with `#[panic_handler]`")),
 -           "panic_implementation",
 -           "this attribute was renamed to `panic_handler`",
 -           cfg_fn!(panic_implementation))),
 -
      // RFC 2070
      ("panic_handler", Normal, Ungated),
  
@@@ -1614,7 -1625,7 +1614,7 @@@ impl<'a> Visitor<'a> for PostExpansionV
              }
  
              ast::ItemKind::Struct(..) => {
-                 if let Some(attr) = attr::find_by_name(&i.attrs[..], "repr") {
+                 for attr in attr::filter_by_name(&i.attrs[..], "repr") {
                      for item in attr.meta_item_list().unwrap_or_else(Vec::new) {
                          if item.check_name("simd") {
                              gate_feature_post!(&self, repr_simd, attr.span,
                              if name == "packed" {
                                  gate_feature_post!(&self, repr_packed, attr.span,
                                                     "the `#[repr(packed(n))]` attribute \
 -                                                   is experimental");
 +                                                    is experimental");
                              }
                          }
                      }
                  }
              }
  
 -            ast::ItemKind::TraitAlias(..) => {
 -                gate_feature_post!(&self, trait_alias,
 -                                   i.span,
 -                                   "trait aliases are not yet fully implemented");
 -            }
 -
              ast::ItemKind::Impl(_, polarity, defaultness, _, _, _, _) => {
                  if polarity == ast::ImplPolarity::Negative {
                      gate_feature_post!(&self, optin_builtin_traits,
                                     "auto traits are experimental and possibly buggy");
              }
  
 +            ast::ItemKind::TraitAlias(..) => {
 +                gate_feature_post!(
 +                    &self,
 +                    trait_alias,
 +                    i.span,
 +                    "trait aliases are experimental"
 +                );
 +            }
 +
              ast::ItemKind::MacroDef(ast::MacroDef { legacy: false, .. }) => {
                  let msg = "`macro` is experimental";
                  gate_feature_post!(&self, decl_macro, i.span, msg);