This commit add a basic implementation to gating `ExternalTypeItem` AST node.
gcc/rust/ChangeLog:
* checks/errors/rust-feature-gate.cc: Add definition
for `extern_types`.
* checks/errors/rust-feature-gate.h: Likewise.
* checks/errors/rust-feature.cc: Likewise.
* checks/errors/rust-feature.h: Likewise.
gcc/testsuite/ChangeLog:
* rust/compile/feature_extern_types.rs:New file.
Signed-off-by: Xiao Ma <mxlol233@outlook.com>
gate (Feature::Name::INTRINSICS, block.get_locus (),
"intrinsics are subject to change");
}
+ for (const auto &item : block.get_extern_items ())
+ {
+ item->accept_vis (*this);
+ }
}
void
check_rustc_attri (function.get_outer_attrs ());
}
+void
+FeatureGate::visit (AST::ExternalTypeItem &item)
+{
+ // TODO(mxlol233): The gating needs a complete visiting chain to activate
+ // `AST::ExternalTypeItem`.
+ gate (Feature::Name::EXTERN_TYPES, item.get_locus (),
+ "extern types are experimental");
+}
+
} // namespace Rust
\ No newline at end of file
void visit (AST::Trait &trait) override {}
void visit (AST::InherentImpl &impl) override;
void visit (AST::TraitImpl &impl) override;
- void visit (AST::ExternalTypeItem &item) override {}
+ void visit (AST::ExternalTypeItem &item) override;
void visit (AST::ExternalStaticItem &item) override {}
void visit (AST::ExternalFunctionItem &item) override {}
void visit (AST::ExternBlock &block) override;
return Feature (Feature::Name::DECL_MACRO, Feature::State::ACCEPTED,
"decl_macro", "1.0.0", 0,
Optional<CompileOptions::Edition>::none (), "");
+ case Feature::Name::EXTERN_TYPES:
+ return Feature (Feature::Name::EXTERN_TYPES, Feature::State::ACTIVE,
+ "extern_types", "1.23.0", 43467,
+ Optional<CompileOptions::Edition>::none (), "");
default:
gcc_unreachable ();
}
// TODO: Rename to "auto_traits" when supporting
// later Rust versions
{"optin_builtin_traits", Feature::Name::AUTO_TRAITS},
+ {"extern_types", Feature::Name::EXTERN_TYPES},
}; // namespace Rust
Optional<Feature::Name>
RUSTC_ATTRS,
DECL_MACRO,
AUTO_TRAITS,
+ EXTERN_TYPES,
};
const std::string &as_string () { return m_name_str; }
--- /dev/null
+extern "C" {
+ type F; //{ dg-error "extern types are experimental." "" { target *-*-* } }
+}
+
+
+fn main() {
+
+}