Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion gcc/rust/Make-lang.in
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ GRS_OBJS = \
rust/rust-cfg-strip.o \
rust/rust-expand-visitor.o \
rust/rust-ast-builder.o \
rust/rust-ast-builder-type.o \
rust/rust-derive.o \
rust/rust-derive-cmp-common.o \
rust/rust-derive-clone.o \
Expand Down
166 changes: 0 additions & 166 deletions gcc/rust/ast/rust-ast-builder-type.cc

This file was deleted.

57 changes: 0 additions & 57 deletions gcc/rust/ast/rust-ast-builder-type.h

This file was deleted.

34 changes: 15 additions & 19 deletions gcc/rust/ast/rust-ast-builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#include "rust-ast-builder.h"
#include "optional.h"
#include "rust-ast-builder-type.h"
#include "rust-ast.h"
#include "rust-common.h"
#include "rust-expr.h"
Expand All @@ -29,7 +28,6 @@
#include "rust-pattern.h"
#include "rust-system.h"
#include "rust-token.h"
#include <memory>

namespace Rust {
namespace AST {
Expand Down Expand Up @@ -552,13 +550,6 @@ Builder::discriminant_value (std::string binding_name, std::string instance)
call (std::move (intrinsic), identifier (instance)));
}

std::unique_ptr<Type>
Builder::new_type (Type &type)
{
Type *t = ASTTypeBuilder::build (type);
return std::unique_ptr<Type> (t);
}

std::unique_ptr<GenericParam>
Builder::new_lifetime_param (LifetimeParam &param)
{
Expand Down Expand Up @@ -596,7 +587,7 @@ Builder::new_type_param (
std::unique_ptr<Type> type = nullptr;

if (param.has_type ())
type = new_type (param.get_type ());
type = param.get_type ().reconstruct ();

for (auto &&extra_bound : extra_bounds)
type_param_bounds.emplace_back (std::move (extra_bound));
Expand Down Expand Up @@ -726,28 +717,33 @@ Builder::new_generic_args (GenericArgs &args)
for (auto &binding : args.get_binding_args ())
{
Type &t = *binding.get_type_ptr ().get ();
std::unique_ptr<Type> ty = new_type (t);
std::unique_ptr<Type> ty = t.reconstruct ();
GenericArgsBinding b (binding.get_identifier (), std::move (ty),
binding.get_locus ());
binding_args.push_back (std::move (b));
}

for (auto &arg : args.get_generic_args ())
{
tl::optional<GenericArg> new_arg = tl::nullopt;

switch (arg.get_kind ())
{
case GenericArg::Kind::Type:
{
std::unique_ptr<Type> ty = new_type (arg.get_type ());
GenericArg arg = GenericArg::create_type (std::move (ty));
}
new_arg = GenericArg::create_type (arg.get_type ().reconstruct ());
break;

default:
// FIXME
rust_unreachable ();
case GenericArg::Kind::Either:
new_arg
= GenericArg::create_ambiguous (arg.get_path (), arg.get_locus ());
break;
case GenericArg::Kind::Const:
new_arg
= GenericArg::create_const (arg.get_expression ().clone_expr ());
// FIXME: Use `reconstruct()` here, not `clone_expr()`
break;
}

generic_args.emplace_back (*new_arg);
}

return GenericArgs (std::move (lifetime_args), std::move (generic_args),
Expand Down
2 changes: 0 additions & 2 deletions gcc/rust/ast/rust-ast-builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,6 @@ class Builder
std::unique_ptr<Stmt> discriminant_value (std::string binding_name,
std::string instance = "self");

static std::unique_ptr<Type> new_type (Type &type);

static std::unique_ptr<GenericParam>
new_lifetime_param (LifetimeParam &param);

Expand Down
Loading
Loading