LCOV - code coverage report
Current view: top level - gcc/rust/checks/errors/feature - rust-feature-gate.h Coverage Total Hit
Test: gcc.info Lines: 100.0 % 1 1
Test Date: 2026-02-28 14:20:25 Functions: - 0 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : // Copyright (C) 2020-2026 Free Software Foundation, Inc.
       2              : 
       3              : // This file is part of GCC.
       4              : 
       5              : // GCC is free software; you can redistribute it and/or modify it under
       6              : // the terms of the GNU General Public License as published by the Free
       7              : // Software Foundation; either version 3, or (at your option) any later
       8              : // version.
       9              : 
      10              : // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      11              : // WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12              : // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      13              : // for more details.
      14              : 
      15              : // You should have received a copy of the GNU General Public License
      16              : // along with GCC; see the file COPYING3.  If not see
      17              : // <http://www.gnu.org/licenses/>.
      18              : 
      19              : #ifndef RUST_FEATURE_GATE_H
      20              : #define RUST_FEATURE_GATE_H
      21              : 
      22              : #include "rust-ast-visitor.h"
      23              : #include "rust-feature.h"
      24              : 
      25              : namespace Rust {
      26              : 
      27              : class FeatureGate : public AST::DefaultASTVisitor
      28              : {
      29              : public:
      30         4509 :   FeatureGate () {}
      31              : 
      32              :   using AST::DefaultASTVisitor::visit;
      33              : 
      34              :   void check (AST::Crate &crate);
      35              :   void visit (AST::Crate &crate) override;
      36              : 
      37              :   void visit (AST::LifetimeParam &lifetime_param) override;
      38              :   void visit (AST::ConstGenericParam &const_param) override;
      39              :   void visit (AST::BorrowExpr &expr) override;
      40              :   void visit (AST::BoxExpr &expr) override;
      41              :   void visit (AST::TypeParam &param) override;
      42              :   void visit (AST::UseTreeGlob &use_tree) override;
      43              :   void visit (AST::Function &function) override;
      44              :   void visit (AST::TraitImpl &impl) override;
      45              :   void visit (AST::Trait &trait) override;
      46              :   void visit (AST::ExternalTypeItem &item) override;
      47              :   void visit (AST::ExternBlock &block) override;
      48              :   void visit (AST::MacroRulesDefinition &rules_def) override;
      49              :   void visit (AST::RangePattern &pattern) override;
      50              :   void visit (AST::StructStruct &struct_item) override;
      51              :   void visit (AST::TraitItemType &trait_item_type) override;
      52              :   void visit (AST::Enum &enum_item) override;
      53              :   void visit (AST::EnumItem &enum_variant) override;
      54              : 
      55              : private:
      56              :   void gate (Feature::Name name, location_t loc, const std::string &error_msg);
      57              :   void check_rustc_attri (const std::vector<AST::Attribute> &attributes);
      58              :   void
      59              :   check_may_dangle_attribute (const std::vector<AST::Attribute> &attributes);
      60              :   void
      61              :   check_lang_item_attribute (const std::vector<AST::Attribute> &attributes);
      62              :   void note_stability_attribute (const std::vector<AST::Attribute> &attributes);
      63              : 
      64              :   std::set<Feature::Name> valid_lang_features;
      65              :   std::map<std::string, location_t> valid_lib_features;
      66              : 
      67              :   enum class Stability
      68              :   {
      69              :     STABLE,
      70              :     UNSTABLE,
      71              :   };
      72              : 
      73              :   std::map<std::string, Stability> defined_lib_features;
      74              : };
      75              : } // namespace Rust
      76              : #endif
        

Generated by: LCOV version 2.4-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.