LCOV - code coverage report
Current view: top level - gcc/rust/checks/errors - rust-feature.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 69.0 % 42 29
Test Date: 2025-06-21 16:26:05 Functions: 100.0 % 2 2
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : // Copyright (C) 2020-2025 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                 :             : #include "rust-feature.h"
      20                 :             : 
      21                 :             : namespace Rust {
      22                 :             : 
      23                 :             : Feature
      24                 :          22 : Feature::create (Feature::Name f)
      25                 :             : {
      26                 :          22 :   switch (f)
      27                 :             :     {
      28                 :           0 :     case Feature::Name::ASSOCIATED_TYPE_BOUNDS:
      29                 :           0 :       return Feature (Feature::Name::ASSOCIATED_TYPE_BOUNDS,
      30                 :             :                       Feature::State::ACCEPTED, "associated_type_bounds",
      31                 :           0 :                       "1.34.0", 52662);
      32                 :           4 :     case Feature::Name::INTRINSICS:
      33                 :           4 :       return Feature (f, Feature::State::ACCEPTED, "intrinsics", "1.0.0");
      34                 :           4 :     case Feature::Name::RUSTC_ATTRS:
      35                 :           4 :       return Feature (f, Feature::State::ACCEPTED, "rustc_attrs", "1.0.0");
      36                 :           0 :     case Feature::Name::DECL_MACRO:
      37                 :           0 :       return Feature (f, Feature::State::ACCEPTED, "decl_macro", "1.0.0",
      38                 :           0 :                       39412);
      39                 :           2 :     case Feature::Name::EXTERN_TYPES:
      40                 :           2 :       return Feature (f, Feature::State::ACTIVE, "extern_types", "1.23.0",
      41                 :           2 :                       43467);
      42                 :           2 :     case Feature::Name::NEGATIVE_IMPLS:
      43                 :           2 :       return Feature (f, Feature::State::ACTIVE, "negative_impls", "1.0.0",
      44                 :           2 :                       68318);
      45                 :           2 :     case Feature::Name::BOX_SYNTAX:
      46                 :           2 :       return Feature (f, Feature::State::ACTIVE, "box_syntax", "1.0.0", 49733);
      47                 :           2 :     case Feature::Name::DROPCK_EYEPATCH:
      48                 :           2 :       return Feature (f, Feature::State::ACTIVE, "dropck_eyepatch", "1.10.0",
      49                 :           2 :                       34761);
      50                 :           2 :     case Feature::Name::RAW_REF_OP:
      51                 :           2 :       return Feature (f, Feature::State::ACTIVE, "raw_ref_op", "1.41.0", 64490);
      52                 :           2 :     case Feature::Name::EXCLUSIVE_RANGE_PATTERN:
      53                 :           2 :       return Feature (Feature::Name::EXCLUSIVE_RANGE_PATTERN,
      54                 :             :                       Feature::State::ACTIVE, "exclusive_range_pattern",
      55                 :           2 :                       "1.11.0", 37854);
      56                 :           0 :     case Feature::Name::PRELUDE_IMPORT:
      57                 :           0 :       return Feature (f, Feature::State::ACTIVE, "prelude_import", "1.0.0");
      58                 :           0 :     case Feature::Name::MIN_SPECIALIZATION:
      59                 :           0 :       return Feature (f, Feature::State::ACTIVE, "min_specialization",
      60                 :           0 :                       "1.0.0" /* FIXME: What version here? */, 31844);
      61                 :           2 :     case Feature::Name::AUTO_TRAITS:
      62                 :           2 :       return Feature (f, Feature::State::ACTIVE, "optin_builtin_traits",
      63                 :           2 :                       "1.0.0", 13231);
      64                 :           0 :     default:
      65                 :           0 :       rust_unreachable ();
      66                 :             :     }
      67                 :             : }
      68                 :             : 
      69                 :             : const std::map<std::string, Feature::Name> Feature::name_hash_map = {
      70                 :             :   {"associated_type_bounds", Feature::Name::ASSOCIATED_TYPE_BOUNDS},
      71                 :             :   {"intrinsics", Feature::Name::INTRINSICS},
      72                 :             :   {"rustc_attrs", Feature::Name::RUSTC_ATTRS},
      73                 :             :   {"decl_macro", Feature::Name::DECL_MACRO},
      74                 :             :   {"negative_impls", Feature::Name::NEGATIVE_IMPLS},
      75                 :             :   // TODO: Rename to "auto_traits" when supporting
      76                 :             :   // later Rust versions
      77                 :             :   {"optin_builtin_traits", Feature::Name::AUTO_TRAITS},
      78                 :             :   {"extern_types", Feature::Name::EXTERN_TYPES},
      79                 :             :   {"lang_items", Feature::Name::LANG_ITEMS},
      80                 :             :   {"no_core", Feature::Name::NO_CORE},
      81                 :             :   {"box_syntax", Feature::Name::BOX_SYNTAX},
      82                 :             :   {"dropck_eyepatch", Feature::Name::DROPCK_EYEPATCH},
      83                 :             :   {"raw_ref_op", Feature::Name::RAW_REF_OP},
      84                 :             :   {"exclusive_range_pattern", Feature::Name::EXCLUSIVE_RANGE_PATTERN},
      85                 :             :   {"prelude_import", Feature::Name::PRELUDE_IMPORT},
      86                 :             :   {"min_specialization", Feature::Name::MIN_SPECIALIZATION},
      87                 :             : }; // namespace Rust
      88                 :             : 
      89                 :             : tl::optional<Feature::Name>
      90                 :         647 : Feature::as_name (const std::string &name)
      91                 :             : {
      92                 :         647 :   if (Feature::name_hash_map.count (name))
      93                 :         641 :     return Feature::name_hash_map.at (name);
      94                 :             : 
      95                 :           6 :   return tl::nullopt;
      96                 :             : }
      97                 :             : 
      98                 :             : } // namespace Rust
        

Generated by: LCOV version 2.1-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.