LCOV - code coverage report
Current view: top level - gcc/rust/checks/errors/feature - rust-feature.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 7 7
Test Date: 2026-02-28 14:20:25 Functions: 100.0 % 1 1
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_H
      20              : #define RUST_FEATURE_H
      21              : 
      22              : #include "rust-edition.h"
      23              : #include "optional.h"
      24              : 
      25              : namespace Rust {
      26              : 
      27              : class Feature
      28              : {
      29              : public:
      30              :   enum class State
      31              :   {
      32              :     ACCEPTED,   // stabilized
      33              :     ACTIVE,     // unstable
      34              :     REMOVED,    // removed
      35              :     STABILIZED, // removed after stabilization
      36              :   };
      37              : 
      38              :   enum class Name
      39              :   {
      40              : #define FEATURE_ACTIVE(x, name, ...) name,
      41              : #define FEATURE_ACCEPTED(x, name, ...) name,
      42              : #define FEATURE_REMOVED(x, name, ...) name,
      43              : #define FEATURE_STABLE_REMOVED(x, name, ...) name,
      44              : #include "rust-feature-defs.h"
      45              : #undef FEATURE_ACTIVE
      46              : #undef FEATURE_ACCEPTED
      47              : #undef FEATURE_REMOVED
      48              : #undef FEATURE_STABLE_REMOVED
      49              :   };
      50              : 
      51           13 :   const std::string &as_string () const { return m_name_str; }
      52              : 
      53              :   Name name () const { return m_name; }
      54              :   State state () const { return m_state; }
      55           13 :   tl::optional<unsigned> issue () const { return m_issue; }
      56              : 
      57              :   static tl::optional<Name> as_name (const std::string &name);
      58              : 
      59              :   static tl::optional<std::reference_wrapper<const Feature>>
      60              :   lookup (const std::string &name);
      61              :   static const Feature &lookup (Name name);
      62              : 
      63              : private:
      64      1437160 :   Feature (Name name, State state, const char *name_str, const char *rust_since,
      65              :            tl::optional<unsigned> issue_number, tl::optional<Edition> edition,
      66              :            tl::optional<const char *> reason)
      67      1437160 :     : m_name (name), m_state (state), m_name_str (name_str),
      68      1437160 :       m_rust_since (rust_since), m_issue (issue_number), edition (edition),
      69      1437160 :       m_reason (reason)
      70      1437160 :   {}
      71              : 
      72              :   Name m_name;
      73              :   State m_state;
      74              :   std::string m_name_str;
      75              :   std::string m_rust_since;
      76              :   tl::optional<unsigned> m_issue;
      77              :   tl::optional<Edition> edition;
      78              :   tl::optional<const char *> m_reason;
      79              : 
      80              :   static Feature feature_list[];
      81              :   static const std::map<std::string, Name> name_hash_map;
      82              : };
      83              : 
      84              : } // namespace Rust
      85              : #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.