Commit 9ee5b51 1 parent 8e3c34a commit 9ee5b51 Copy full SHA for 9ee5b51
File tree 2 files changed +16
-3
lines changed
2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 22
22
#include " rust-ast-lower-base.h"
23
23
#include " rust-ast-lower-type.h"
24
24
#include " rust-ast-lower.h"
25
+ #include " rust-hir-full-decls.h"
25
26
26
27
namespace Rust {
27
28
namespace HIR {
@@ -116,7 +117,13 @@ class ASTLoweringExternItem : public ASTLoweringBase
116
117
117
118
void visit (AST::ExternalTypeItem &type) override
118
119
{
119
- rust_sorry_at (type.get_locus (), " extern types are not implemented yet" );
120
+ auto crate_num = mappings->get_current_crate ();
121
+ Analysis::NodeMapping mapping (crate_num, type.get_node_id (),
122
+ mappings->get_next_hir_id (crate_num),
123
+ mappings->get_next_localdef_id (crate_num));
124
+
125
+ translated = new HIR::ExternalTypeItem (mapping, type.get_identifier (),
126
+ type.get_locus ());
120
127
}
121
128
122
129
private:
Original file line number Diff line number Diff line change @@ -3152,16 +3152,20 @@ class ExternalFunctionItem : public ExternalItem
3152
3152
3153
3153
class ExternalTypeItem : public ExternalItem
3154
3154
{
3155
+ public:
3155
3156
ExternalTypeItem (Analysis::NodeMapping mappings, Identifier item_name,
3156
- Visibility vis, AST::AttrVec outer_attrs, location_t locus)
3157
+ location_t locus)
3157
3158
: ExternalItem (std::move (mappings), std::move (item_name),
3158
- std::move (vis), std::move (outer_attrs), locus)
3159
+ Visibility (Visibility::PRIVATE),
3160
+ /* FIXME: Is that correct? */
3161
+ {}, locus)
3159
3162
{}
3160
3163
3161
3164
ExternalTypeItem (ExternalTypeItem const &other) : ExternalItem (other) {}
3162
3165
3163
3166
ExternalTypeItem (ExternalTypeItem &&other) = default ;
3164
3167
ExternalTypeItem &operator = (ExternalTypeItem &&other) = default ;
3168
+ ExternalTypeItem &operator = (ExternalTypeItem const &other) = default ;
3165
3169
3166
3170
std::string as_string () const override ;
3167
3171
@@ -3171,6 +3175,8 @@ class ExternalTypeItem : public ExternalItem
3171
3175
ExternKind get_extern_kind () override { return ExternKind::Type; }
3172
3176
3173
3177
protected:
3178
+ /* Use covariance to implement clone function as returning this object
3179
+ * rather than base */
3174
3180
ExternalTypeItem *clone_external_item_impl () const override
3175
3181
{
3176
3182
return new ExternalTypeItem (*this );
You can’t perform that action at this time.
0 commit comments