diff options
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r-- | gcc/rust/backend/rust-compile-item.cc | 7 | ||||
-rw-r--r-- | gcc/rust/backend/rust-tree.cc | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/gcc/rust/backend/rust-compile-item.cc b/gcc/rust/backend/rust-compile-item.cc index 96c4e7f..8ba17c9 100644 --- a/gcc/rust/backend/rust-compile-item.cc +++ b/gcc/rust/backend/rust-compile-item.cc @@ -43,13 +43,18 @@ CompileItem::visit (HIR::StaticItem &var) rust_assert (ok); tree type = TyTyResolveCompile::compile (ctx, resolved_type); - tree value = CompileExpr::Compile (var.get_expr (), ctx); const Resolver::CanonicalPath *canonical_path = nullptr; ok = ctx->get_mappings ()->lookup_canonical_path ( var.get_mappings ().get_nodeid (), &canonical_path); rust_assert (ok); + HIR::Expr *const_value_expr = var.get_expr (); + ctx->push_const_context (); + tree value = compile_constant_item (ctx, resolved_type, canonical_path, + const_value_expr, var.get_locus ()); + ctx->pop_const_context (); + std::string name = canonical_path->get (); std::string asm_name = ctx->mangle_item (resolved_type, *canonical_path); diff --git a/gcc/rust/backend/rust-tree.cc b/gcc/rust/backend/rust-tree.cc index f587835..0c393d9 100644 --- a/gcc/rust/backend/rust-tree.cc +++ b/gcc/rust/backend/rust-tree.cc @@ -974,9 +974,10 @@ rs_type_quals (const_tree type) return TYPE_UNQUALIFIED; quals = TYPE_QUALS (type); /* METHOD and REFERENCE_TYPEs should never have quals. */ - gcc_assert ( - (TREE_CODE (type) != METHOD_TYPE && !TYPE_REF_P (type)) - || ((quals & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) == TYPE_UNQUALIFIED)); + // gcc_assert ( + // (TREE_CODE (type) != METHOD_TYPE && !TYPE_REF_P (type)) + // || ((quals & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) == + // TYPE_UNQUALIFIED)); return quals; } |