diff options
Diffstat (limited to 'gcc/rust/checks/errors')
-rw-r--r-- | gcc/rust/checks/errors/rust-const-checker.cc | 3 | ||||
-rw-r--r-- | gcc/rust/checks/errors/rust-feature-gate.cc | 7 | ||||
-rw-r--r-- | gcc/rust/checks/errors/rust-feature.cc | 4 | ||||
-rw-r--r-- | gcc/rust/checks/errors/rust-feature.h | 1 |
4 files changed, 15 insertions, 0 deletions
diff --git a/gcc/rust/checks/errors/rust-const-checker.cc b/gcc/rust/checks/errors/rust-const-checker.cc index 4904322..4c2257a 100644 --- a/gcc/rust/checks/errors/rust-const-checker.cc +++ b/gcc/rust/checks/errors/rust-const-checker.cc @@ -646,6 +646,9 @@ ConstChecker::visit (Enum &enum_item) { check_default_const_generics (enum_item.get_generic_params (), ConstGenericCtx::Enum); + + for (auto &item : enum_item.get_variants ()) + item->accept_vis (*this); } void diff --git a/gcc/rust/checks/errors/rust-feature-gate.cc b/gcc/rust/checks/errors/rust-feature-gate.cc index f3daa61..44007f9 100644 --- a/gcc/rust/checks/errors/rust-feature-gate.cc +++ b/gcc/rust/checks/errors/rust-feature-gate.cc @@ -40,6 +40,13 @@ FeatureGate::visit (AST::Crate &crate) { if (attr.get_path ().as_string () == "feature") { + // check for empty feature, such as `#![feature], this is an error + if (attr.empty_input ()) + { + rust_error_at (attr.get_locus (), ErrorCode::E0556, + "malformed %<feature%> attribute input"); + continue; + } const auto &attr_input = attr.get_attr_input (); auto type = attr_input.get_attr_input_type (); if (type == AST::AttrInput::AttrInputType::TOKEN_TREE) diff --git a/gcc/rust/checks/errors/rust-feature.cc b/gcc/rust/checks/errors/rust-feature.cc index 25af46c..441a1b2 100644 --- a/gcc/rust/checks/errors/rust-feature.cc +++ b/gcc/rust/checks/errors/rust-feature.cc @@ -55,6 +55,9 @@ Feature::create (Feature::Name f) "1.11.0", 37854); case Feature::Name::PRELUDE_IMPORT: return Feature (f, Feature::State::ACTIVE, "prelude_import", "1.0.0"); + case Feature::Name::MIN_SPECIALIZATION: + return Feature (f, Feature::State::ACTIVE, "min_specialization", + "1.0.0" /* FIXME: What version here? */, 31844); case Feature::Name::AUTO_TRAITS: return Feature (f, Feature::State::ACTIVE, "optin_builtin_traits", "1.0.0", 13231); @@ -80,6 +83,7 @@ const std::map<std::string, Feature::Name> Feature::name_hash_map = { {"raw_ref_op", Feature::Name::RAW_REF_OP}, {"exclusive_range_pattern", Feature::Name::EXCLUSIVE_RANGE_PATTERN}, {"prelude_import", Feature::Name::PRELUDE_IMPORT}, + {"min_specialization", Feature::Name::MIN_SPECIALIZATION}, }; // namespace Rust tl::optional<Feature::Name> diff --git a/gcc/rust/checks/errors/rust-feature.h b/gcc/rust/checks/errors/rust-feature.h index 9edae6d..e7cb0af 100644 --- a/gcc/rust/checks/errors/rust-feature.h +++ b/gcc/rust/checks/errors/rust-feature.h @@ -51,6 +51,7 @@ public: RAW_REF_OP, EXCLUSIVE_RANGE_PATTERN, PRELUDE_IMPORT, + MIN_SPECIALIZATION, }; const std::string &as_string () { return m_name_str; } |