blob: f103c7e69a0022c6b16eb671d378161949ce527c [file] [log] [blame]
2025-07-25 David Malcolm <dmalcolm@redhat.com>
* resolve/rust-ice-finalizer.cc: Update usage of "diagnostic_info"
to explicitly refer to "diagnostics::diagnostic_info".
* resolve/rust-ice-finalizer.h: Likewise.
2025-07-25 David Malcolm <dmalcolm@redhat.com>
* backend/rust-tree.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* backend/rust-tree.h: Likewise.
* resolve/rust-ast-resolve-expr.cc: Likewise.
* resolve/rust-ice-finalizer.cc: Likewise.
* resolve/rust-ice-finalizer.h: Likewise.
* resolve/rust-late-name-resolver-2.0.cc: Likewise.
2025-07-25 David Malcolm <dmalcolm@redhat.com>
* resolve/rust-ast-resolve-expr.cc: Update for diagnostic_text_finalizer
becoming diagnostics::text_finalizer.
* resolve/rust-late-name-resolver-2.0.cc: Likewise.
2025-07-25 David Malcolm <dmalcolm@redhat.com>
* resolve/rust-ice-finalizer.cc: Update for move of diagnostics
output formats into namespace "diagnostics" as "sinks".
* resolve/rust-ice-finalizer.h: Likewise.
2025-07-25 David Malcolm <dmalcolm@redhat.com>
* rust-diagnostics.cc: Update #include for move of
"diagnostic-metadata.h" to "diagnostics/metadata.h", and update
for move of diagnostic_metadata to diagnostics::metadata.
2025-06-26 Martin Jambor <mjambor@suse.cz>
* checks/errors/borrowck/rust-borrow-checker-diagnostics.cc
(BorrowCheckerDiagnostics::get_loan): Type cast loan to uint32_t.
2025-04-28 Owen Avery <powerboat9.gamer@gmail.com>
* checks/errors/borrowck/rust-bir-place.h
(IndexVec::size_type): Add.
(IndexVec::MAX_INDEX): Add.
(IndexVec::size): Change the return type to the type of the
internal value used by the index type.
(PlaceDB::lookup_or_add_variable): Use the return value from the
PlaceDB::add_place call.
* checks/errors/borrowck/rust-bir.h
(struct BasicBlockId): Move this definition before the
definition of the struct Function.
2025-04-28 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Visit visibility.
2025-04-28 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): Visit the loop labels of
WhileLetLoopExpr instances before visiting their scrutinee
expressions.
* resolve/rust-early-name-resolver-2.0.cc
(Early::resolve_glob_import): Pass the glob import's path
directly to NameResolutionContext::resolve_path.
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Remove unnecessary call to
Identifier::as_string.
(flatten_glob): Improve handling of cases where a glob use tree
has no path.
2025-04-28 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-derive-clone.cc (DeriveClone::clone_enum_struct): Clone
path to avoid using the same nodeid.
2025-04-28 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit_function_params):
Add specialized function to visit function parameters.
(DefaultASTVisitor::visit): Remove parameter visit and call specialized
function instead.
* ast/rust-ast-visitor.h: Add function prototye.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Remove
function.
(Late::visit_function_params): Override specialized visit function.
* resolve/rust-late-name-resolver-2.0.h: Add overriden function
prototype.
2025-04-28 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-name-resolution-context.h: Use BindingLayer instead.
* resolve/rust-name-resolution-context.cc (BindingLayer::BindingLayer):
Add new constructor for binding layer.
(BindingLayer::bind_test): Add a function to test a binding constraint.
(BindingLayer::push): Push a new binding group.
(BindingLayer::and_binded): Add function to test and-binding
constraint.
(BindingLayer::or_binded): Add function to test or-binding constraints.
(BindingLayer::insert_ident): Insert a new identifier in the current
binding group.
(BindingLayer::merge): Merge current binding group with it's parent.
(BindingLayer::get_source): Get the source of the current binding
group.
* resolve/rust-late-name-resolver-2.0.cc: Use stacked context for
binding group.
* util/rust-stacked-contexts.h: Add mutable peek function.
2025-04-28 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add binding
creation in visitor.
* resolve/rust-late-name-resolver-2.0.h: Add function prototypes.
* resolve/rust-name-resolution-context.h: Add binding context.
2025-04-28 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-name-resolution-context.h (struct Binding): Add Binding
struct to differentiate Or and Product bindings in patterns.
(enum class): Add Binding kind.
(class BindingContext): Add binding context with Binding stack.
2025-04-28 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h: Add hash function.
2025-04-28 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h: Add equality operator.
2025-04-28 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Add visit
function for TypeParam.
* resolve/rust-default-resolver.h: Add function prototype.
* resolve/rust-forever-stack.h: Add function to check for forward
declaration ban.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Check forward
declarations.
2025-04-28 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Remove error kind
and change function call.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Change call name.
* ast/rust-path.cc (ConstGenericParam::as_string): Likewise.
* ast/rust-path.h: Remove error kind.
* hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit): Change call
name.
* parse/rust-parse-impl.h (Parser::parse_generic_param): Use optional
on parsing failure.
(Parser::parse_generic_arg): Likewise.
(Parser::parse_path_generic_args): Likewise.
* parse/rust-parse.h: Likewise.
* resolve/rust-ast-resolve-type.h: Change call name.
2025-04-28 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Change error
message.
2025-04-28 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-early-name-resolver-2.0.cc
(Early::build_import_mapping): Avoid outputting an "unresolved
import" error if other errors are outputted during resolution.
* resolve/rust-early-name-resolver-2.0.h
(Early::resolve_path_in_all_ns): Collect path resolution errors
while avoiding duplicate errors for resolutions in each
namespace.
* resolve/rust-forever-stack.h
(ForeverStack::resolve_path): Add parameter for collecting
errors.
(ForeverStack::find_starting_point): Likewise.
(ForeverStack::resolve_segments): Likewise.
* resolve/rust-forever-stack.hxx
(check_leading_kw_at_start): Likewise.
(ForeverStack::find_starting_point): Likewise.
(ForeverStack::resolve_segments): Likewise.
(ForeverStack::resolve_path): Likewise.
* resolve/rust-name-resolution-context.h
(NameResolutionContext::resolve_path): Add optional parameter
for collecting errors.
2025-04-28 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (CompileExpr::array_copied_expr): prealloc the vector
2025-04-28 Philip Herron <herron.philip@googlemail.com>
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): add guard
* expand/rust-expand-visitor.cc (ExpandVisitor::visit): add guard
2025-04-28 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-ast-resolve-path.cc
(ResolvePath::resolve_path): Adjust error messages.
* resolve/rust-ast-resolve-type.cc
(ResolveRelativeTypePath::go): Likewise.
* resolve/rust-forever-stack.hxx
(check_leading_kw_at_start): Likewise.
2025-04-28 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): fix bad assertion
2025-04-28 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-forever-stack.hxx
(ForeverStack::resolve_path): Pass instance of Node to lambda by
reference instead of by value.
2025-04-28 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-struct-field.h: keep reference to parent expression
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::TypeCheckStructExpr):
update ctor
(TypeCheckStructExpr::resolve): remove bad rust_fatal_errors
(TypeCheckStructExpr::visit): cleanup errors
2025-04-28 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Handle StructPatternFieldIdent.
* resolve/rust-late-name-resolver-2.0.h
(Late::visit): Likewise.
2025-04-28 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Dump llvm inline
asm tokens.
2025-04-28 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Remove unreachable
code.
* ast/rust-expr.h (struct LlvmOperand): Add LlvmOperand struct to
represent input and outputs.
(class LlvmInlineAsm): Add input, output and clobber operands.
(struct TupleTemplateStr): Add locus getter.
* backend/rust-compile-block.h: Add visit for LlvmInlineAsm.
* backend/rust-compile-expr.cc (CompileExpr::visit): Add llvm inline
asm stmt compilation.
* backend/rust-compile-expr.h: Add function prototype.
* backend/rust-compile-asm.h (class CompileLlvmAsm): Add llvm asm hir
not to gimple.
* backend/rust-compile-asm.cc (CompileLlvmAsm::CompileLlvmAsm): Add
constructor.
(CompileLlvmAsm::construct_operands): Add function to construct operand
tree.
(CompileLlvmAsm::construct_clobbers): Add function to construct clobber
tree.
(CompileLlvmAsm::tree_codegen_asm): Generate the whole tree for a given
llvm inline assembly node.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
Add visit function.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.h: Add function
prototype.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Add visit
function.
* checks/errors/borrowck/rust-bir-builder-struct.h: Likewise.
* checks/errors/borrowck/rust-function-collector.h: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit):
Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Add visit function
prototype.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Add visit
function.
* checks/errors/rust-const-checker.h: Add visit function prototype.
* checks/errors/rust-hir-pattern-analysis.cc (PatternChecker::visit):
Add visit function.
* checks/errors/rust-hir-pattern-analysis.h: Add visit function
prototype.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Add
visit function.
* checks/errors/rust-unsafe-checker.h: Add function prototype.
* expand/rust-macro-builtins-asm.cc (parse_llvm_templates): Parse
templates.
(parse_llvm_arguments): Add function to parse non template tokens.
(parse_llvm_operands): Add function to parse operands, either input or
output.
(parse_llvm_outputs): Add function to parse and collect llvm asm
outputs.
(parse_llvm_inputs): Likewise with inputs.
(parse_llvm_clobbers): Add function to parse llvm asm clobbers.
(parse_llvm_options): Add function to parse llvm asm options.
(parse_llvm_asm): Add function to parse llvm asm.
* expand/rust-macro-builtins-asm.h (class LlvmAsmContext): Add context
for llvm asm parser.
(parse_llvm_outputs): Add function prototype.
(parse_llvm_inputs): Likewise.
(parse_llvm_clobbers): Likewise.
(parse_llvm_options): Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Lower AST llvm
asm node to HIR.
* hir/rust-ast-lower-expr.h: Add function prototype.
* hir/rust-hir-dump.cc (Dump::visit): Add visit function.
* hir/rust-hir-dump.h: Add function prototype.
* hir/tree/rust-hir-expr-abstract.h: Add HIR llvm asm node kind.
* hir/tree/rust-hir-expr.h (struct LlvmOperand): Add LlvmOperand type
to represent input and outputs.
(class LlvmInlineAsm): Add LlvmInlineAsm hir node.
* hir/tree/rust-hir-full-decls.h (class LlvmInlineAsm): Add
LlvmInlineAsm hir node forward declaration.
* hir/tree/rust-hir-visitor.h: Add visit functions for LlvmInlineAsm
hir node.
* hir/tree/rust-hir.cc (LlvmInlineAsm::accept_vis): Add hir node
visitor related functions.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Type check input and output operands.
* typecheck/rust-hir-type-check-expr.h: Add function prototype.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Visit input and
output operand expressions.
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Resolve input
and output expressions.
* resolve/rust-ast-resolve-expr.h: Add function prototypes.
2025-04-28 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Make visitor
unreachable.
* ast/rust-ast-collector.h: Add visit for LlvmInlineAsmNode.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Add visit
function for the default ast visitor.
* ast/rust-ast-visitor.h: Add function prototype.
* ast/rust-ast.cc (LlvmInlineAsm::accept_vis): Add accept_vis to
LlvmInlineAsm node.
* ast/rust-ast.h: Add LlvmInlineAsm node kind.
* ast/rust-expr.h (class LlvmInlineAsm): Add LlvmInlineAsm node.
* expand/rust-derive.h: Add visit function for LlvmInlineAsm node.
* expand/rust-macro-builtins-asm.cc (MacroBuiltin::llvm_asm_handler):
Add handler for llvm inline assembly nodes.
(parse_llvm_asm): Add function to parse llvm assembly nodes.
* expand/rust-macro-builtins-asm.h (parse_llvm_asm): Add function
prototypes.
* expand/rust-macro-builtins.cc (inline_llvm_asm_maker): Add macro
transcriber.
* expand/rust-macro-builtins.h: Add transcriber function prototype.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Add visit
function for LlvmInlineAsm node.
* hir/rust-ast-lower-base.h: Add visit function prototype.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Add visit
function for LlvmInlineAsm node.
* resolve/rust-ast-resolve-base.h: Add visit function prototype.
2025-04-28 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-macro-builtins-asm.cc (parse_asm_arg): Emit error
message.
2025-04-28 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): add diagnostic
* typecheck/rust-tyty.cc (BaseType::contains_infer): new helper to grab first infer var
* typecheck/rust-tyty.h: prototype
2025-04-28 Philip Herron <herron.philip@googlemail.com>
* rust-gcc.cc (arithmetic_or_logical_expression): Ensure this is an integer
2025-04-28 Philip Herron <herron.philip@googlemail.com>
* hir/rust-hir-dump.cc (Dump::visit): add guard for optional label
2025-04-28 Yap Zhi Heng <yapzhhg@gmail.com>
* typecheck/rust-tyty.h: Remove extra redundant comment.
* typecheck/rust-hir-type-check-base.cc: Update comment on repr
handling.
2025-04-28 Zhi Heng <yapzhhg@gmail.com>
* typecheck/rust-hir-type-check-base.cc: Set enum representing
type properly if repr is an integer type.
* typecheck/rust-hir-type-check-item.cc: Update comments.
2025-04-28 Zhi Heng <yapzhhg@gmail.com>
* typecheck/rust-tyty.h: Add new `ReprKind` enum to
`ReprOptions`.
* typecheck/rust-hir-type-check-base.cc: Handle setting of
`repr_kind`.
* typecheck/rust-hir-type-check-item.cc: New check for
zero-variant enums.
2025-04-28 Philip Herron <herron.philip@googlemail.com>
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): add null check
* hir/tree/rust-hir-item.h: add has_type helper
* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
add missing type checking
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-lang-item.h: Add new manually_drop lang item.
* util/rust-lang-item.cc: Likewise.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-attribute-values.h: Add RUSTFMT value.
* util/rust-attributes.cc: Define the attribute.
* util/rust-attributes.h (enum CompilerPass): Add EXTERNAL variant.
* expand/rust-macro-builtins.cc: Fix formatting.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes): Remove assertion.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-attribute-values.h: Add missing attributes.
* util/rust-attributes.cc: Likewise.
* util/rust-attributes.h (enum CompilerPass): Mention adding something for const
functions.
2025-04-14 beamandala <mandalapubhavesh@gmail.com>
* expand/rust-macro-builtins.cc (MacroBuiltin::builtin_transcribers):
Add entry for track_caller.
* util/rust-attribute-values.h: add `TRACK_CALLER` attribute.
* util/rust-attributes.cc: add `track_caller` attribute definition.
2025-04-14 Owen Avery <powerboat9.gamer@gmail.com>
* checks/errors/rust-const-checker.cc
(ConstChecker::visit): Visit the enum items of enums.
* resolve/rust-ast-resolve-item.cc
(ResolveItem::visit): Resolve enum discriminants during nr1.0.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-builtins-format-args.cc (format_args_parse_arguments): Improve safety,
allow extra commas after end of argument list.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Call into
TokenTreeDesugar.
* expand/rust-token-tree-desugar.cc: New file.
* expand/rust-token-tree-desugar.h: New file.
* Make-lang.in: Compile them.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-expand.cc (MacroExpander::match_n_matches): Do not
insert fragments and substack fragments if the matcher failed.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-session-manager.cc (Session::compile_crate): Call the visitor later in the pipeline.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.h (DelimTokenTree::get_locus): New function.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-expr.h (class RangeExpr): Add empty outer attributes and allow getting them
and setting them.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Return if module
is unloaded.
2025-04-14 Arthur Cohen <arthur.cohen@embecosm.com>
* typecheck/rust-hir-type-check-expr.cc (is_default_fn): New.
(emit_ambiguous_resolution_error): New.
(handle_multiple_candidates): Properly handle multiple candidates in
the case of specialization.
(TypeCheckExpr::visit): Call `handle_multiple_candidates`.
2025-04-14 Andrew Pinski <quic_apinski@quicinc.com>
PR rust/119342
* rust-gcc.cc (block): Add comment on why chaining
the variables of the scope toether.
2025-04-14 Andrew Pinski <quic_apinski@quicinc.com>
PR rust/119341
* rust-gcc.cc (function_type): Use range fors.
(function_type_variadic): Likewise.
(fill_in_fields): Likewise.
(statement_list): Likewise.
(block): Likewise.
(block_add_statements): Likewise.
(function_set_parameters): Likewise.
(write_global_definitions): Likewise.
2025-04-14 Andrew Pinski <quic_apinski@quicinc.com>
* rust-gcc.cc (Bvariable::get_tree): Use error_operand_p.
(pointer_type): Likewise.
(reference_type): Likewise.
(immutable_type): Likewise.
(function_type): Likewise.
(function_type_variadic): Likewise.
Cleanup the check for receiver.type first.
(function_ptr_type): Use error_operand_p.
(fill_in_fields): Likewise.
(fill_in_array): Likewise.
(named_type): Likewise.
(type_size): Likewise.
(type_alignment): Likewise.
(type_field_alignment): Likewise.
(type_field_offset): Likewise.
(zero_expression): Likewise.
(float_constant_expression): Likewise.
(convert_expression): Likewise.
(struct_field_expression): Likewise.
(compound_expression): Likewise.
(conditional_expression): Likewise.
(negation_expression): Likewise.
(arithmetic_or_logical_expression): Likewise.
(arithmetic_or_logical_expression_checked): Likewise.
(comparison_expression): Likewise.
(lazy_boolean_expression): Likewise.
(constructor_expression): Likewise.
(array_constructor_expression): Likewise.
(array_index_expression): Likewise.
(call_expression): Likewise.
(init_statement): Likewise.
(assignment_statement): Likewise.
(return_statement): Likewise.
(exception_handler_statement): Likewise.
(if_statement): Likewise.
(compound_statement): Likewise.
Tighten up the code, removing t variable.
(statement_list): Use error_operand_p.
(block): Likewise.
(block_add_statements): Likewise.
(convert_tree): Likewise.
(global_variable): Likewise.
(global_variable_set_init): Likewise.
(local_variable): Likewise.
(parameter_variable): Likewise.
(static_chain_variable): Likewise.
(temporary_variable): Likewise.
(function): Likewise. Tighten up the code.
(function_defer_statement): Use error_operand_p.
(function_set_parameters): Use error_operand_p.
(write_global_definitions): Use error_operand_p.
Tighten up the code around the loop.
2025-04-14 Andrew Pinski <quic_apinski@quicinc.com>
* rust-gcc.cc (is_floating_point): Use FLOAT_TYPE_P
instead of manually checking the type.
2025-04-08 Matty Kuhn <matty.kuhn.1@gmail.com>
* ast/rust-ast.h: (AST::Attribute): add empty_input function
* checks/errors/rust-feature-gate.cc: (FeatureGate::visit): check for empty feature gate
2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Update label
getter call.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast.cc (BreakExpr::as_string): Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Likewise.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Likewise.
* ast/rust-expr.h: Add optional getter and rename label getter to
get_label_unchecked.
2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit):
Call unchecked getter.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit):
Likewise.
* ast/rust-ast.cc (ContinueExpr::as_string): Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Likewise.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Likewise.
* ast/rust-expr.h: Add new getter for the optional and rename getter
to get_label_unchecked.
2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_loop_label): Change function
return type to expected.
(Parser::parse_labelled_loop_expr): Adapt call location to new return
type.
* parse/rust-parse.h (enum class): Update function prototype.
2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add call
to label resolution if there is one label.
(Late::resolve_label): Look for labels and emit an error message on
failure.
* resolve/rust-late-name-resolver-2.0.h: Add function prototypes.
2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit):
Change error message to match rustc.
2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-builder.cc (Builder::self_ref_param): Remove error state
and use optional.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Check label
before visiting.
* ast/rust-ast.cc (ContinueExpr::as_string): Retrieve label value.
(Lifetime::as_string): Retrieve lifetime value.
(ReferenceType::as_string): Likewise.
(SelfParam::as_string): Likewise.
* ast/rust-ast.h: Remove lifetime and LifetimeParam error state.
* ast/rust-desugar-for-loops.cc (DesugarForLoops::DesugarCtx::make_break_arm):
Use optional instead of error state.
* ast/rust-expr.h (class ContinueExpr): Make label optional.
* ast/rust-item.h (class SelfParam): Make lifetime optional.
* ast/rust-type.h (class ReferenceType): Likewise.
* backend/rust-compile-base.cc: Use optional for self param instead
of error state.
* backend/rust-compile-base.h: Update function prototype.
* expand/rust-derive-clone.cc (DeriveClone::clone_fn): Use optional.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_self): Lower
lifetime only if it exists.
* hir/rust-ast-lower-block.h: Lower loop label only if it exists.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-implitem.cc (ASTLowerImplItem::visit): Remove
references to error state.
(ASTLowerTraitItem::visit): Lower self param only if it exists.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Use nullopt
for default value instead of SelfParam error state.
* hir/rust-ast-lower.cc (ASTLoweringExprWithBlock::visit): Lower label
only if it exists.
* hir/rust-hir-dump.cc (Dump::do_traitfunctiondecl): Print self only if
it exists.
(Dump::visit): Liewise.
* hir/tree/rust-hir-bound.h: Remove error state.
* hir/tree/rust-hir-expr.cc (ContinueExpr::ContinueExpr): Use optional
in constructor for loop label.
(BreakExpr::BreakExpr): Likewise.
* hir/tree/rust-hir-expr.h (class ContinueExpr): Remove error state
implementation.
(class BreakExpr): Likewise.
* hir/tree/rust-hir-generic-param.h: Likewise.
* hir/tree/rust-hir-item.cc (SelfParam::SelfParam): Make lifetime
optional.
(Function::Function): Make self param optional.
* hir/tree/rust-hir-item.h (class Function): Likewise.
* hir/tree/rust-hir-type.cc (ReferenceType::ReferenceType): Make
lifetime optional.
* hir/tree/rust-hir-type.h (class ReferenceType): Likewise.
* hir/tree/rust-hir.cc (ContinueExpr::as_string): Use new getter.
(BreakExpr::as_string): Likewise.
(Lifetime::as_string): Likewise.
(ReferenceType::as_string): Likewise.
(TraitFunctionDecl::as_string): Likewise.
(SelfParam::as_string): Remove error state checking.
* parse/rust-parse-impl.h (Parser::parse_generic_param): Adapt to
optional.
(Parser::parse_lifetime_params): Likewise.
(Parser::parse_lifetime_params_objs): Likewise.
(Parser::parse_lifetime_param): Likewise.
(Parser::parse_lifetime_where_clause_item): Likewise.
(Parser::parse_type_param_bound): Likewise.
(Parser::parse_lifetime_bounds): Likewise.
(Parser::parse_path_generic_args): Likewise.
(Parser::parse_self_param): Likewise.
(Parser::parse_break_expr): Likewise.
(Parser::parse_continue_expr): Likewise.
(Parser::parse_reference_type_inner): Likewise.
* parse/rust-parse.h (class ParseLifetimeParamError): Add new class for
lifetime param parsing errors.
(class ParseLifetimeError): Add new class for lifetime parsing errors.
(enum ParseSelfError): Add new class for self param parsing errors.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit):
Use unchecked getter in checked context. And make anonymous region.
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn):
Likewise.
2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Add
check for loop label before visiting it.
2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-expr.h: Remove error getter and constructor.
2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-builder.cc (Builder::block): Call with a nullopt instead
of an error loop label.
(WhileLetLoopExpr::as_string): Use getter function and adapt to
newtype.
* ast/rust-ast.cc (WhileLoopExpr::as_string): Likewise.
(LoopExpr::as_string): Likewise.
(BreakExpr::as_string): Likewise.
(ForLoopExpr::as_string): Likewise.
* ast/rust-expr.h (class BlockExpr): Make loop label optional.
(class BreakExpr): Likewise.
* expand/rust-derive-clone.cc (DeriveClone::clone_fn): Use nullopt.
* expand/rust-derive-debug.cc (DeriveDebug::stub_debug_fn): Likewise.
* expand/rust-derive-default.cc (DeriveDefault::default_fn): Likewise.
* expand/rust-derive-eq.cc: Likewise.
* parse/rust-parse-impl.h (Parser::parse_block_expr): Use optional
for arguments.
(Parser::parse_loop_expr): Likewise.
(Parser::parse_while_loop_expr): Likewise.
(Parser::parse_while_let_loop_expr): Likewise.
(Parser::parse_for_loop_expr): Likewise.
(Parser::parse_labelled_loop_expr): Likewise.
(Parser::parse_loop_label): Return an optional.
* parse/rust-parse.h: Update function prototype and use nullopt for
default values.
2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Change default
visit order.
2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Visit loop label
only if it exists.
2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* hir/rust-ast-lower.cc (ASTLoweringBlock::visit): Lower label only if
it exists.
* hir/tree/rust-hir-expr.cc (BlockExpr::BlockExpr): Make loop label
optional.
(BaseLoopExpr::BaseLoopExpr): Likewise.
(LoopExpr::LoopExpr): Likewise.
(WhileLoopExpr::WhileLoopExpr): Likewise.
* hir/tree/rust-hir-expr.h: Use optional for lifetime and labels.
* hir/tree/rust-hir.cc (WhileLoopExpr::as_string): Use getter.
(WhileLetLoopExpr::as_string): Likewise.
(LoopExpr::as_string): Likewise.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Resolve labels.
* resolve/rust-late-name-resolver-2.0.h: Add visit function prototype
for loop labels.
2025-04-08 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/expected.h: Use gcc_unreachable within gcc context.
2025-04-08 Sri Ganesh Thota <sriganeshthota12345@gmail.com>
* resolve/rust-ast-resolve-base.h (redefined_error): created a function for
rust_error_at for redefined at multiple times.
* resolve/rust-ast-resolve-implitem.h: changed rust_error_at to redefined_error.
* resolve/rust-ast-resolve-stmt.cc (ResolveStmt::visit): changed rust_error_at to
redefined_error.
* resolve/rust-ast-resolve-stmt.h: changed rust_error_at to redefined_error.
* resolve/rust-ast-resolve-toplevel.h: changed rust_error_at to redefined_error.
2025-04-08 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): Remove explicit visitation of a
function's self parameter, as if it exists it'll be visited as
one of the function parameters.
2025-04-08 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-typecheck-context.cc (TypeCheckContext::lookup_lifetime): emit error
2025-04-08 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.cc (Function::Function): Rename is_default -> has_default.
(Function::operator=): Likewise.
* ast/rust-item.h (class Function): Add `is_default` method.
* hir/rust-ast-lower-implitem.cc (ASTLowerImplItem::visit): Lower default qualifier.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Likewise.
* hir/tree/rust-hir-item.cc (Function::Function): Add `is_default` member.
(Function::operator=): Likewise.
* hir/tree/rust-hir-item.h (enum class Defaultness): New enum.
(class Function): Use it.
2025-04-08 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/errors/rust-feature.cc (Feature::create): Handle `#![feature(min_specialization)]`.
* checks/errors/rust-feature.h: Likewise.
2025-04-08 Philip Herron <herron.philip@googlemail.com>
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): fix error msg
* typecheck/rust-substitution-mapper.cc (SubstMapper::Resolve): add validation
(SubstMapper::valid_type): new check
(SubstMapper::visit): check if can resolve
* typecheck/rust-substitution-mapper.h: new prototype
2025-04-08 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.cc (HIRCompileBase::address_expression): allow optional type
* backend/rust-compile-base.h: update prototype
* backend/rust-compile-expr.cc (CompileExpr::visit): update borrow expr
* backend/rust-compile-extern.h: remove unused debug
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): update usage
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): lower raw ref
* hir/tree/rust-hir-expr.cc (BorrowExpr::BorrowExpr): add flag for raw ref
* hir/tree/rust-hir-expr.h (class BorrowExpr): add new raw ref field
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): add handle for raw ref
2025-04-08 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): emit error
2025-04-08 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): new argument
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::TypeCheckBase): new helper
* typecheck/rust-hir-type-check-base.h: new helper prototype
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit):
remove comment out code
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path): check for null
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): likewise
(TypeResolveGenericParam::Resolve): new args
(TypeResolveGenericParam::ApplyAnyTraitBounds): new helper
(TypeResolveGenericParam::apply_trait_bounds): new field
(TypeResolveGenericParam::visit): update
* typecheck/rust-hir-type-check-type.h: new args
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): reuse helper
* typecheck/rust-type-util.cc (query_type): check for recursive query
* typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::SubstitutionParamMapping):
remove const
(SubstitutionParamMapping::get_generic_param): likewise
* typecheck/rust-tyty-subst.h: likewise
* typecheck/rust-tyty-variance-analysis.cc (GenericTyVisitorCtx::process_type): likewise
2025-04-08 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.cc: new flag is_root_item
* backend/rust-compile-base.h: update prototype
* backend/rust-compile-implitem.cc (CompileTraitItem::visit): update call
* backend/rust-compile-implitem.h: remove old debug internal error
* backend/rust-compile-item.cc (CompileItem::visit): update call
* backend/rust-compile-item.h: remove old debug
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): update calls
* backend/rust-compile.cc: likewise
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait):
remove assertion and error
2025-04-08 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-base.cc: remove assertion
2025-04-08 Philip Herron <herron.philip@googlemail.com>
* rust-gcc.cc (arithmetic_or_logical_expression): unwrap const decls
2025-04-08 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-forever-stack.h
(ForeverStack::ForeverStack): Initialize extern_prelude.
(ForeverStack::resolve_path): Add parameter
has_opening_scope_resolution.
(ForeverStack::extern_prelude): Add field.
* resolve/rust-forever-stack.hxx: Include rust-edition.h.
(ForeverStacl::resolve_path): Handle global paths (paths with an
opening scope resolution operator).
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Handle global paths.
* resolve/rust-name-resolution-context.h
(NameResolutionContext::resolve_path): Handle global paths.
2025-04-08 Ryutaro Okada <1015ryu88@gmail.com>
* backend/rust-compile-resolve-path.cc: Evaluate the enum's discriminant in a const context
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
catch nullptr root_tyty
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::parse_repr_options):
check for null and empty and add missing delete call
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty-subst.h: check for min range
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::parse_repr_options): check for input
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* hir/rust-hir-dump.cc (Dump::visit): check has type
* hir/tree/rust-hir-type.cc (BareFunctionType::BareFunctionType): likewise
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* backend/rust-constexpr.cc (eval_store_expression): turn this back on
2025-03-31 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-builtins-log-debug.cc:
Add newline to end of file.
2025-03-31 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-forever-stack.h
(ForeverStack::get_prelude): Rename to...
(ForeverStack::get_lang_prelude): ...here.
(ForeverStack::prelude): Rename to...
(ForeverStack::lang_prelude): ...here.
(ForeverStack::ForeverStack): Handle renames.
* resolve/rust-forever-stack.hxx
(ForeverStack::push_inner): Likewise.
(ForeverStack::resolve_segments): Likewise.
(ForeverStack::resolve_path): Likewise.
(ForeverStack::get_prelude): Rename to...
(ForeverStack::get_lang_prelude): ...here and handle renames.
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Handle renames.
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-context.h: only push named types
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): run the type hasher
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): check for Expr trait
* hir/rust-hir-dump.cc (Dump::visit): expr is optional
2025-03-31 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-forever-stack.hxx: Add a new specialized function
to retrieve the last "real" segment depending on the namespace.
* resolve/rust-forever-stack.h: Add new function prototype.
* resolve/rust-early-name-resolver-2.0.cc (Early::finalize_rebind_import):
Set declared name according to the selected segment, if there is a self
suffix in the use declaration then select the previous segment.
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.cc (HIRCompileBase::unit_expression): pass ctx
* backend/rust-compile-base.h: cant be static
* backend/rust-compile-intrinsic.cc (try_handler_inner): pass ctx
* backend/rust-compile-type.cc
(TyTyResolveCompile::get_unit_type): update to grab the first locus
(TyTyResolveCompile::visit): pass ctx
* backend/rust-compile-type.h: likewise
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-dot-operator.cc:
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): check for super mid path
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.cc (HIRCompileBase::address_expression): new helper constexpr
* backend/rust-compile-base.h: prototype
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): call constexpr helper
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::resolve_impl_block_substitutions):
Track the polarity
* typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::validate_type_implements_this):
new validator
* typecheck/rust-tyty.h: new prototypes
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (CompileExpr::array_value_expr): add value chk for array expr
2025-03-31 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-reference.h: add default infer arg
* typecheck/rust-hir-trait-resolve.cc: dont add new infer vars
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): dont infer
2025-03-31 Owen Avery <powerboat9.gamer@gmail.com>
* checks/errors/rust-ast-validation.cc
(ASTValidation::visit): Allow constant items lacking expressions
if and only if they're associated with a trait definition, not a
trait implementation.
2025-03-31 Owen Avery <powerboat9.gamer@gmail.com>
* hir/rust-ast-lower-base.cc
(ASTLoweringBase::lower_literal): Lower raw string literals into
normal string literals.
2025-03-31 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/errors/borrowck/ffi-polonius/Cargo.lock: Regenerate.
* checks/errors/borrowck/ffi-polonius/Cargo.toml: Update to use source patching instead of
vendoring, lower edition to 2018.
* checks/errors/borrowck/ffi-polonius/vendor/log/Cargo.toml: Change edition to 2018.
* checks/errors/borrowck/ffi-polonius/vendor/log/src/lib.rs: Remove uses of unstable
feature.
* checks/errors/borrowck/ffi-polonius/.cargo/config.toml: Removed.
2025-03-31 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/tree/rust-hir-stmt.h (class LetStmt): Add optional diverging else expression.
* hir/tree/rust-hir-stmt.cc: Likewise.
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Add handling for lowering
diverging else.
2025-03-31 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-ast-resolve-stmt.h: Add handling for diverging else.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Likewise.
2025-03-31 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Add handling for diverging else
expression.
2025-03-31 Arthur Cohen <arthur.cohen@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_let_stmt): Add new parsing in case of `else` token.
2025-03-31 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-stmt.h (class LetStmt): Add optional expression for diverging else.
* ast/rust-ast-builder.cc (Builder::let): Use new API.
2025-03-26 Iain Sandoe <iain@sandoe.co.uk>
* metadata/rust-export-metadata.cc
(PublicInterface::write_to_path): Use 'lbasename()' instead of
'basename()'.
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-path-probe.cc: update call
* typecheck/rust-hir-trait-reference.cc (TraitReference::lookup_trait_item): track predicate
(TraitReference::is_equal): likewise
(TraitReference::is_object_safe): likewise
(TraitReference::satisfies_bound): likewise
* typecheck/rust-hir-trait-reference.h: likewise
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): likewise
* typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::TypeBoundPredicate): track super traits
(TypeBoundPredicate::operator=): likewise
(TypeBoundPredicate::apply_generic_arguments): ensure we apply to super predicates
(TypeBoundPredicateItem::operator=): take copy of parent predicate
(TypeBoundPredicateItem::error): pass error instead of nullptr
(TypeBoundPredicateItem::is_error): update to no longer check for nullptr
(TypeBoundPredicateItem::get_parent): updated
(TypeBoundPredicateItem::get_tyty_for_receiver): likewise
(TypeBoundPredicate::get_associated_type_items): likewise
* typecheck/rust-tyty-bounds.h (class TypeBoundPredicateItem): move
* typecheck/rust-tyty-subst.cc: flag to handle placeholder Self on traits
* typecheck/rust-tyty-subst.h (class TypeBoundPredicateItem): likewise
* typecheck/rust-tyty.h (class TypeBoundPredicateItem): refactored
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Add visitor for StructExprFieldIdentifier.
* resolve/rust-late-name-resolver-2.0.h
(Late::visit): Likewise.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Make sure to return early after a resolution
error, improve the resolution error message, fix a typo, handle
ambiguous resolutions, and remove an old comment.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-ast-resolve-expr.cc
(ResolveExpr::visit): Modify error message.
* resolve/rust-ast-resolve-implitem.h
(ResolveToplevelImplItem::visit): Likewise.
(ResolveTopLevelTraitItems::visit): Likewise.
(ResolveToplevelExternItem::visit): Likewise.
* resolve/rust-ast-resolve-stmt.cc
(ResolveStmt::visit): Likewise.
* resolve/rust-ast-resolve-stmt.h
(ResolveStmt::visit): Likewise.
* resolve/rust-ast-resolve-toplevel.h
(ResolveTopLevel::visit): Likewise.
* resolve/rust-ast-resolve-type.h
(ResolveGenericParams::visit): Likewise.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): Make sure to always visit the struct
name.
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Avoid visiting the struct name twice.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-derive-clone.cc
(DeriveClone::clone_impl): Avoid using the same node id multiple
times.
(DeriveClone::clone_enum_identifier): Likewise.
(DeriveClone::clone_enum_tuple): Likewise.
* expand/rust-derive-copy.cc
(DeriveCopy::copy_impl): Likewise.
* resolve/rust-ast-resolve-item.cc
(flatten_list): Likewise.
* resolve/rust-ast-resolve-path.cc
(ResolvePath::resolve_path): Prevent reinsertion of resolutions.
* resolve/rust-ast-resolve-type.cc
(ResolveRelativeTypePath::go): Likewise.
* typecheck/rust-hir-type-check-expr.cc
(TypeCheckExpr::resolve_fn_trait_call): Likewise.
* resolve/rust-name-resolver.cc
(Resolver::insert_resolved_name): Catch multiple resolution
insertions.
(Resolver::insert_resolved_type): Likewise.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-ast-resolve-path.cc
(ResolvePath::resolve_path): Adjust the error message for a lower
self segment in the middle of a path.
* resolve/rust-ast-resolve-type.cc
(ResolveRelativeTypePath::go): Likewise.
2025-03-24 Ryutaro Okada <1015ryu88@gmail.com>
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit):
emit an error for type or const parameters on foreign items
2025-03-24 Liam Naddell <liamnprg@gmail.com>
* resolve/rust-forever-stack.h (ForeverStack): Add a dedicated prelude node for
the Language prelude
* resolve/rust-forever-stack.hxx (ForeverStack): Add support code for the
prelude node
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Move
language prelude builtins to the prelude context
* resolve/rust-name-resolution-context.cc
(NameResolutionContext::scoped): Add code for handling
the prelude corner case
* resolve/rust-rib.h (Rib::Kind): Add a special Prelude rib type
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-forever-stack.hxx: Fix the id comparison.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-forever-stack.hxx: Insert a new segment with the crate's
name as canonical's path prefix.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-hir-map.cc (Mappings::lookup_crate_num): Add function to
retrieve crate number from it's node id.
(Mappings::node_is_crate): change function with call to
lookup_crate_num to avoid looping through all crates.
(Mappings::insert_ast_crate): Populate node id to crate number map.
* util/rust-hir-map.h: Change function prototype.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-finalize-imports-2.0.cc (FinalizeImports::FinalizeImports):
Remove constructor.
(FinalizeImports::go): Remove function.
(FinalizeImports::visit): Likewise.
* resolve/rust-finalize-imports-2.0.h (class FinalizeImports): Remove
FinalizeImports class.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc (Early::Early): Move the
top level visitor from the function scope to attributes.
(Early::go): Remove top level visitor creation and adapt calling code.
Remove call to mapping resolution and import finalization.
(Early::finalize_simple_import): Move the finalization from it's
visitor.
(Early::finalize_glob_import): Likewise.
(Early::finalize_rebind_import): Likewise.
(Early::visit): Add mapping resolution and finalization in
UseDeclaration visitor function.
* resolve/rust-finalize-imports-2.0.cc (finalize_simple_import): Move
function.
(finalize_glob_import): Likewise.
(finalize_rebind_import): Likewise.
(FinalizeImports::visit): Remove call to finalizers.
* resolve/rust-early-name-resolver-2.0.h (class Early): Add top level
attribute.
* resolve/rust-finalize-imports-2.0.h: Add function prototypes.
* resolve/rust-toplevel-name-resolver-2.0.h: Change getter return type
to reference.
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::ResolveHirItem): new helper
* typecheck/rust-hir-trait-resolve.h: add helper prototype
* typecheck/rust-type-util.cc (query_type): add debug
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): check for recursion
* typecheck/rust-tyty.cc (VariantDef::is_equal): fix is equal check
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): track DefId of origin
* typecheck/rust-tyty.cc (BaseType::monomorphized_clone): likewise
(ADTType::ADTType): likewise
(ADTType::get_id): likewise
(ADTType::clone): likewise
* typecheck/rust-tyty.h: likewise
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-resolve-path.cc (ResolvePathRef::Compile): remove visitor
(ResolvePathRef::ResolvePathRef): likewise
(ResolvePathRef::visit): likewise
* backend/rust-compile-resolve-path.h (class ResolvePathRef): likewise
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-intrinsic.cc
(assume_handler): Fix copy/paste error.
* typecheck/rust-hir-type-check-pattern.cc
(TypeCheckPattern::visit): Fix spelling mistake.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-rib.cc (Rib::Definition::to_string): Add enum variant
status.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-forever-stack.h: Add new function to insert enum
variants and add argument to resolver's get function to explicitely
skip enum variants.
* resolve/rust-forever-stack.hxx: Update function
definitions.
* resolve/rust-name-resolution-context.cc (NameResolutionContext::insert_variant):
Add function to insert enum variants.
* resolve/rust-name-resolution-context.h: Add function's prototype.
* resolve/rust-rib.cc (Rib::Definition::Definition): Add new boolean to
hint at enum variant provenance.
(Rib::Definition::is_variant): New getter for variant status.
(Rib::Definition::Shadowable): Update constructor to opt out of enum
variants.
(Rib::Definition::Globbed): Likewise.
(Rib::Definition::NonShadowable): Change constructor to forward enum
variant provenance status.
* resolve/rust-rib.h: Update function prototypes.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::insert_enum_variant_or_error_out):
Add function to insert enum variants in the name resolver.
(TopLevel::visit): Update several enum variant's visitor function
with the new enum variant name resolving code.
* resolve/rust-toplevel-name-resolver-2.0.h: Update function
prototypes.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-forever-stack.hxx: Output rib kind.
* resolve/rust-rib.h: Add function to get string representation from
a rib kind.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-forever-stack.h
(ForeverStack::ForeverStack): Set the node id of the root node
to that of the current crate.
* resolve/rust-forever-stack.hxx
(ForeverStack::find_starting_point): Use the node id of the root
node during resolution of crate segments.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-expand.cc: Use new SubstituteCtx API.
* expand/rust-macro-expand.h: Likewise.
* expand/rust-macro-substitute-ctx.cc: Implement proper expansion of $crate.
* expand/rust-macro-substitute-ctx.h: Adapt APIs to take macro definition when
substituting.
* util/rust-hir-map.cc (Mappings::insert_macro_def): Store crate information when
inserting macro definition in mappings.
(Mappings::lookup_macro_def_crate): New.
* util/rust-hir-map.h: Adapt mappings to store crate in which macros were defined.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Call DefaultResolver::visit earlier, in order to
ensure it is called even if Late::visit returns early.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* util/rust-edition.cc: New file.
* util/rust-edition.h: New file.
* Make-lang.in: Add rust-edition.o to the object list.
* ast/rust-pattern.cc: Remove inclusion of
rust-session-manager.h.
* expand/rust-macro-expand.cc: Likewise.
* expand/rust-macro-builtins-helpers.h: Likewise.
* expand/rust-macro-builtins-include.cc: Include
rust-session-manager.h.
* expand/rust-macro-builtins-utility.cc: Likewise.
* lex/rust-lex.cc: Include rust-edition.h instead of
rust-session-manager.h.
(Lexer::classify_keyword): Use get_rust_edition instead of
Session and CompileOptions.
* parse/rust-parse-impl.h: Include rust-edition.h instead of
rust-session-manager.h.
(Parser::parse_async_item): Use get_rust_edition instead of
Session and CompileOptions.
* checks/errors/rust-feature.h: Include rust-edition.h instead
of rust-session-manager.h.
(class Feature): Use Rust::Edition instead of
Rust::CompileOptions::Edition.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-session-manager.cc (Session::compile_crate): Call DesugarQuestionMark::go().
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/rust-ast-lower-base.cc: Adapt functions for ErrorPropagationExpr and MacroInvocation.
* hir/rust-ast-lower-base.h: Mark them as final.
* hir/rust-ast-lower-expr.cc: Remove previous definition for those overrides.
* hir/rust-ast-lower-expr.h: Likewise.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Compile it.
* ast/rust-desugar-question-mark.cc: New file.
* ast/rust-desugar-question-mark.h: New file.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-early-name-resolver-2.0.cc
(Early::visit): Adjust error produced when macro resolution
fails.
* resolve/rust-early-name-resolver.cc
(EarlyNameResolver::visit): Likewise.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-forever-stack.hxx
(ForeverStack::find_starting_point): Stop when hitting a lang
item segment.
(ForeverStack::resolve_segments): Resolve lang item segments.
(ForeverStacl::resolve_path): Handle single segment lang item
paths and add comment.
* util/rust-unwrap-segment.cc
(unwrap_segment_get_lang_item): Add.
* util/rust-unwrap-segment.h
(unwrap_segment_get_lang_item): Add.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-expand-visitor.cc (ExpandVisitor::visit): Correctly visit the generic args
of a generic type path segment.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-early-name-resolver.cc: Remove definitions.
* resolve/rust-early-name-resolver.h: Remove declarations.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Add base implementation
for visitor.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-early-name-resolver-2.0.cc:
Include rust-attribute-values.h.
(Early::visit): If a module has a macro_use attribute, avoid
pushing a new textual macro scope.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-ast-resolve-type.cc
(ResolveRelativeTypePath::go): Adjust error message to match
the 2.0 name resolver.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/rust-hir-dump.cc: Check unique_ptr members are present before
visiting them.
* hir/tree/rust-hir-path.h: Add `has_{type, trait}` methods to
QualifiedPathInType.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Compile it.
* expand/rust-derive.cc (DeriveVisitor::derive): Call it.
* expand/rust-derive-hash.cc: New file.
* expand/rust-derive-hash.h: New file.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-debug.cc (ptrify): Remove function.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.cc (Builder::statementify): New.
(Builder::function): Add generic params optional argument.
(Builder::path_in_expression): Add opening_scope_resolution optional argument.
(Builder::block): Add function for creating empty blocks.
(Builder::generic_type_param): New.
* ast/rust-ast-builder.h (ptrify): New.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast.h
(SingleASTNode::take_trait_item): Remove.
(SingleASTNode::take_impl_item): Remove.
(SingleASTNode::take_trait_impl_item): Remove.
* expand/rust-expand-visitor.cc
(ExpandVisitor::visit): Replace calls to aforementioned
functions with calls to SingleASTNode::take_assoc_item.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-expand-visitor.cc
(ExpandVisitor::visit): Override DefaultASTVisitor in order to
expand a module's items, rather than directly visit them.
* expand/rust-expand-visitor.h
(ExpandVisitor::visit): Add override.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-path.h
(PathInExpression::get_pattern_node_id): Remove.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-eq.cc: Copy `Eq` typepath.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-eq.cc: Adapt functions to return two generated impls.
* expand/rust-derive-eq.h: Likewise.
* expand/rust-derive.cc (DeriveVisitor::derive): Likewise.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-partial-eq.cc: Adapt signatures to generate two impls.
* expand/rust-derive-partial-eq.h: Likewise.
* expand/rust-derive.cc (DeriveVisitor::derive): Adapt to multiple item generation.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive.cc (DeriveVisitor::derive): Return a vector of items.
* expand/rust-derive.h: Change return type.
* expand/rust-expand-visitor.cc: Insert all generated items into the AST.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-partial-eq.cc: New file.
* expand/rust-derive-partial-eq.h: New file.
* expand/rust-derive.cc (DeriveVisitor::derive): Call them.
* Make-lang.in: Compile them.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-clone.cc: Cleanup implementation, avoid repetitions.
* expand/rust-derive-clone.h: Likewise.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.cc (Builder::literal_bool): New method.
(Builder::comparison_expr): Likewise.
(Builder::boolean_operation): Likewise.
* ast/rust-ast-builder.h: Declare them.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.cc (Builder::block): Change return type.
(Builder::loop): Use new APIs.
* ast/rust-ast-builder.h: Change return type of block functions.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive.cc (DeriveVisitor::derive): Call into DeriveEq.
* expand/rust-derive-eq.cc: New file.
* expand/rust-derive-eq.h: New file.
* Make-lang.in: Compile them.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): When visiting a PathInExpression instance, call
into DefaultResolver::visit, ensuring generic arguments are
visited.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): When visiting an external crate declaration,
handle failed crate name lookups. This can happen when
Session::load_extern_crate fails to load a crate during the
CfgStrip phase.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-forever-stack.hxx
(ForeverStack::resolve_segments): Add comments explaining
the behaviour of a while loop.
2025-03-24 Benjamin Thos <benjamin.thos@epita.fr>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Add check on if-expr.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-forever-stack.hxx
(ForeverStack::find_starting_point): Be more careful about
applying ForeverStack::find_closest_module.
(ForeverStack::resolve_segments): Allow traversal into parent
nodes when not in a module node or root node, which
ForeverStack::find_starting_point previously made moot through
use of ForeverStack::find_closest_module. Also, when a child
node lookup fails when resolving in the type namespace, attempt
a rib lookup as a fallback.
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Avoid throwing a resolution error for type paths
when the typechecker may be able to finish the resolution. Also,
throw an error when a resolution is ambiguous.
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): new tyty::OpaqueType
* backend/rust-compile-type.h: likewise
* checks/errors/borrowck/rust-bir-fact-collector.h: likewise
* checks/errors/borrowck/rust-bir-place.h: likewise
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_base_type_privacy):
likewise
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise
* typecheck/rust-hir-type-check-type.h: likewise
* typecheck/rust-substitution-mapper.cc (SubstMapperInternal::visit): likewise
* typecheck/rust-substitution-mapper.h: likewise
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): likewise
* typecheck/rust-tyty-call.h: likewise
* typecheck/rust-tyty-cmp.h (class OpaqueCmp): likewise
* typecheck/rust-tyty-variance-analysis-private.h: likewise
* typecheck/rust-tyty-visitor.h: likewise
* typecheck/rust-tyty.cc (TypeKindFormat::to_string): likewise
(BaseType::is_unit): likewise
(BaseType::destructure): likewise
(BaseType::has_substitutions_defined): likewise
(BaseType::needs_generic_substitutions): likewise
(OpaqueType::OpaqueType): likewise
(OpaqueType::can_resolve): likewise
(OpaqueType::accept_vis): likewise
(OpaqueType::as_string): likewise
(OpaqueType::get_name): likewise
(OpaqueType::can_eq): likewise
(OpaqueType::clone): likewise
(OpaqueType::resolve): likewise
(OpaqueType::is_equal): likewise
(OpaqueType::handle_substitions): likewise
* typecheck/rust-tyty.h (enum TypeKind): likewise
(class OpaqueType): likewise
* typecheck/rust-unify.cc (UnifyRules::go): likewise
(UnifyRules::expect_inference_variable): likewise
(UnifyRules::expect_adt): likewise
(UnifyRules::expect_str): likewise
(UnifyRules::expect_reference): likewise
(UnifyRules::expect_pointer): likewise
(UnifyRules::expect_param): likewise
(UnifyRules::expect_array): likewise
(UnifyRules::expect_slice): likewise
(UnifyRules::expect_fndef): likewise
(UnifyRules::expect_fnptr): likewise
(UnifyRules::expect_tuple): likewise
(UnifyRules::expect_bool): likewise
(UnifyRules::expect_char): likewise
(UnifyRules::expect_int): likewise
(UnifyRules::expect_uint): likewise
(UnifyRules::expect_float): likewise
(UnifyRules::expect_isize): likewise
(UnifyRules::expect_usize): likewise
(UnifyRules::expect_placeholder): likewise
(UnifyRules::expect_projection): likewise
(UnifyRules::expect_dyn): likewise
(UnifyRules::expect_opaque): likewise
* typecheck/rust-unify.h: likewise
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* checks/errors/borrowck/rust-bir-builder-struct.h: remove HIR::ImplTraitTypeOneBound
* checks/errors/borrowck/rust-function-collector.h: likewise
* checks/errors/rust-const-checker.cc (ConstChecker::visit): likewise
* checks/errors/rust-const-checker.h: likewise
* checks/errors/rust-hir-pattern-analysis.cc (PatternChecker::visit): likewise
* checks/errors/rust-hir-pattern-analysis.h: likewise
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): likewise
* checks/errors/rust-unsafe-checker.h: likewise
* hir/rust-ast-lower-type.cc (ASTLoweringType::translate): likewise
(ASTLoweringType::visit): likewise
* hir/rust-ast-lower-type.h: cleanup
* hir/rust-hir-dump.cc (Dump::visit): remove ImplTraitTypeOneBound
* hir/rust-hir-dump.h: likewise
* hir/tree/rust-hir-full-decls.h (class ImplTraitTypeOneBound): likewise
* hir/tree/rust-hir-type.h (class ImplTraitTypeOneBound): likewise
* hir/tree/rust-hir-visitor.h: likewise
* hir/tree/rust-hir.cc (ImplTraitTypeOneBound::as_string): likewise
(ImplTraitTypeOneBound::accept_vis): likewise
* resolve/rust-ast-resolve-type.cc (ResolveType::go): likewise
(ResolveType::visit): likewise
* resolve/rust-ast-resolve-type.h: add name resolution
* typecheck/rust-hir-type-check-type.h: likewise
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): improve error diag
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_self): add location mappings
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path): check for self
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): use new api
(ResolveItem::visit): likewise
(ResolveExternItem::visit): likewise
* resolve/rust-ast-resolve-stmt.h: likewise
* resolve/rust-ast-resolve-type.h (class ResolveGenericParam): remove
(class ResolveGenericParams): added new api
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-base.cc (walk_types_to_constrain): recursive walker
* typecheck/rust-tyty.cc (BaseType::get_subst_argument_mappings): new helper
* typecheck/rust-tyty.h: prototype
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-base.h: add flag
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise
* typecheck/rust-tyty-bounds.cc: new diagnostic
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): remove name resolution info
(TypeCheckType::resolve_root_path): likewise
* typecheck/rust-hir-type-check-type.h: likewise
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-type.cc (TyTyResolveCompile::get_implicit_enumeral_node_type):
use repr
(TyTyResolveCompile::visit): update prototype
* backend/rust-compile-type.h: likewise
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-intrinsic.cc (variant_count_handler): new intrinsic
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-intrinsic.cc (discriminant_value_handler): new handler
* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item): track the defid
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::parse_repr_options): default isize
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): special case CallExpr
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): parse repr options enum
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): remove bad diagnostic
* typecheck/rust-tyty.cc (PlaceholderType::PlaceholderType): track defid
(PlaceholderType::clone): likewise
(PlaceholderType::get_def_id): likeiwse
* typecheck/rust-tyty.h: placeholder track defid
* util/rust-lang-item.cc: add new lang items
* util/rust-lang-item.h: likewise
2025-03-24 GS-GOAT <86884129+GS-GOAT@users.noreply.github.com>
* typecheck/rust-autoderef.cc
(insert_implicit_type): Update single-parameter call to
pass explicit HirId.
* typecheck/rust-hir-type-check-expr.cc: Same.
* typecheck/rust-hir-type-check-pattern.cc: Same.
* typecheck/rust-hir-type-check.h: Removed call
to the duplicate interface.
* typecheck/rust-typecheck-context.cc
(TypeCheckContext::insert_implicit_type): Removed the
interface with no HirId field.
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty-subst.cc (SubstitutionRef::monomorphize): remove diagnostic
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-session-manager.cc (Session::compile_crate): Call the visitor.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-desugar-for-loops.cc: New file.
* ast/rust-desugar-for-loops.h: New file.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Make lowering of for-loops an
unreachable.
* Make-lang.in: Compile it.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.h: Mark all arguments as &&.
* ast/rust-ast-builder.cc (Builder::let): Likewise.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* util/rust-unwrap-segment.cc: New file.
* util/rust-unwrap-segment.h: New file.
* Make-lang.in: Add rust-unwrap-segment.o to the object list.
* resolve/rust-forever-stack.hxx: Include rust-unwrap-segment.h.
(ForeverStack::find_starting_point): Use unwrap_type_segment.
(ForeverStack::resolve_segments): Likewise.
(ForeverStack::resolve_path): Likewise.
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Resolve type paths using
NameResolutionContext::resolve_path.
* resolve/rust-name-resolution-context.h
(NameResolutionContext::resolve_path): Use
unwrap_segment_node_id.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-builtins-asm.cc (strip_double_quotes): Special case empty
strings ("\"\"").
(parse_reg_operand): Remove use of the `struct` keyword.
(parse_reg_operand_in): Likewise.
(parse_reg_operand_out): Likewise.
* expand/rust-macro-builtins.cc: Add llvm_asm! built-in macro as an alias to asm!.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Add
warning about current code.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive.cc (DeriveVisitor::derive): Call DeriveDefault.
* expand/rust-derive-default.cc: New file.
* expand/rust-derive-default.h: New file.
* Make-lang.in: Compile them.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.cc (Builder::qualified_path_in_expression): New.
(Builder::function): Change the return type.
* ast/rust-ast-builder.h: Declare qualified_path_in_expression functions.
* expand/rust-derive-debug.cc (DeriveDebug::stub_debug_fn): Adapt to new APIs.
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): remove receiver interface
* backend/rust-compile-item.cc (CompileItem::visit): monomorphize trait to impl item
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): use trait item Self
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): remove receiver interface
(TypeCheckExpr::resolve_fn_trait_call): likewise
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): likewise
(TypeCheckExpr::resolve_segments): likewise
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise
* typecheck/rust-hir-type-check.h: likewise
* typecheck/rust-typecheck-context.cc (TypeCheckContext::insert_receiver): remove
(TypeCheckContext::lookup_receiver): remove
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-substitution-mapper.cc (SubstMapperInternal::visit):
continue on for trait item mode.
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_base_type_privacy):
Add guard for placeholder
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-type-util.cc (coercion_site): allow inference vars
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-path-probe.cc (PathProbeType::visit): remove assertion
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty.cc (ClosureType::setup_fn_once_output): add checks for lang items
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-early-name-resolver-2.0.cc
(Early::resolve_glob_import): Use
NameResolutionContext::resolve_path instead of
ForeverStack::resolve_path.
(Early::visit): Likewise.
(Early::visit_attributes): Likewise.
* resolve/rust-early-name-resolver-2.0.h
(Early::resolve_path_in_all_ns): Likewise.
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Likewise, insert segment resolutions not
handled by NameResolutionContext::resolve_path, and avoid throwing
an error when path resolution could be finished by the typechecker.
* resolve/rust-name-resolution-context.h
(NameResolutionContext::resolve_path): Add.
* typecheck/rust-hir-type-check-path.cc
(TypeCheckExpr::resolve_root_path): Use segment node ids instead
of the path node id to look up segment resolutions when using
the 2.0 resolver, as is done with the 1.0 resolver.
* typecheck/rust-hir-type-check-type.cc
(TypeCheckType::resolve_root_path): Likewise.
* resolve/rust-forever-stack.h
(ForeverStack::resolve_path): Add callback parameter for
inserting segment resolutions.
(ForeverStack::find_starting_point): Likewise.
(ForeverStack::resolve_segments): Likewise.
* resolve/rust-forever-stack.hxx
(ForeverStack::find_starting_point): Likewise.
(ForeverStack::resolve_segments): Likewise.
(ForeverStack::resolve_path): Likewise and avoid resolving
inside TraitOrImpl ribs.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-expr.cc
(CompileExpr::generate_closure_function): Take
NameResolutionContext by reference instead of by value.
* backend/rust-compile-item.cc
(CompileItem::visit): Likewise.
* backend/rust-compile-resolve-path.cc
(ResolvePathRef::resolve): Likewise.
* checks/lints/rust-lint-marklive.cc
(MarkLive::find_ref_node_id): Likewise.
* typecheck/rust-hir-type-check-enumitem.cc
(TypeCheckEnumItem::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.cc
(TypeCheckImplItem::visit): Likewise.
* typecheck/rust-hir-type-check-item.cc
(TypeCheckItem::visit): Likewise.
* typecheck/rust-hir-type-check-path.cc
(TypeCheckExpr::resolve_root_path): Likewise.
* typecheck/rust-hir-type-check-type.cc
(TypeCheckType::resolve_root_path): Likewise.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.h: Declare it.
* ast/rust-ast-builder.cc (Builder::return_expr): Define it.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-debug.cc: New file.
* expand/rust-derive-debug.h: New file.
* Make-lang.in: Compile them.
* expand/rust-derive.cc (DeriveVisitor::derive): Call into DeriveDebug.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-clone.cc: Cleanup using DeriveVisitor::setup_impl_generics.
* expand/rust-derive-copy.cc: Likewise.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive.cc (DeriveVisitor::setup_impl_generics): New method.
* expand/rust-derive.h: Declare it, define DeriveVisitor::ImplGenerics struct.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.cc: New methods.
* ast/rust-ast-builder.h: Declare them.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.cc (Builder::type_path): New functions.
* ast/rust-ast-builder.h: Declare them.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/lints/rust-lint-scan-deadcode.h: Check if the field name starts with an
underscore before warning.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-lang-item.cc: New items.
* util/rust-lang-item.h: Likewise.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Special case lang item paths.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-forever-stack.hxx
(ForeverStack::dfs_rib): Fix const implementation.
2025-03-24 Liam Naddell <liamnprg@gmail.com>
* expand/rust-macro-builtins-utility.cc: Add macro expansion for
option_env with eager expansion
* expand/rust-macro-builtins.cc: Add option_env to builtin list
* expand/rust-macro-builtins.h: Add option_env handler to header
file
* resolve/rust-late-name-resolver-2.0.cc: Prevent NR2.0 from
recursing into lang-item segments
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.h: Add new Expr::Kinds.
* ast/rust-expr.h: Implement missing get_expr_kind(), Add get_function_expr_ptr()
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-pattern.cc (CompilePatternBindings::visit): make recursive
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): handle ref flag
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-lang-item.h: Declare it.
* util/rust-lang-item.cc: Use it.
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): disable overflow checks
* lang.opt: new flag
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve): Do
not use query system for unit struct but compile it's constructor
instead.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait):
Query all namespaces.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-forever-stack.h: Make debug functions const.
* resolve/rust-forever-stack.hxx: Likewise.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit):
Clone expr instead of taking it.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-item.h: Remove query mode.
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile):
Likewise.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-ast-resolve-toplevel.h: Add struct to name namespace.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-name-resolver.h: Add new degug dump for old name
resolver.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Change label
push function from type rib to label rib.
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit):
Likewise.
(ResolveItem::visit): Likewise.
(ResolveExternItem::visit): Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve.cc (NameResolution::go): Likewise.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-compile-resolve-path.cc (ResolvePathRef::visit): Call into
resolve_path_like instead.
(ResolvePathRef::resolve_path_like): New.
(ResolvePathRef::resolve): Call into resolve_with_node_id.
* backend/rust-compile-resolve-path.h: Declare new functions and document them.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-path.h: New function.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/lints/rust-lint-marklive.cc (MarkLive::visit): Adapt to lang items.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-compile-resolve-path.cc (ResolvePathRef::visit): Adapt visitor to lang item
HIR::PathInExpressions.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): Likewise.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/tree/rust-hir-path.h: Adapt PathPattern to accept lang-item paths.
* hir/tree/rust-hir-path.cc: Assert we are dealing with a segmented path, create lang-item
constructors.
* hir/tree/rust-hir.cc (PathPattern::convert_to_simple_path): Likewise.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Adapt visitor to lang item
PathInExpressions.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* expand/rust-cfg-strip.cc (CfgStrip::visit): Likewise.
* expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise.
* hir/rust-ast-lower.cc (ASTLoweringExprWithBlock::visit): Likewise.
(ASTLowerPathInExpression::visit): Likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-lang-item.cc (LangItem::IsEnumVariant): New function.
* util/rust-lang-item.h: Declare it.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-hir-map.cc (Mappings::get_lang_item_node): Better formatting when a lang
item does not exist when it should.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-collect-lang-items.h: Declare visitor.
* ast/rust-collect-lang-items.cc (CollectLangItems::visit): New.
2025-03-24 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): add guard
2025-03-24 Dylan Gardner <dylan@gardnermedia.com>
* rust-session-manager.cc (Session::handle_crate_name): Remove
crate name inference
(Session::compile_crate): Add crate name inference and error if
inferred name is empty. Remove CompileOptions::get_instance ()
that returned a local copy of the options. Rename
crate_name_changed to crate_name_found to match semantics.
(rust_crate_name_validation_test): Test inferring ".rs" name
* rust-session-manager.h: Modify handle_crate_name definition to
include filename.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add
ClosureExprInnerTyped visit implementation.
(add_captures): Add a function to avoid code duplication.
* resolve/rust-late-name-resolver-2.0.h: Add function prototype.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add environment
collection.
* resolve/rust-late-name-resolver-2.0.h: Add function prototype.
* resolve/rust-name-resolver.cc (Resolver::get_captures): Add assertion
to prevent NR2 usage with nr1 capture functions.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Use
nr2 captures.
* util/rust-hir-map.cc (Mappings::add_capture): Add function to
register capture for a given closure.
(Mappings::lookup_captures): Add a function to lookup all captures
available for a given closure.
* util/rust-hir-map.h: Add function prototypes.
2025-03-24 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Error out if a type path has multiple segments,
as we currently ignore every segment except the last.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-compile-expr.cc (check_match_scrutinee): Allow anything to be used as a
match scrutinee, not just ADTs.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-lang-item.h: Add handling for Result::Ok, Result::Err, Try, Try::into_result,
Try::from_ok, Try::from_err.
* util/rust-lang-item.cc: Likewise.
2025-03-24 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add "rust"
identifier detection akin to nr1.
(funny_ice_finalizer): Copy ICE finalizer from nr1.
* resolve/rust-late-name-resolver-2.0.h: Add funny_error member
context state.
* Make-lang.in: Add new translation unit for new ice finalizer.
* resolve/rust-ast-resolve-expr.cc: Move ice
finalizer to it's own file.
* resolve/rust-ice-finalizer.cc: New file.
* resolve/rust-ice-finalizer.h: New file.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-copy.cc: Always add an extra Copy bound on generic Copy impls.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-clone.cc (DeriveClone::visit_union): Use lang items for Copy and
Sized bounds.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-clone.cc: Add extra bound when deriving generic Clone
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.cc (Builder::new_type_param): Add optional extra trait bounds.
* ast/rust-ast-builder.h: Likewise.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/rust-hir-dump.cc (Dump::do_typepathsegment): Add handling for lang items.
2025-03-24 lishin <lishin1008@gmail.com>
* util/rust-lang-item.cc: Add receiver to map.
* util/rust-lang-item.h: Define LangItem::Kind::RECEIVER.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Register auto traits in mappings.
* util/rust-hir-map.cc (Mappings::insert_auto_trait): New.
(Mappings::get_auto_traits): New.
* util/rust-hir-map.h: Declare them.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Add auto trait bounds when
scanning.
2025-03-24 Arthur Cohen <arthur.cohen@embecosm.com>
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::add_trait_bound): New function.
* typecheck/rust-hir-type-bounds.h: Declare it.
(TypeBoundsProbe::assemble_builtin_candidate): Call into add_trait_bound.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Improve formatting.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-clone.cc (DeriveClone::clone_enum_struct): New function for deriving
enum struct variants.
(DeriveClone::visit_enum): Call into the new function.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-clone.cc (DeriveClone::variant_match_path): New function.
(DeriveClone::clone_enum_identifier): Rename.
(DeriveClone::clone_enum_tuple): New function.
(DeriveClone::visit_enum): Visit tuple variants properly.
* expand/rust-derive-clone.h: Declare new functions.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.cc: Add new methods for constructing struct exprs.
* ast/rust-ast-builder.h: Mention how to build tuple expressions.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-clone.cc: Clone enum identifier variants properly
* expand/rust-derive-clone.h: Declare new functions used.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-clone.cc (DeriveClone::clone_call): Mention using `clone_fn`
lang item in the future.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-clone.cc (DeriveClone::visit_union): Create a lang item path
instead of a regular path.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.cc: New functions.
* ast/rust-ast-builder.h: Declare them.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-copy.cc: Use lang item path.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-clone.cc (DeriveClone::visit_union): Manually generate
the struct used for asserting a union implements Copy.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.cc (Builder::struct_struct): New function.
* ast/rust-ast-builder.h (vec): New function.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Visit tuple pattern items as
separated by commas.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Fix collector to better
handle lang item type path segments.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-hir-map.cc (Mappings::get_lang_item_node): New.
* util/rust-hir-map.h: New function.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-lang-item.cc (LangItem::PrettyString): New.
* util/rust-lang-item.h: New.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-collect-lang-items.cc (CollectLangItems::visit): New.
* ast/rust-collect-lang-items.h: New.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/rust-ast-lower-type.cc (ASTLowerTypePath::visit): Adapt code to lang item
type path segments.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Adapt
code to handle lang item type paths.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-path.h: Rework how lang item paths are represented.
* ast/rust-path.cc: Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-ast.cc: Likewise.
* ast/rust-ast-collector.cc: Adapt to new lang item path system.
* ast/rust-ast-collector.h: Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast-visitor.h: Likewise.
* expand/rust-derive-copy.cc: Likewise.
* expand/rust-derive.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-type.cc (ASTLowerTypePath::translate): Likewise.
(ASTLowerTypePath::visit): Likewise.
* hir/rust-ast-lower-type.h: Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Likewise.
* resolve/rust-ast-resolve-type.h: Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Likewise.
* resolve/rust-late-name-resolver-2.0.h: Likewise.
* hir/tree/rust-hir-path.cc (TypePathSegment::TypePathSegment): Likewise.
(TypePathSegmentGeneric::TypePathSegmentGeneric): Likewise.
* hir/tree/rust-hir-path.h: Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Likewise.
* ast/rust-ast-builder.cc: Likewise.
* ast/rust-ast-builder.h: Likewise.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-collect-lang-items.cc (get_lang_item_attr): Show unknown attribute upon error.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-attribute-values.h: Declare new attribute value.
* util/rust-attributes.cc: Use it.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.cc (BlockExpr::normalize_tail_expr): Remove overzealous
std::move
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-collector.cc
(TokenCollector::visit): Remove visitor for NamedFunctionParam.
* ast/rust-ast-collector.h
(TokenCollector::visit): Likewise.
* ast/rust-ast-full-decls.h
(class NamedFunctionParam): Remove forward declaration.
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): Remove visitor for
NamedFunctionParam.
* ast/rust-ast-visitor.h
(DefaultASTVisitor::visit): Likewise.
* ast/rust-ast.cc
(NamedFunctionParam::as_string): Remove.
* ast/rust-item.h
(class NamedFunctionParam): Remove.
(class ExternalFunctionItem): Remove.
* parse/rust-parse-impl.h
(Parser::parse_named_function_param): Remove.
(Parser::parse_named_function_params): Remove.
* parse/rust-parse.h
(Parser::parse_named_function_param): Remove.
(Parser::parse_named_function_params): Remove.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-early-name-resolver-2.0.cc
(Early::visit): Resolve the pending eager invocations inside
builtin macro invocations.
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): hir lowering
* hir/rust-ast-lower-stmt.h: likewise
* resolve/rust-ast-resolve-stmt.cc (ResolveStmt::visit): name resolution
* resolve/rust-ast-resolve-stmt.h: likewise
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* Make-lang.in: Handle rust-forever-stack.cc.
* resolve/rust-forever-stack.h
(class ForeverStackStore): Add.
* resolve/rust-forever-stack.cc: New file, based on
rust-forever-stack.hxx.
2025-03-21 Om Swaroop Nayak <96killerat96@gmail.com>
* ast/rust-collect-lang-items.cc (get_lang_item_attr): "removed checker fn"
* util/rust-attributes.cc (Attributes::is_lang_item): "added fn"
* util/rust-attributes.h: "added fn"
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* checks/errors/rust-readonly-check.cc (check_decl): improve mut check
(emit_error): helper
(check_modify_expr): likewise
(readonly_walk_fn): reuse helper
(ReadonlyCheck::Lint): cleanup context each run
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): When visiting a TraitImpl, visit its
trait path.
2025-03-21 liushuyu <liushuyu011@gmail.com>
* backend/rust-compile-intrinsic.cc: add the new `catch_unwind` variant
of the `try` intrinsic: this variant can be seen on Rust 1.78+
and returns `()` instead of `i32`.
2025-03-21 liushuyu <liushuyu011@gmail.com>
* backend/rust-compile-intrinsic.cc: add `try` intrinsic handler.
* lang.opt: add `-frust-panic` option.
* rust-lang.cc: enable exception handler code generation.
* rust-session-manager.cc: add getter and setter for panic
strategy option.
* rust-session-manager.h: Likewise.
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): implement coercion
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): this is an LUB
* typecheck/rust-unify.cc (UnifyRules::go): remove unify ! coercion
2025-03-21 Nobel <nobel2073@gmail.com>
* typecheck/rust-casts.cc (TypeCastRules::cast_rules): Add rule.
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): new layout
* backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit): likewise
(CompilePatternBindings::visit): likewise
* backend/rust-compile-resolve-path.cc: likewise
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): implement new layout
* rust-gcc.cc (constructor_expression): get rid of useless assert
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Insert a definition for Self when visiting
InherentImpl and TraitImpl instances.
* resolve/rust-toplevel-name-resolver-2.0.h
(TopLevel::visit): Add visitors for InherentImpl and TraitImpl.
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* hir/rust-hir-dump.cc (Dump::visit): add null guard
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): handle partial_eq possible call
* backend/rust-compile-expr.h: handle case where lang item calls differ from name
* hir/tree/rust-hir-expr.cc (OperatorExprMeta::OperatorExprMeta): new helper
* hir/tree/rust-hir-expr.h: likewise
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): handle partial_eq
(TypeCheckExpr::resolve_operator_overload): likewise
* typecheck/rust-hir-type-check-expr.h: likewise
* util/rust-lang-item.cc (LangItem::ComparisonToLangItem): map comparison to lang item
(LangItem::ComparisonToSegment): likewise
* util/rust-lang-item.h: new lang items PartialOrd and Eq
* util/rust-operators.h (enum class): likewise
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): check for error
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): likewise and remove debug error
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-default-resolver.cc
(DefaultResolver::visit): Make sure to scope visitation of the
children of type definition items.
* resolve/rust-default-resolver.h
(DefaultResolver::visit): Add overrides for TupleStruct, Union,
and TypeAlias.
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Remove override for Enum.
* resolve/rust-late-name-resolver-2.0.h
(Late::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Rely more on DefaultResolver::visit.
* resolve/rust-toplevel-name-resolver-2.0.h
(TopLevel::visit): Remove override for BlockExpr.
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* hir/rust-hir-dump.cc (Dump::do_qualifiedpathtype): add guard
(Dump::do_traitfunctiondecl): likewise
(Dump::visit): likewise
2025-03-21 Prajwal S N <prajwalnadig21@gmail.com>
* typecheck/rust-hir-type-check.h (class TypeCheckContext): add
header file and use StackedContexts for blocks
* typecheck/rust-typecheck-context.cc: update methods
* typecheck/rust-hir-trait-resolve.cc: refactor function calls
* typecheck/rust-hir-type-check-implitem.cc: refactor function calls
* typecheck/rust-hir-type-check-type.cc: refactor function calls
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.h: Add new Kind enums, remove Node class.
* ast/rust-builtin-ast-nodes.h: Use new Kind enums.
* ast/rust-expr.h (class LoopLabel): Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.h: Likewise.
* expand/rust-macro-builtins-helpers.cc: Likewise.
* expand/rust-macro-builtins-utility.cc (MacroBuiltin::concat_handler): Likewise.
(MacroBuiltin::stringify_handler): Likewise.
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Likewise.
* resolve/rust-early-name-resolver.cc: Likewise.
* hir/rust-ast-lower.cc (ASTLoweringBlock::visit): Likewise.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Add visitor for TraitItemType.
* resolve/rust-toplevel-name-resolver-2.0.h
(TopLevel::visit): Likewise.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-ast-resolve-type.cc (ResolveType::visit): New visitor to handle
ParenthesizedType.
* resolve/rust-ast-resolve-type.h: Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): Likewise.
* typecheck/rust-hir-type-check-type.h: Likewise.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/rust-ast-lower-type.cc (ASTLoweringType::visit): Add implementation for
ParenthesizedType.
* hir/rust-ast-lower-type.h: Declare that new visitor.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-builder-type.cc: Remove inclusion of
rust-make-unique.h.
* ast/rust-ast-builder.cc: Likewise.
(Builder::array): Use std::make_unique instead of
Rust::make_unique.
* ast/rust-ast.cc (Attribute::get_traits_to_derive): Likewise.
* ast/rust-macro.h: Remove inclusion of rust-make-unique.h.
(MacroRulesDefinition::mbe): Use std::make_unique instead of
Rust::make_unique.
(MacroRulesDefinition::decl_macro): Likewise.
* ast/rust-path.h
(PathInExpression::PathInExpression): Likewise.
(QualifiedPathInExpression::QualifiedPathInExpression):
Likewise.
* backend/rust-compile-pattern.cc
(CompilePatternCheckExpr::visit): Likewise.
* expand/rust-derive-copy.cc
(DeriveCopy::copy_impl): Likewise.
* expand/rust-expand-format-args.cc
(expand_format_args): Likewise.
* expand/rust-macro-builtins-asm.cc: Remove inclusion of
rust-make-unique.h.
(parse_asm): Use std::make_unique instead of Rust::make_unique.
* hir/rust-ast-lower-expr.cc
(ASTLoweringExpr::visit): Likewise.
* hir/tree/rust-hir-expr.cc
(StructExprStructFields::StructExprStructFields): Likewise.
(StructExprStructFields::operator=): Likewise.
* hir/tree/rust-hir.cc
(TypePath::to_trait_bound): Likewise.
* lex/rust-token.h: Remove inclusion of rust-make-unique.h.
(Token::Token): Use std::make_unique instead of
Rust::make_unique.
* metadata/rust-import-archive.cc: Remove inclusion of
rust-make-unique.h.
(Import::find_archive_export_data): Use std::make_unique instead
of Rust::make_unique.
* metadata/rust-imports.cc: Remove inclusion of
rust-make-unique.h.
(Import::find_export_data): Use std::make_unique instead of
Rust::make_unique.
(Import::find_object_export_data): Likewise.
* parse/rust-parse-impl.h: Remove inclusion of
rust-make-unique.h.
(Parser::parse_function_param): Use std::make_unique instead of
Rust::make_unique.
(Parser::parse_self_param): Likewise.
(Parser::parse_array_expr): Likewise.
* typecheck/rust-hir-type-check-enumitem.cc
(TypeCheckEnumItem::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.cc
(TypeCheckTopLevelExternItem::visit): Likewise.
(TypeCheckImplItem::visit): Likewise.
* typecheck/rust-hir-type-check-type.cc
(TypeResolveGenericParam::visit): Likewise.
* typecheck/rust-hir-type-check.cc: Remove inclusion of
rust-make-unique.h.
(TraitItemReference::get_type_from_fn): Use std::make_unique
instead of Rust::make_unique.
* typecheck/rust-tyty-bounds.cc
(TypeCheckBase::get_predicate_from_bound): Likewise.
* util/rust-make-unique.h: Removed.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-item.h: Add EnumItem::Kind for differentiating all variants that may be
used inside an enum declaration.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): Visit implicit Self parameters of
traits.
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Resolve implicit Self parameters of traits.
* resolve/rust-late-name-resolver-2.0.h:
(Late::visit): Add trait visitor.
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Insert resolutions for Self type parameters
as well.
2025-03-21 Liam Naddell <liamnprg@gmail.com>
* resolve/rust-late-name-resolver-2.0.cc:
Change the late name resolver to enter proper lexical scope during typechecking
* resolve/rust-late-name-resolver-2.0.h:
Add needed prototype to header
* resolve/rust-toplevel-name-resolver-2.0.cc:
Add generic parameters to enum's scoped RIB to allow for proper name resolution on types.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.cc: Add new functions.
* ast/rust-ast-builder.h: Declare them.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-path.h: Add two new constructors.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-collect-lang-items.cc (CollectLangItems::visit): Add visitor for collecting
functions that might be lang items.
* ast/rust-collect-lang-items.h: Likewise.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-lang-item.h: Add new lang items.
* util/rust-lang-item.cc: Likewise.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-lang-item.h: Add Sync marker trait.
* util/rust-lang-item.cc: Likewise.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* typecheck/rust-hir-type-check-type.cc: Add TODO note.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-ast-resolve-type.cc (ResolveTypeToCanonicalPath::visit): Resolve additional
trait bounds.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Error out properly on unresolved
type-path instead of crashing.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* typecheck/rust-hir-path-probe.cc: Fix typos.
* typecheck/rust-hir-path-probe.h: Likewise.
* typecheck/rust-hir-type-check-path.cc: Likewise.
2025-03-21 Nobel <nobel2073@gmail.com>
* typecheck/rust-casts.cc (TypeCastRules::cast_rules): Add rule.
2025-03-21 Sri Ganesh Thota <sriganeshthota12345@gmail.com>
* ast/rust-item.h: I have changed helper constructor for typepath
to be a delegating constructor.
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-fnparam.cc (CompileFnParam::visit): compile tuple patterns
(CompileSelfParam::compile): update return type
(CompileFnParam::create_tmp_param_var): return Bvariable not tree to stop ICE
* backend/rust-compile-fnparam.h: update prototype
* backend/rust-compile-pattern.cc (CompilePatternBindings::visit): implement TuplePattern
* backend/rust-compile-pattern.h: update prototype
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* rust-gcc.cc (operator_to_tree_code): ! expressions are BIT_NOT_EXPR
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-path.h: Adapt children of Path to fix some NodeId issues.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): New.
* resolve/rust-late-name-resolver-2.0.h: New.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/rust-ast-lower-type.cc (ASTLowerTypePath::translate): Adapt to
handle lang item paths.
(ASTLowerTypePath::visit): Likewise.
(ASTLowerTypePath::translate_type_path): New.
(ASTLowerTypePath::translate_lang_item_type_path): New.
* hir/rust-ast-lower-type.h: Adapt to handle lang item paths.
* resolve/rust-ast-resolve-type.h: Likewise.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Adapt resolver
to lang item paths.
* resolve/rust-ast-resolve-type.h: Likewise.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-item.h: Add new method to specifically get a type-path.
* ast/rust-path.cc (LangItemPath::as_string): Implement properly.
* hir/rust-ast-lower-type.cc (ASTLowerTypePath::translate): Adapt
visitor to use the new LangItemPath.
* hir/rust-ast-lower-type.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Likewise.
* resolve/rust-ast-resolve-type.h: Likewise.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-copy.cc: Use new LangItemPath for derive(Copy).
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-path.h (class LangItemPath): New.
(class TypePath): Adapt to accomodate LangItemPath.
* ast/rust-ast.cc (TraitImpl::as_string): Use new checks for lang items.
(QualifiedPathType::as_string): Likewise.
(FormatArgs::set_outer_attrs): Likewise.
* ast/rust-item.h (class TraitImpl): Likewise.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-forever-stack.h
(ForeverStack::find_starting_point): Use type
'std::reference_wrapper<Node> &' instead of 'Node &' for
parameter starting_point.
* resolve/rust-forever-stack.hxx
(ForeverStack::find_starting_point): Likewise.
(ForeverStack::resolve_path): Handle change to
ForeverStack::find_starting_point.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
Remove unused capture in lambda.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-attributes.h (class Attributes): New.
* util/rust-attributes.cc: Implement Attributes::is_known().
* ast/rust-collect-lang-items.cc (is_known_attribute): Remove.
(get_lang_item_attr): Call Attributes::is_known() instead.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_outer_attributes): Likewise.
(ASTLoweringBase::is_known_attribute): Remove.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Add new object file.
* rust-session-manager.cc (Session::compile_crate): Call CollectLangItems.
* ast/rust-collect-lang-items.cc: New file.
* ast/rust-collect-lang-items.h: New file.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-hir-map.h: Keep a NodeId mappings for lang items.
* util/rust-hir-map.cc (Mappings::insert_lang_item_node): New function.
(Mappings::lookup_lang_item_node): Likewise.
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* hir/rust-hir-dump.cc (Dump::visit): add missing check for no return value
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* backend/rust-constexpr.cc (eval_store_expression): check for null
(eval_call_expression): remove bad warning
* rust-gcc.cc (arithmetic_or_logical_expression): add warnings
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.cc: apply coercion site to result
* backend/rust-compile-base.h: update prototype
* backend/rust-compile-implitem.cc (CompileTraitItem::visit): send in coercion info
* backend/rust-compile-item.cc (CompileItem::visit): likewise
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): remove assertions
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-visitor.h: Replace context with StackedContexts.
* ast/rust-ast-visitor.cc (ContextualASTVisitor::visit): Use new APIs.
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Likewise.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-stacked-contexts.h: Add new method to see what context we are currently in.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/tree/rust-hir-item.h: Remove TraitItemFunc::has_block_defined()
* backend/rust-compile-implitem.cc (CompileTraitItem::visit):
Call TraitItemFunc::has_definition() instead.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-hir-pattern-analysis.cc (PatternChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
* typecheck/rust-hir-trait-resolve.cc (ResolveTraitItemToRef::visit): Likewise.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-hir-map.h: Move definitions from header...
* util/rust-hir-map.cc: ...to source file.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-lang-item.h: Fix comment location to align with other comments.
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): call lauout type directly
* rust-backend.h (struct_type): add optional layout parameter
(union_type): likewise
(fill_in_fields): likewise
* rust-gcc.cc (struct_type): likewise
(union_type): likewise
(fill_in_fields): only layout if we required
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-casts.cc (TypeCastRules::cast_rules): allow casts to float
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): track trait
* typecheck/rust-hir-type-check-implitem.cc: trait block
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): dont when dyn
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): look at Self contenxt
(TypeCheckType::resolve_root_path): track if Self
(TypeCheckType::resolve_associated_type): look at current context for associated types
* typecheck/rust-hir-type-check-type.h: change prototype
* typecheck/rust-hir-type-check.h (class TypeCheckBlockContextItem):
new context system to track current state
* typecheck/rust-typecheck-context.cc (TypeCheckContext::have_block_context): likewise
(TypeCheckContext::peek_block_context): likewise
(TypeCheckContext::push_block_context): likewise
(TypeCheckContext::pop_block_context): likewise
(TypeCheckBlockContextItem::Item::Item): likewise
(TypeCheckBlockContextItem::TypeCheckBlockContextItem): likewise
(TypeCheckBlockContextItem::is_impl_block): likewise
(TypeCheckBlockContextItem::is_trait_block): likewise
(TypeCheckBlockContextItem::get_impl_block): likewise
(TypeCheckBlockContextItem::get_trait): likewise
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* hir/rust-hir-dump.cc (Dump::visit): add missing null checks
2025-03-21 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-base.cc: Prepend crate name to function's ir
name.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-name-resolver.cc: Include options.txt.
(Resolver::insert_resolved_name): Assert that name resolution
2.0 is disabled.
(Resolver::lookup_resolved_name): Likewise.
(Resolver::insert_resolved_type): Likewise.
(Resolver::lookup_resolved_type): Likewise.
(Resolver::insert_resolved_label): Likewise.
(Resolver::lookup_resolved_label): Likewise.
(Resolver::insert_resolved_macro): Likewise.
(Resolver::lookup_resolved_macro): Likewise.
(Resolver::insert_resolved_misc): Likewise.
(Resolver::lookup_resolved_misc): Likewise.
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (check_match_scrutinee): check for empty match
(CompileExpr::visit): fix assertion
* checks/errors/rust-hir-pattern-analysis.cc (check_match_usefulness): check for empty
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): resolve to !
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* hir/rust-hir-dump.cc (Dump::visit): add guards
2025-03-21 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-stmt.h: Remove stdlib include and use rust-system instead.
* backend/rust-compile-expr.cc: Likewise.
* backend/rust-mangle-legacy.cc: Likewise.
* backend/rust-mangle-v0.cc: Likewise.
* hir/rust-hir-dump.cc: Likewise.
* typecheck/rust-hir-type-check-type.cc: Likewise.
* typecheck/rust-tyty.cc: Likewise.
* typecheck/rust-tyty.h: Likewise.
* util/rust-common.h: Likewise.
* util/rust-token-converter.cc: Likewise.
* util/rust-token-converter.h: Likewise.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-hir-type-check-expr.cc: Add includes.
(TypeCheckExpr::visit): Use name resolver 2.0.
(TypeCheckExpr::resolve_operator_overload): Likewise.
(TypeCheckExpr::resolve_fn_trait_call): Likewise.
* typecheck/rust-hir-type-check-path.cc
(TypeCheckExpr::visit): Likewise.
(TypeCheckExpr::resolve_segments): Likewise.
* typecheck/rust-hir-type-check-type.cc
(TypeCheckType::resolve_segments): Likewise.
(ResolveWhereClauseItem::visit): Likewise.
(TypeCheckType::visit): Avoid usage of
Resolver::get_unit_type_node_id when handling TupleType, use
name resolver 2.0 when handling QualifiedPathInType.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Call DefaultResolver::visit when visiting
TypePath.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::check_for_privacy_violation): Use name
resolver 2.0.
2025-03-21 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): Change call.
(CompileExpr::resolve_operator_overload): Update function arguments.
* backend/rust-compile-expr.h: Change the function's prototype to use
a reference wrapper instead of a reference within the optional.
2025-03-21 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* typecheck/rust-tyty.h: Change initializer list to default constructor
call.
2025-03-21 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Add template
to tl::optional.
* hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit): Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::visit):
Likewise.
2025-03-21 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Do not
get a reference if the pattern does not exist.
(TypeCheckMethodCallExpr::check): Likewise.
2025-03-21 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Change the
ternary expression with a more readable if.
2025-03-21 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* typecheck/rust-tyty.h: Reverse monomorphization during cloning and
make a new function to explicitly monomorphize.
* typecheck/rust-tyty.cc: Use monomorphization when required.
2025-03-21 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit): Forward
an optional to the constructor.
* hir/tree/rust-hir-item.cc (TypeParam::TypeParam): Use an optional
in the constructor.
(TypeParam::operator=): Ensure the TypeParam has a type properly.
(TypeParam::get_type_mappings): Likewise.
* hir/tree/rust-hir-item.h: Wrap the type smart pointer into an
optional.
* hir/tree/rust-hir.cc (TypeParam::as_string): Unwrap optional type
correctly.
2025-03-21 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): Call getter
instead of size function.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit):
Only check privacy if the type is present.
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Use an optional.
* hir/tree/rust-hir-generic-param.h: Assert type before getting it.
* hir/tree/rust-hir-item.h: Assert pointers before dereference, fix
has_type condition.
* hir/tree/rust-hir-path.h: Add more assertions.
* hir/tree/rust-hir-stmt.cc: Change constructor with optionals.
* hir/tree/rust-hir-stmt.h: Use optionals over smart pointers to
emphasize these fields might be missing.
* hir/tree/rust-hir.cc (LetStmt::as_string): Use getters.
* typecheck/rust-hir-type-check-expr.cc: Clone structures to prevent
parent's fields from being nulled by the move operation.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Use
optionals.
* typecheck/rust-tyty.cc: Likewise.
* typecheck/rust-tyty.h: Likewise.
2025-03-21 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* Make-lang.in: Add new files.
* hir/tree/rust-hir-item.h: Move Item definition and remove
implementations to their corresponding cc file.
* hir/tree/rust-hir-expr.h: Move implementation to the corresponding
cc file.
* hir/tree/rust-hir-path.h: Likewise.
* hir/tree/rust-hir-pattern.h: Likewise.
* hir/tree/rust-hir-stmt.h: Likewise.
* hir/tree/rust-hir-type.h: Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
* hir/tree/rust-hir.h: Likewise.
* hir/tree/rust-hir.cc (Crate::Crate): Add implementations from Crate
and remove ConstGenericParam implementations to move them to their
own file.
* hir/tree/rust-hir-attrs.h: New file.
* hir/tree/rust-hir-bound-abstract.h: New file.
* hir/tree/rust-hir-bound.h: New file.
* hir/tree/rust-hir-expr-abstract.h: New file.
* hir/tree/rust-hir-expr.cc: New file.
* hir/tree/rust-hir-generic-param.cc: New file.
* hir/tree/rust-hir-generic-param.h: New file.
* hir/tree/rust-hir-item.cc: New file.
* hir/tree/rust-hir-literal.h: New file.
* hir/tree/rust-hir-node.h: New file.
* hir/tree/rust-hir-path.cc: New file.
* hir/tree/rust-hir-pattern-abstract.h: New file.
* hir/tree/rust-hir-simple-path.h: New file.
* hir/tree/rust-hir-stmt.cc: New file.
* hir/tree/rust-hir-trait-bound.h: New file.
* hir/tree/rust-hir-type-abstract.cc: New file.
* hir/tree/rust-hir-type-abstract.h: New file.
* hir/tree/rust-hir-type-no-bounds.h: New file.
* hir/tree/rust-hir-type.cc: New file.
* hir/tree/rust-hir-visibility.h: New file.
* hir/tree/rust-hir-visitable.h: New file.
* checks/lints/rust-lint-marklive.h: Use References.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Reformat
vectors.
* hir/rust-hir-dump.cc (Dump::visit): Use reference.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve):
Use references.
* typecheck/rust-tyty-bounds.cc: Likewise.
2025-03-21 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-base.cc: Use FnParam getter.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* backend/rust-compile-intrinsic.cc: Likewise.
* backend/rust-compile-type.cc: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit):
Only visit childrens if not missing.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Use
a reference instead of a raw pointer.
* hir/tree/rust-hir-expr.h: Add presence function for return
expression.
* hir/tree/rust-hir-item.h: Remove take_param_name.
* hir/tree/rust-hir.h: Make mapping getter const.
* typecheck/rust-hir-dot-operator.cc (MethodResolver::Select): Use
getter.
* typecheck/rust-hir-type-check-expr.cc: Likewise.
* typecheck/rust-hir-type-check-implitem.cc: Use FnParam vector instead
of std::pair of Pattern and BaseType.
* typecheck/rust-hir-type-check-item.cc: Likewise.
* typecheck/rust-hir-type-check.cc: Likewise.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Use getters.
(TypeCheckMethodCallExpr::check): Likewise.
* typecheck/rust-tyty-cmp.h: Likewise.
* typecheck/rust-tyty.cc: Use FnParam.
* typecheck/rust-tyty.h (class FnParam): Add FnParam to handle function
parameters instead of handling std::pairs.
* typecheck/rust-unify.cc (UnifyRules::expect_fndef): Use getters.
(UnifyRules::expect_fnptr): Likewise.
2025-03-21 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-base.cc (HIRCompileBase::compile_function_body):
Remove usage of get function to retrieve a raw pointer.
* backend/rust-compile-base.h:
Change API usage from raw pointer to a reference.
* backend/rust-compile-block.cc (CompileBlock::compile): Likewise.
(CompileBlock::visit): Likewise.
(CompileConditionalBlocks::visit): Likewise.
* backend/rust-compile-block.h: Likewise.
* backend/rust-compile-expr.cc (CompileExpr::Compile): Likewise.
(CompileExpr::visit): Likewise.
(check_match_scrutinee): Likewise.
(CompileExpr::array_value_expr): Likewise.
(CompileExpr::array_copied_expr): Likewise.
(CompileExpr::generate_closure_function): Likewise.
(CompileExpr::generate_possible_fn_trait_call): Likewise.
* backend/rust-compile-expr.h: Likewise.
* backend/rust-compile-fnparam.cc (CompileFnParam::compile): Likewise.
(CompileFnParam::visit): Likewise.
* backend/rust-compile-fnparam.h: Likewise.
* backend/rust-compile-implitem.cc (CompileTraitItem::visit): Likewise.
* backend/rust-compile-intrinsic.cc (compile_fn_params): Likewise.
* backend/rust-compile-item.cc (CompileItem::visit): Likewise.
* backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit):
Likewise.
(compile_range_pattern_bound): Likewise.
(CompilePatternBindings::visit): Likewise.
(CompilePatternLet::visit): Likewise.
* backend/rust-compile-pattern.h: Likewise.
* backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve):
Likewise.
(HIRCompileBase::query_compile): Likewise.
* backend/rust-compile-stmt.cc (CompileStmt::visit): Likewise.
* backend/rust-compile-struct-field-expr.cc (CompileStructExprField::Compile):
Likewise.
(CompileStructExprField::visit): Likewise.
* backend/rust-compile-struct-field-expr.h: Likewise.
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Likewise.
* backend/rust-compile-var-decl.h: Likewise.
* backend/rust-compile.cc: Likewise.
* backend/rust-mangle-v0.cc (v0_inherent_or_trait_impl_path): Likewise.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
Likewise.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-pattern.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-struct.h: Likewise.
* checks/errors/borrowck/rust-bir-builder.h: Likewise.
* checks/errors/borrowck/rust-function-collector.h: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_type_privacy):
Likewise.
(PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* checks/errors/privacy/rust-reachability.cc (ReachabilityVisitor::visit):
Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit):
Likewise.
* checks/lints/rust-lint-marklive.cc (MarkLive::visit): Likewise.
* checks/lints/rust-lint-marklive.h: Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
* hir/tree/rust-hir-item.h: Likewise.
* hir/tree/rust-hir-path.h: Likewise.
* hir/tree/rust-hir-pattern.h: Likewise.
* hir/tree/rust-hir-stmt.h: Likewise.
* hir/tree/rust-hir-type.h: Likewise.
* hir/tree/rust-hir.h: Likewise.
* typecheck/rust-autoderef.cc: Likewise.
* typecheck/rust-hir-dot-operator.cc (MethodResolver::select):
Likewise.
* typecheck/rust-hir-inherent-impl-overlap.h: Likewise.
* typecheck/rust-hir-path-probe.cc (PathProbeType::process_impl_item_candidate):
Likewise.
(PathProbeImplTrait::process_trait_impl_items_for_candidates): Likewise.
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait):
Likewise.
(TraitItemReference::resolve_item): Likewise.
* typecheck/rust-hir-type-check-base.cc: Likewise.
* typecheck/rust-hir-type-check-base.h: Likewise.
* typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::Resolve):
Likewise.
(TypeCheckEnumItem::visit): Likewise.
* typecheck/rust-hir-type-check-enumitem.h: Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::Resolve):
Likewise.
(TypeCheckExpr::visit): Likewise.
(TypeCheckExpr::resolve_fn_trait_call): Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::Resolve):
Likewise.
(TypeCheckTopLevelExternItem::visit): Likewise.
(TypeCheckImplItem::visit): Likewise.
(TypeCheckImplItemWithTrait::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.h: Likewise.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Likewise.
(TypeCheckItem::resolve_impl_item): Likewise.
(TypeCheckItem::resolve_impl_block_substitutions): Likewise.
(TypeCheckItem::resolve_impl_block_self): Likewise.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): Likewise.
(TypeCheckExpr::resolve_segments): Likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::Resolve):
Likewise.
(TypeCheckPattern::visit): Likewise.
(ClosureParamInfer::Resolve): Likewise.
(ClosureParamInfer::visit): Likewise.
* typecheck/rust-hir-type-check-pattern.h: Likewise.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::Resolve):
Likewise.
(TypeCheckStmt::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.h: Likewise.
* typecheck/rust-hir-type-check-struct-field.h: Likewise.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::TypeCheckStructExpr):
Likewise.
(TypeCheckStructExpr::Resolve): Likewise.
(TypeCheckStructExpr::resolve): Likewise.
(TypeCheckStructExpr::visit): Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckResolveGenericArguments::resolve):
Likewise.
(TypeCheckType::Resolve): Likewise.
(TypeCheckType::visit): Likewise.
(TypeCheckType::resolve_root_path): Likewise.
(TypeResolveGenericParam::Resolve): Likewise.
(TypeResolveGenericParam::visit): Likewise.
(ResolveWhereClauseItem::visit): Likewise.
* typecheck/rust-hir-type-check-type.h: Likewise.
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn):
Likewise.
* typecheck/rust-hir-type-check.h: Likewise.
* typecheck/rust-type-util.cc (query_type): Likewise.
* typecheck/rust-typecheck-context.cc (TypeCheckContextItem::TypeCheckContextItem):
Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Likewise.
(TypeCheckBase::get_predicate_from_bound): Likewise.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise.
(TypeCheckMethodCallExpr::go): Likewise.
(TypeCheckMethodCallExpr::check): Likewise.
* typecheck/rust-tyty-subst.cc: Likewise.
* typecheck/rust-tyty.cc (BaseType::monomorphized_clone): Likewise.
(VariantDef::VariantDef): Remove copy constructor.
(VariantDef::operator=): Change to move operator.
(VariantDef::get_discriminant): Replace return type to a reference
instead of a reference to a unique pointer.
(VariantDef::clone): Change to references.
(VariantDef::monomorphized_clone): Likewise.
(FnType::as_string): Likewise.
(FnType::clone): Likewise.
* typecheck/rust-tyty.h: Likewise.
* util/rust-hir-map.cc (Mappings::insert_hir_impl_block): Likewise.
* backend/rust-compile-asm.cc: Use a reference instead of the raw
pointer value.
* checks/errors/borrowck/rust-bir-builder-pattern.cc: Use references.
* checks/errors/rust-hir-pattern-analysis.cc: Likewise.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Use DefaultResolver::visit and avoid a call
to Identifier::as_string while handling instances of StaticItem.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-forever-stack.h
(ForeverStack::push): Accept argument of type Rib::Kind rather
than Rib.
* resolve/rust-forever-stack.hxx
(ForeverStack::push): Likewise.
* resolve/rust-name-resolution-context.cc
(NameResolutionContext::scoped): Likewise.
* resolve/rust-name-resolution-context.h
(NameResolutionContext::scoped): Likewise.
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::resolve_impl_block_substitutions):
dont check for unconstrained when the self is not resolved
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
remove bad debug error diagnostic
* typecheck/rust-tyty-subst.cc: likewise
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-expr.h: Remove invalid usage of `struct`.
* backend/rust-compile-asm.h: Remove unused `translated` member.
* backend/rust-compile-asm.cc (CompileAsm::CompileAsm): Remove usage
of `translated` member.
* checks/errors/rust-unsafe-checker.h: Mark visitor as `override`.
* hir/tree/rust-hir-expr.h (struct AnonConst): Remove unused `locus`
member.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* typecheck/rust-tyty-call.h: Remove unused context member.
2025-03-21 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/tree/rust-hir.h: Add override qualifier to overriden method.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-item.h
(Trait::self_param): Add.
(Trait::Trait): Initialize self_param.
(Trait::operator=): Copy self_param.
(Trait::insert_implicit_self): Remove.
(Trait::get_implicit_self): Add.
* hir/rust-ast-lower-item.cc
(ASTLoweringItem::visit): Make sure implicit self is still
lowered to HIR.
* resolve/rust-ast-resolve-item.cc
(ResolveItem::visit): Adjust handling of implicit self.
* resolve/rust-early-name-resolver.cc
(EarlyNameResolver::visit): Add commit to Trait visitor
mentioning that implicit self is not visited.
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Remove call to Trait::insert_implicit_self.
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): fix the ty_id
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty.cc (PlaceholderType::can_resolve): check for empty mappings
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* checks/errors/privacy/rust-privacy-reporter.cc:
Include rust-immutable-name-resolution-context.h.
(is_child_module): Use ForeverStack::is_module_descendant if name
resolution 2.0 is enabled.
* resolve/rust-forever-stack.h
(ForeverStack::is_module_descendant): Add.
(ForeverStack::dfs_node): Add.
* resolve/rust-forever-stack.hxx
(ForeverStack::dfs_rib): Use ForeverStack::dfs_node.
(ForeverStack::dfs_node): Add.
(ForeverStack::is_module_descendant): Add.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* checks/errors/privacy/rust-visibility-resolver.cc:
Add includes.
(VisibilityResolver::resolve_module_path): Use name resolver 2.0
(when enabled) to lookup path resolutions.
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path): dont infer here
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Handle StructExprStruct and use
ForeverStack::resolve_path instead of ForeverStack::get to
resolve struct expression paths.
* resolve/rust-late-name-resolver-2.0.h
(Late::visit): Handle StructExprStruct.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-context.cc
(Context::setup_builtins): Use TypeCheckContext::get_builtins
instead of Resolver::get_builtin_types,
TypeCheckContext::lookup_type_by_node_id, and
TypeCheckContext::lookup_type.
* typecheck/rust-hir-type-check.h
(TypeCheckContext::get_builtins): Add.
* typecheck/rust-typecheck-context.cc
(TypeCheckContext::get_builtins): Add.
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): remove hack
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-tyty.cc
(TupleType::get_unit_type): Remove parameter, cache return
value.
* typecheck/rust-tyty.h
(TupleType::get_unit_type): Remove parameter.
* resolve/rust-late-name-resolver-2.0.cc
(Late::setup_builtin_types): Adjust calls to get_unit_type.
* resolve/rust-name-resolver.cc
(Resolver::generate_builtins): Likewise.
* typecheck/rust-hir-type-check-expr.cc
(TypeCheckExpr::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.cc
(TypeCheckTopLevelExternItem::visit): Likewise.
(TypeCheckImplItem::visit): Likewise.
* typecheck/rust-hir-type-check-item.cc
(TypeCheckItem::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.cc
(TypeCheckStmt::visit): Likewise.
* typecheck/rust-hir-type-check-type.cc
(TypeCheckType::visit): Likewise.
* typecheck/rust-hir-type-check.cc
(TraitItemReference::get_type_from_fn): Likewise.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Handle SelfParam.
* resolve/rust-late-name-resolver-2.0.h
(Late::visit): Likewise.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-hir-trait-resolve.cc: Add includes.
(TraitResolver::resolve_path_to_trait):
Use name resolution 2.0 resolver when enabled.
2025-03-21 Marc Poulhiès <dkm@kataplop.net>
* backend/rust-compile-block.h: Adjust after removal of
HIR::IfLetExpr and HIR::IfLetExprConseqElse.
* backend/rust-compile-expr.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc
(ExprStmtBuilder::visit): Likewise.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h:
Likewise.
* checks/errors/borrowck/rust-bir-builder-struct.h: Likewise.
* checks/errors/borrowck/rust-function-collector.h: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit):
Likewise.
* checks/errors/rust-const-checker.h: Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit):
Likewise.
* checks/errors/rust-unsafe-checker.h: Likewise.
* hir/rust-ast-lower-block.h (ASTLoweringIfLetBlock::translate):
Change return type.
* hir/rust-ast-lower.cc (ASTLoweringIfLetBlock::desugar_iflet):
New.
(ASTLoweringIfLetBlock::visit(AST::IfLetExpr &)): Adjust and use
desugar_iflet.
* hir/rust-ast-lower.h: Add comment.
* hir/rust-hir-dump.cc (Dump::do_ifletexpr): Remove.
(Dump::visit(IfLetExpr&)): Remove.
(Dump::visit(IfLetExprConseqElse&)): Remove.
* hir/rust-hir-dump.h (Dump::do_ifletexpr): Remove.
(Dump::visit(IfLetExpr&)): Remove.
(Dump::visit(IfLetExprConseqElse&)): Remove.
* hir/tree/rust-hir-expr.h (class IfLetExpr): Remove.
(class IfLetExprConseqElse): Remove.
* hir/tree/rust-hir-full-decls.h (class IfLetExpr): Remove.
(class IfLetExprConseqElse): Remove.
* hir/tree/rust-hir-visitor.h: Adjust after removal of
HIR::IfLetExpr and HIR::IfLetExprConseqElse.
* hir/tree/rust-hir.cc (IfLetExpr::as_string): Remove.
(IfLetExprConseqElse::as_string): Remove.
(IfLetExpr::accept_vis): Remove.
(IfLetExprConseqElse::accept_vis): Remove.
* hir/tree/rust-hir.h: Adjust after removal of HIR::IfLetExpr and
HIR::IfLetExprConseqElse.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* checks/errors/rust-hir-pattern-analysis.cc
(PatternChecker::visit (IfLetExpr &)): Remove.
(PatternChecker::visit (IfLetExprConseqElse &)): Remove.
* checks/errors/rust-hir-pattern-analysis.h (visit(IfLetExpr &)): Remove.
(visit(IfLetExprConseqElse &)): Remove.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* checks/errors/rust-unsafe-checker.cc: Add includes.
(UnsafeChecker::visit): Use 2.0 version of resolver when name
resolution 2.0 is enabled.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-implitem.cc
(CompileTraitItem::visit): Use name resolver 2.0 (when enabled)
to obtain canonical paths for instances of TraitItemConst and
TraitItemFunc.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-hir-type-check.cc: Add includes.
(TraitItemReference::get_type_from_fn): Use
ForeverStack::to_canonical_path when name resolution 2.0 is
enabled.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-path.h
(PathIdentSegment::is_super_segment): Rename to...
(PathIdentSegment::is_super_path_seg): ...here.
(PathIdentSegment::is_crate_segment): Rename to...
(PathIdentSegment::is_crate_path_seg): ...here.
(PathIdentSegment::is_lower_self): Rename to...
(PathIdentSegment::is_lower_self_seg): ...here.
(PathIdentSegment::is_big_self): Rename to...
(PathIdentSegment::is_big_self_seg): ...here.
(PathExprSegment::is_super_path_seg): Handle renames.
(PathExprSegment::is_crate_path_seg): Likewise.
(PathExprSegment::is_lower_self_seg): Likewise.
(TypePathSegment::is_crate_path_seg): Likewise.
(TypePathSegment::is_super_path_seg): Likewise.
(TypePathSegment::is_big_self_seg): Likewise.
(TypePathSegment::is_lower_self_seg): Likewise.
* ast/rust-ast-collector.cc
(TokenCollector::visit): Likewise.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Visit the initialization expressions of let
statements before visiting their patterns.
2025-03-21 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Insert trait names into the type namespace.
2025-03-21 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-reference.h: new get locus helper
* typecheck/rust-hir-trait-resolve.cc (AssociatedImplTrait::get_locus): implemention
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::resolve_operator_overload):
fix overload
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Handle ExternalStaticItem.
* resolve/rust-toplevel-name-resolver-2.0.h
(TopLevel::visit): Likewise.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* checks/errors/rust-hir-pattern-analysis.cc: Add includes.
(PatternChecker::visit): Use name resolver 2.0 when enabled.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-expr.cc
(CompileExpr::visit): Use name resolver 2.0 to lookup label
definitions for break and continue statements when name
resolution 2.0 is enabled.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* checks/errors/rust-const-checker.cc: Add includes.
(ConstChecker::visit): Use name resolver 2.0 to lookup
function definitions when name resolution 2.0 is enabled.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Load unloaded modules before attempting to
visit their items.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-forever-stack.h
(ForeverStack::to_canonical_path): Make const.
(ForeverStack::to_rib): Add const overload.
(ForeverStack::reverse_iter): Add const overloads.
(ForeverStack::ConstDfsResult): Add.
(ForeverStack::dfs): Add const overload.
(ForeverStack::dfs_rib): Likewise.
* resolve/rust-forever-stack.hxx
(ForeverStack::reverse_iter): Add const overloads.
(ForeverStack::dfs): Add const overload.
(ForeverStack::to_canonical_path): Make const.
(ForeverStack::dfs_rib): Likewise.
(ForeverStack::to_rib): Add const overload.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* checks/lints/rust-lint-marklive.cc
(MarkLive::visit_path_segment): Use name resolver 2.0 when
enabled.
(MarkLive::visit): Likewise.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Handle ConstGenericParam.
* resolve/rust-toplevel-name-resolver-2.0.h
(TopLevel::visit): Likewise.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Visit GenericArgs and GenericArg, the former
because the latter involves a non-virtual member function call.
* resolve/rust-late-name-resolver-2.0.h
(Late::visit): Likewise.
2025-03-19 badumbatish <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_reg_operand_in): Fix
compiler error on ast wrong implicit construct push_back
2025-03-19 badumbatish <tanghocle456@gmail.com>
* backend/rust-compile-asm.cc (CompileAsm::asm_construct_inputs):
Provide input operand for gccrs
* expand/rust-macro-builtins-asm.cc (parse_reg_operand_in):
Move expr to In
(expand_inline_asm_strings):
Add comments to debug strings
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-hir-type-check-pattern.cc: Add includes.
(TypeCheckPattern::visit): Use name resolver 2.0 if enabled.
* resolve/rust-name-resolution-context.cc
(NameResolutionContext::lookup): Make const qualified.
* resolve/rust-name-resolution-context.h
(NameResolutionContext::lookup): Likewise.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Allow IdentifierExpr and PathInExpression to
reference types as well as values, remove ability for
IdentifierExpr to reference labels.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): Visit fields of InlineAsm.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-item.cc
(CompileItem::visit): Check canonical path of StaticItem
properly when name resolution 2.0 is enabled.
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Insert static items into the value namespace.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-expr.h
(InlineAsmOperand): Replace multiple mutually-exclusive tl::optional
fields with a std::unique_ptr and modify nested classes to allow
this. Also, make getters return references where possible.
* expand/rust-macro-builtins-asm.cc
(parse_reg_operand_out): Pass location when constructing
InlineAsmOperand.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Handle TypeAlias.
* resolve/rust-toplevel-name-resolver-2.0.h
(TopLevel::visit): Likewise.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-hir-type-check-enumitem.cc: Add includes.
(TypeCheckEnumItem::visit): Fetch canonical paths properly when
name resolution 2.0 is enabled.
* typecheck/rust-hir-type-check-implitem.cc: Add includes.
(TypeCheckImplItem::visit): Fetch canonical paths properly when
name resolution 2.0 is enabled.
* typecheck/rust-hir-type-check-item.cc: Add include.
(TypeCheckItem::visit): Fetch canonical paths properly when name
resolution 2.0 is enabled.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-finalize-imports-2.0.cc
(GlobbingVisitor::visit): Replace calls to insert_shadowable with
insert_globbed.
* resolve/rust-forever-stack.h
(ForeverStack::insert_globbed): Add.
* resolve/rust-forever-stack.hxx
(ForeverStack::insert_globbed): Add.
(ForeverStack::dfs): Handle modifications to Rib::Definition
fields.
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Make IdentifierPattern-based declarations
shadowable.
* resolve/rust-name-resolution-context.cc
(NameResolutionContext::insert_globbed): Add.
* resolve/rust-name-resolution-context.h
(NameResolutionContext::insert_globbed): Add.
* resolve/rust-rib.cc
(Rib::Definition::Definition): Use Rib::Definition::Mode to
indicate shadowing mode instead of boolean, handle modifications
to Rib::Definition fields.
(Rib::Definition::is_ambiguous): Handle modifications to
Rib::Definition fields.
(Rib::Definition::to_string): Likewise.
(Rib::Definition::Shadowable): Handle changed constructor
signature.
(Rib::Definition::NonShadowable): Likewise.
(Rib::Definition::Globbed): Add.
(Rib::insert): Handle changes to Rib::Definition fields.
* resolve/rust-rib.h
(Rib::Definition::Globbed): Add.
(Rib::Definition::ids): Remove.
(Rib::Definition::ids_shadowable): Add.
(Rib::Definition::ids_non_shadowable): Add.
(Rib::Definition::ids_globbed): Add.
(Rib::Definition::get_node_id): Handle modifications to
Rib::Definition fields.
(Rib::Definition::Mode): Add.
(Rib::Definition::Definition): Use Rib::Definition::Mode to
indicate shadowing mode instead of boolean.
2025-03-19 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait):
use error handling instead of assertion
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): reuse trait reference
* typecheck/rust-hir-type-check-item.h: update prototype
2025-03-19 Philip Herron <herron.philip@googlemail.com>
* resolve/rust-ast-resolve-type.cc (ResolveTypeToCanonicalPath::visit): add unit-type catch
* resolve/rust-ast-resolve-type.h: likewise
2025-03-19 Philip Herron <herron.philip@googlemail.com>
* Make-lang.in: new objects
* ast/rust-ast-builder.cc (Builder::generic_type_path_segment): new helper
(Builder::single_generic_type_path): likewise
(Builder::new_type): likewise
(Builder::new_lifetime_param): likewise
(Builder::new_type_param): likewise
(Builder::new_lifetime): likewise
(Builder::new_generic_args): likewise
* ast/rust-ast-builder.h: new helper decls
* ast/rust-ast.h: new const getters
* ast/rust-path.h: likewise
* ast/rust-type.h: likewise
* expand/rust-derive-clone.cc (DeriveClone::clone_impl): take the types generics
(DeriveClone::visit_tuple): likewise
(DeriveClone::visit_struct): likewise
(DeriveClone::visit_union): likewise
* expand/rust-derive-clone.h: update header
* expand/rust-derive-copy.cc (DeriveCopy::copy_impl): similarly take type generics
(DeriveCopy::visit_struct): likewise
(DeriveCopy::visit_tuple): likewise
(DeriveCopy::visit_enum): likewise
(DeriveCopy::visit_union): likewise
* expand/rust-derive-copy.h: likewse
* ast/rust-ast-builder-type.cc: New file.
* ast/rust-ast-builder-type.h: New file.
2025-03-19 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* rust-session-manager.cc (Session::expansion): Break on error after
top level name resolution.
2025-03-19 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Resolve
TypeParam.
* resolve/rust-toplevel-name-resolver-2.0.h: Add visit function
prototype.
2025-03-19 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h: Node id getter could be const.
2025-03-19 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-late-name-resolver-2.0.h: Add visit function prototype.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Change resolved
type segment.
2025-03-19 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Remove
assertion and explicitely tells why we ignore the insertion result.
2025-03-19 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* Make-lang.in: Add new rust-bir-builder-pattern file.
* checks/errors/borrowck/rust-bir-builder-pattern.h: Remove
implementation.
* checks/errors/borrowck/rust-bir-builder-pattern.cc: New file.
2025-03-19 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-visitor.h: Make visit functions public.
2025-03-19 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-finalize-imports-2.0.h: Add parent member functions
from default resolver.
2025-03-19 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Use
default visitor instead.
2025-03-19 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove
default visit code and replace it with call to default visitor.
* resolve/rust-default-resolver.h: Remove removed function's
prototypes.
2025-03-19 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove
empty visit function implementations.
* resolve/rust-default-resolver.h: Remove corresponding prototypes.
2025-03-19 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-default-resolver.h: Make most visit function override.
2025-03-19 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc (Early::Early): Add dirty
flag initialization.
(Early::go): Set dirty flag using top level resolver.
* resolve/rust-early-name-resolver-2.0.h: Add dirty flag.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::TopLevel):
Initialize dirty flag.
(TopLevel::insert_or_error_out): Set dirty flag on successful
namespace modification.
* resolve/rust-toplevel-name-resolver-2.0.h: Add dirty flag.
* rust-session-manager.cc (Session::expansion): Modify fixed point
condition to include name resolution modifications.
2025-03-19 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-rib.cc (Rib::insert): Emit an error when trying to
insert an already inserted node.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-early-name-resolver-2.0.h: New class for imports.
* resolve/rust-finalize-imports-2.0.cc (finalize_simple_import): Use
the new API.
(finalize_glob_import): Likewise.
(finalize_rebind_import): Likewise.
(FinalizeImports::FinalizeImports): Likewise.
(FinalizeImports::visit): Likewise.
* resolve/rust-finalize-imports-2.0.h: Likewise.
* resolve/rust-early-name-resolver-2.0.cc (Early::resolve_glob_import): Likewise.
(Early::resolve_simple_import): Likewise.
(Early::resolve_rebind_import): Likewise.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc (Early::resolve_simple_import):
Insert import in all namespaces where they were resolved.
(Early::resolve_rebind_import): Likewise.
* resolve/rust-early-name-resolver-2.0.h: Improve APIs, make them
accept multiple resolutions.
* resolve/rust-finalize-imports-2.0.cc: Handle multiple resolutions.
* resolve/rust-name-resolution-context.h (resolve_path): Remove function.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes):
Store errors for later.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-finalize-imports-2.0.cc (FinalizeImports::go): Turn
static method into method.
(FinalizeImports::visit): New.
* resolve/rust-finalize-imports-2.0.h (class FinalizeImports): Make
FinalizeImports a visitor.
* resolve/rust-early-name-resolver-2.0.cc (Early::go): Use new FinalizeImports API.
(Early::resolve_glob_import): Use new API.
(Early::resolve_simple_import): Likewise.
(Early::resolve_rebind_import): Likewise.
(Early::build_import_mapping): Likewise.
* resolve/rust-early-name-resolver-2.0.h: Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.h: Likewise.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add debug call.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Store
imports using the new classes.
* resolve/rust-toplevel-name-resolver-2.0.h: Use new classes.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc (Early::resolve_glob_import):
Use ImportData class.
(Early::resolve_simple_import): Likewise.
(Early::resolve_rebind_import): Likewise.
(Early::build_import_mapping): Likewise.
* resolve/rust-early-name-resolver-2.0.h: Likewise.
* resolve/rust-finalize-imports-2.0.cc (finalize_simple_import): Likewise.
(finalize_glob_import): Likewise.
(finalize_rebind_import): Likewise.
(FinalizeImports::go): Likewise.
* resolve/rust-finalize-imports-2.0.h: Likewise.
* resolve/rust-name-resolution-context.h: Likewise.
* resolve/rust-rib.h: Define ImportData class.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Add new object file.
* ast/rust-item.h: Constify method.
* resolve/rust-early-name-resolver-2.0.cc (Early::go): Call into
the imports finalizer.
(Early::resolve_glob_import): Remove old resolution.
(Early::resolve_rebind_import): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::go):
New function.
(GlobbingVisitor::visit): Likewise.
(TopLevel::visit): Do not call into handle_use_* functions anymore.
* resolve/rust-toplevel-name-resolver-2.0.h (class GlobbingVisitor):
New.
* resolve/rust-finalize-imports-2.0.cc: New file.
* resolve/rust-finalize-imports-2.0.h: New file.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc (Early::resolve_glob_import): New function.
(Early::resolve_simple_import): Likewise.
(Early::resolve_rebind_import): Likewise.
(Early::build_import_mapping): Likewise.
* resolve/rust-early-name-resolver-2.0.h: Add declarations and list of imports to
resolve.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_glob): Remove function,
which is now being handled by the Early name resolver.
(TopLevel::handle_use_dec): Likewise.
(TopLevel::handle_rebind): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.h: Likewise, and add functions for creating
import list and fetching it.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc: Comment out handle_use
call and error emission.
* resolve/rust-toplevel-name-resolver-2.0.h: Create ImportKind class.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_dec):
Add notes on the problem.
* resolve/rust-toplevel-name-resolver-2.0.h: Likewise.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Do not
visit self's type if it does not have one.
2025-03-19 Philip Herron <herron.philip@googlemail.com>
* hir/rust-ast-lower-type.cc (ASTLowerQualifiedPathInType::visit):
check for valid as segment
2025-03-19 Philip Herron <herron.philip@googlemail.com>
* resolve/rust-ast-resolve-type.cc (ResolveType::visit):
handle never type
(ResolveTypeToCanonicalPath::visit): likewise
* resolve/rust-ast-resolve-type.h: missing never type
* resolve/rust-name-resolver.cc (Resolver::generate_builtins):
track never type node_id
(Resolver::setup_builtin): likewise
* resolve/rust-name-resolver.h: new never type getter
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-default-resolver.cc
(DefaultResolver::visit): Remove some empty overloads which
DefaultASTVisitor::visit should be able to handle.
* resolve/rust-default-resolver.h
(DefaultResolver::visit): Likewise.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* util/optional.h
(optional): Add assertions to dereference operator overloads
when C++14 is available.
2025-03-19 Marc Poulhiès <dkm@kataplop.net>
* hir/rust-hir-dump.cc (Dump::visit): Add missing fields.
2025-03-19 Philip Herron <herron.philip@googlemail.com>
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): the polarity was reversed
* typecheck/rust-hir-type-check-item.cc: check the polarity
2025-03-19 benjamin.thos <benjamin.thos@epita.fr>
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Add
implementation of error propagation visitor
* resolve/rust-ast-resolve-expr.h: Add prototype of error
propagation
2025-03-19 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add optional
check.
2025-03-19 JoanVC <github-91yu@joanvc.cat>
* backend/rust-compile-expr.cc
2025-03-19 JoanVC <github-91yu@joanvc.cat>
* backend/rust-compile-expr.cc: Fix range checking for both integers and floats.
* hir/tree/rust-hir-expr.h: Add "negative_number" boolean to LiteralExpr class.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-session-manager.cc (Session::compile_crate): Use less repetition,
fix a typo in `reports`, fix word order.
2025-03-19 benjamin.thos <benjamin.thos@epita.fr>
* checks/errors/rust-feature-gate.cc (FeatureGate::visit): Emit error
on trait when auto field member true.
* checks/errors/rust-feature-gate.h: add prototype of trait visitor.
* checks/errors/rust-feature.cc (Feature::create): add
optin_builtin_traits in match of feature.
2025-03-19 Raiki Tamura <tamaron1203@gmail.com>
* Make-lang.in: Add rust-hir-pattern-analysis.o.
* rust-session-manager.cc (Session::compile_crate):
Add pattern analysis pass.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
Do typecheck for subpatterns.
* checks/errors/rust-hir-pattern-analysis.cc: New file.
* checks/errors/rust-hir-pattern-analysis.h: New file.
2025-03-19 Liam Naddell <liam.naddell@mail.utoronto.ca>
* backend/rust-compile.cc:
Modify compute_address_for_trait_item to support supertraits
* typecheck/rust-tyty.cc:
Remove auto
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Use strong
type instead of size_t.
(Dump::visit_place): Likewise.
(Dump::visit_scope): Likewise.
* checks/errors/borrowck/rust-bir-dump.h (class Dump): Use
IndeVec for place_map.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-dump.cc (simplify_cfg):
Used `IndexVec` for bb_fold_map.
(Dump::go): Use strong type as index instead of value as now we
are using `IndexVec`.
(Dump::visit): Likewise.
* checks/errors/borrowck/rust-bir-dump.h (class Dump): Use
`IndexVec` for bb_fold_map.
* checks/errors/borrowck/rust-bir-place.h: Add constructor for
`IndexVec` that can reserve size.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-place.h: Use strong types as
index.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc
(ExprStmtBuilder::visit): Use strong type as index and
remove access to numeric value.
* checks/errors/borrowck/rust-bir-builder-internal.h
(struct BuilderContext): Likewise.
* checks/errors/borrowck/rust-bir-dump.cc (simplify_cfg):
Likewise.
(Dump::go): Likewise.
(Dump::visit): Likewise.
* checks/errors/borrowck/rust-bir-fact-collector.h
(class FactCollector): Likewise.
(points): Likewise.
* checks/errors/borrowck/rust-bir.h (struct BasicBlockId): Used
IndexVec for BasicBlocks.
(struct Function): Likewise.
* checks/errors/borrowck/rust-borrow-checker-diagnostics.cc
(BorrowCheckerDiagnostics::get_statement): Change the extracted
index to strong type.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-place.h: Used `IndexVec` with
ScopeId as index.
* checks/errors/borrowck/rust-borrow-checker-diagnostics.cc
(BorrowCheckerDiagnostics::get_loan): Convert Polonius::Loan to
BIR::Loan, so we can use it as index.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-place.h:
Used `IndexVec` with ScopeId as index.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-place.h (struct Loan):
Introduce new class `IndexVec` inspired from IndexVec of rust.
It acts as a wrapper around `std::vector` and lets user specify
a strong type to use as index.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
Use value of BasicBlockId as index.
* checks/errors/borrowck/rust-bir-builder-internal.h (struct BuilderContext):
Likewise.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h:
Initialize with ENTRY_BASIC_BLOCK.
* checks/errors/borrowck/rust-bir-dump.cc (simplify_cfg):
Use value of BasicBlockId as index.
(Dump::go): Likewise.
(Dump::visit): Likewise.
* checks/errors/borrowck/rust-bir-fact-collector.h (class FactCollector):
Initialize with ENTRY_BASIC_BLOCK.
(points): Use value of BasicBlockId as index.
* checks/errors/borrowck/rust-bir.h (struct BasicBlockId):
BasicBlockId is a struct now.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc
(ExprStmtBuilder::setup_loop): Use value of ScopeId.
(ExprStmtBuilder::visit): Use continue scope id instead of
continue basic block id.
* checks/errors/borrowck/rust-bir-builder-internal.h: Use value
of ScopeId.
* checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Use
ROOT_VALUE instead of hardcoded 0.
(Dump::visit_scope): Use value of ScopeId.
* checks/errors/borrowck/rust-bir-place.h (struct ScopeId):
ScopeId is now a struct.
(std::numeric_limits::max): Set invalid ScopeId.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-dump.cc (Dump::visit): Use new
API, i.e get_loan_id() instead of get_loan().
* checks/errors/borrowck/rust-bir-fact-collector.h (points): Use
value of LoanId in Polonius facts.
* checks/errors/borrowck/rust-bir-place.h (struct LoanId):
LoanId is a struct now.
* checks/errors/borrowck/rust-bir.h (class AbstractExpr): Use
new API, as we are getting a LoanId and not a loan itself.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-builder-internal.h: Use
FreeRegions instead of making a temporary vector of FreeRegion.
* checks/errors/borrowck/rust-bir-builder.h: Likewise.
* checks/errors/borrowck/rust-bir-fact-collector.h (class FactCollector):
Likewise.
(points): Likewise.
* checks/errors/borrowck/rust-bir-free-region.h: Remove obsolete
set_from() helpers, add push_back().
* checks/errors/borrowck/rust-bir-place.h: Use FreeRegions
instead of making a temporary vector of Origin.
* typecheck/rust-tyty-variance-analysis-private.h: Change type
of `regions`.
* typecheck/rust-tyty-variance-analysis.cc (CrateCtx::query_type_regions):
Use new type.
(GenericTyPerCrateCtx::query_generic_variance): Likewise.
(TyVisitorCtx::add_constraints_from_generic_args): Likewise.
(FieldVisitorCtx::add_constraints_from_region): Likewise.
(FieldVisitorCtx::add_constrints_from_param): Likewise.
* typecheck/rust-tyty-variance-analysis.h: Likewise.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-builder-internal.h: Use
STATIC_FREE_REGION, use value of FreeRegion for origin.
* checks/errors/borrowck/rust-bir-builder.h: Use free region
value.
* checks/errors/borrowck/rust-bir-dump.cc (Dump::visit_scope):
Likewise.
* checks/errors/borrowck/rust-bir-fact-collector.h (points):
Likewise.
* checks/errors/borrowck/rust-bir-free-region.h (struct FreeRegion):
Make FreeRegion a struct.
* checks/errors/borrowck/rust-bir-place.h: Use FreeRegion
instead of Origin in PlaceDB.
* typecheck/rust-tyty-variance-analysis.cc (FieldVisitorCtx::add_constraints_from_region):
Use value of FreeRegion for origin.
(FieldVisitorCtx::add_constrints_from_param): Likewise.
(Term::make_transform): Likewise.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-dump.cc (renumber_places):
Use value of PlaceId as index.
(Dump::visit_place): Likewise.
(Dump::visit_scope): Likewise.
(Dump::go): Refill `place_map` with for loop instead of
using std::iota().
* checks/errors/borrowck/rust-bir-fact-collector.h (points): Use
value as index.
* checks/errors/borrowck/rust-bir-place.h (struct PlaceId):
PlaceId is now a class holding a uint32_t value. Overloaded
comparision operators for easier comparision.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-ast-resolve-pattern.cc
(PatternDeclaration::check_bindings_consistency): Check if
outer_bindings_map contains an entry before indexing.
2025-03-19 Owen Avery <powerboat9.gamer@gmail.com>
* util/rust-canonical-path.h
(CanonicalPath::CanonicalPath): Properly initialize crate_num
with copy constructor.
2025-03-19 badumbatish <tanghocle456@gmail.com>
* backend/rust-compile-asm.cc (CompileAsm::visit):
Change API, public/private, comments, formatting from code
review
(CompileAsm::asm_build_expr): Likewise.
(CompileAsm::tree_codegen_asm): Likewise.
* backend/rust-compile-asm.h (class CompileAsm): Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise.
* expand/rust-macro-builtins-asm.cc (strip_double_quotes): Likewise.
(parse_options): Likewise.
(parse_asm_arg): Likewise.
(expand_inline_asm_strings): Likewise.
(parse_asm): Likewise.
* expand/rust-macro-builtins-asm.h (strip_double_quotes): Likewise.
(expand_inline_asm_strings): Likewise.
(expand_inline_asm_string): Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
2025-03-19 badumbatish <tanghocle456@gmail.com>
* backend/rust-compile-asm.cc (CompileAsm::asm_build_expr):
Remove debug
* expand/rust-macro-builtins-asm.cc (expand_inline_asm_strings):
properly formatted via rust instead of c
(parse_asm): formatted comment
(parse_format_strings): formatted comment
* hir/tree/rust-hir-expr.h: fix is_simple_asm()
2025-03-19 badumbatish <tanghocle456@gmail.com>
* backend/rust-compile-asm.cc (CompileAsm::asm_build_expr):
Use's array type when constring string tree
(CompileAsm::asm_construct_string_tree):
Use's array type when constring string tree
2025-03-19 badumbatish <tanghocle456@gmail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Added noreturn checking for nevertype
2025-03-19 badumbatish <tanghocle456@gmail.com>
* backend/rust-compile-asm.cc (CompileAsm::asm_build_expr):
Add debug comment
(CompileAsm::asm_construct_outputs):
Perform lowering hir output operand to tree
2025-03-19 badumbatish <tanghocle456@gmail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Perform type check on InlineAsm's operand
(typecheck_inline_asm_operand): Likewise
2025-03-19 badumbatish <tanghocle456@gmail.com>
* backend/rust-compile-asm.cc (CompileAsm::asm_construct_outputs):
Lower the HIR to tree with CompileExpr
* backend/rust-compile-asm.h: Remove static from method
2025-03-19 badumbatish <tanghocle456@gmail.com>
* backend/rust-compile-asm.cc (strip_double_quotes):
Move strip double quotes to parse phase
(CompileAsm::asm_construct_string_tree): Likewise
* backend/rust-compile-asm.h (strip_double_quotes): Likewise
* expand/rust-macro-builtins-asm.cc (strip_double_quotes):
Likewise
(expand_inline_asm): Renamed to expand_inline_asm_strings
(expand_inline_asm_strings): Renamed from expand_inline_asm
(parse_asm): Move strip double quotes to parse phase
(parse_format_strings): Likewise
* expand/rust-macro-builtins-asm.h (strip_double_quotes):
Likewise
(expand_inline_asm_strings): Inline asm expansion fn
(expand_inline_asm_string): Inline asm expansion fn
2025-03-19 badumbatish <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
Remove warnings
(parse_reg_operand_out): Remove warnings
(expand_inline_asm): New function for eventual expansion
(parse_asm): Use expand_inline_asm
2025-03-19 badumbatish <tanghocle456@gmail.com>
* backend/rust-compile-asm.cc (CompileAsm::asm_construct_outputs):
Set up counting to check
2025-03-19 badumbatish <tanghocle456@gmail.com>
* backend/rust-compile-asm.cc (CompileAsm::asm_build_expr):
Use expr's is_simple_asm and is_inline_asm
(CompileAsm::asm_is_simple): removed
(CompileAsm::asm_is_inline): removed
* backend/rust-compile-asm.h: Add docs to ASM_TREE_ARRAY_LENGTH
* hir/tree/rust-hir-expr.h: Add is_simple_asm, is_inline_asm
and remove #include tree
2025-03-19 badumbatish <tanghocle456@gmail.com>
* backend/rust-compile-asm.cc (strip_double_quotes):
Refactor compile-asm for first round review
(CompileAsm::asm_build_asm_stmt): Likewise.
(CompileAsm::asm_build_expr): Likewise.
(CompileAsm::asm_get_locus): Likewise.
(CompileAsm::asm_construct_string_tree): Likewise.
(CompileAsm::asm_construct_outputs): Likewise.
(CompileAsm::asm_construct_inputs): Likewise.
(CompileAsm::asm_construct_clobber_tree): Likewise.
(CompileAsm::asm_construct_label_tree): Likewise.
(CompileAsm::asm_is_simple): Likewise.
(CompileAsm::asm_is_inline): Likewise.
* backend/rust-compile-asm.h (strip_double_quotes): Likewise.
(class CompileAsm): Likewise.
2025-03-19 badumbatish <tanghocle456@gmail.com>
* backend/rust-compile-asm.cc (CompileAsm::add_stmt):
Deleted
(CompileAsm::CompileAsm):
Successfully produce pseudo-nop
(CompileAsm::visit): Likewise
(CompileAsm::asm_build_asm_stmt): Likewise
(CompileAsm::asm_construct_string_tree): Likewise
(CompileAsm::asm_is_inline): Likewise
* backend/rust-compile-asm.h (class CompileAsm): Likewise
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise
2025-03-19 badumbatish <tanghocle456@gmail.com>
* backend/rust-compile-asm.cc (CompileAsm::add_stmt):
Scaffolding code.
(CompileAsm::asm_build_asm_stmt): Likewise.
(CompileAsm::asm_build_expr): Likewise.
(CompileAsm::asm_construct_string_tree): Likewise.
* backend/rust-compile-asm.h: Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
2025-03-19 badumbatish <tanghocle456@gmail.com>
* Make-lang.in:
Scaffolding new compile-asm files
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise
* hir/tree/rust-hir-expr.h: Likewise
* backend/rust-compile-asm.cc: New file. Likewise
* backend/rust-compile-asm.h: New file. Likewise
2025-03-19 jjasmine <tanghocle456@gmail.com>
* backend/rust-compile-expr.cc (CompileExpr::visit):
Setting up interfaces for codegen
* hir/tree/rust-hir-expr.h: Likewise.
2025-03-19 jjasmine <tanghocle456@gmail.com>
* backend/rust-compile-expr.cc (CompileExpr::visit):
Local testing for build_string and debug()
2025-03-19 jjasmine <tanghocle456@gmail.com>
* hir/tree/rust-hir.cc (InlineAsm::accept_vis):
Make sure CompileExpr::visit is reached
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise
2025-03-19 jjasmine <tanghocle456@gmail.com>
* backend/rust-compile-block.h:
Scaffolding asm codegen
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* backend/rust-compile-expr.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Likewise.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
2025-03-19 badumbatish <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
Fix parsing logic & reassignment logic
(parse_reg_operand_in): Fix parsing
(parse_reg_operand_out): Fix parsing
(parse_reg_operand_inout): Fix parsing
(parse_reg_operand_unexpected): Remove rust_unreachable()
(parse_asm_arg): Fix parsing logic
2025-03-19 badumbatish <tanghocle456@gmail.com>
* typecheck/rust-hir-type-check.h:
Add pop guard for binder
2025-03-19 badumbatish <tanghocle456@gmail.com>
* resolve/rust-ast-resolve.cc (NameResolution::go):
Fix warnings from const auto& to const auto
2025-03-19 Raiki Tamura <tamaron1203@gmail.com>
* lex/rust-lex.cc (Lexer::build_token): Emit error code.
* lex/rust-lex.h: Fix comment.
2025-03-19 Raiki Tamura <tamaron1203@gmail.com>
* hir/tree/rust-hir.cc (Item::item_kind_string): New function.
* hir/tree/rust-hir.h: New function.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Modify to check all arms in match expressions even if some of them
has errors.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
Add and fix check for path patterns.
2025-03-19 Raiki Tamura <tamaron1203@gmail.com>
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
Add check for union patterns.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/errors/rust-feature.cc (Feature::create): Reuse variable,
remove now optional parameters from constructor.
* checks/errors/rust-feature.h: Cleanup class definition.
* checks/errors/rust-feature-gate.cc (FeatureGate::gate): Use optional.
* checks/errors/rust-feature-gate.h: Cleanup visitor implementation.
* checks/errors/borrowck/ffi-polonius/Cargo.lock: New file.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/errors/rust-feature-gate.cc (FeatureGate::visit): Add base
feature gating for `#[feature(prelude_import)]`.
* checks/errors/rust-feature-gate.h: Likewise.
* checks/errors/rust-feature.cc (Feature::create): Likewise.
* checks/errors/rust-feature.h: Likewise.
* util/rust-attribute-values.h: Add base handling for `#[prelude_import]`
attribute.
* util/rust-attributes.cc: Likewise.
2025-03-19 badumbatish <tanghocle456@gmail.com>
* ast/rust-ast-full-decls.h (struct InlineAsmOperand):
Change to class
(class InlineAsmOperand): Change from struct
* hir/tree/rust-hir-full-decls.h (struct InlineAsmRegOrRegClass):
Removed from decl, used from AST
(struct AnonConst): new decl from rust-hir-expr.h
(class InlineAsmOperand): new decl from rust-hir-expr.h
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-full-decls.h (class PathPattern): Rename PathPattern to...
(class Path): ...Path
* ast/rust-ast-collector.cc (TokenCollector::visit): Add required methods
for LangItemPath and RegularPath.
* ast/rust-ast-collector.h: Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast-visitor.h: Likewise.
* ast/rust-path.cc (PathPattern::as_string): Likewise.
(RegularPath::as_string): Likewise.
(LangItemPath::as_string): Likewise.
(PathPattern::convert_to_simple_path): Likewise.
(RegularPath::convert_to_simple_path): Likewise.
(RegularPath::accept_vis): Likewise.
(LangItemPath::accept_vis): Likewise.
(PathInExpression::as_string): Likewise.
(QualifiedPathInExpression::as_string): Likewise.
* ast/rust-path.h (class PathPattern): Likewise.
(class Path): Likewise.
(class RegularPath): Likewise.
(class LangItemPath): Likewise.
(class PathInExpression): Likewise.
(class QualifiedPathInExpression): Likewise.
* ast/rust-pattern.h (class PathPattern): Likewise.
(class Path): Likewise.
* expand/rust-derive.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.h (class PathExpr): Remove class.
* ast/rust-path.h (class PathInExpression): Inherit from ExprWithoutBlock.
(class QualifiedPathInExpression): Likewise.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-path.h (class PathInExpression): Remove `remove_all_segments`
method, add a `marked_for_strip` flag instead.
2025-03-19 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Add error code and update error message
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-borrow-checker-diagnostics.cc
(BorrowCheckerDiagnostics::report_move_errors): Specify
locations for code causing errors and related moves.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-borrow-checker-diagnostics.cc
(BorrowCheckerDiagnostics::report_subset_errors): Highlight
lifetime locations while reporting subset errors.
(BorrowCheckerDiagnostics::get_lifetime_param): Helper function
to fetch HIR::Lifetime node from Polonius::Origin.
* checks/errors/borrowck/rust-borrow-checker-diagnostics.h:
Definition of helper function.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-builder.h: Map regions to
their respective HIR nodes.
* checks/errors/borrowck/rust-bir.h (struct Function):
Add unordered_map to maintain the mapping.
2025-03-19 Liam Naddell <liam.naddell@mail.utoronto.ca>
* typecheck/rust-hir-type-check-pattern.cc:
Emit E0532 when trying to reference a Tuple or Struct variant
using a non Tuple or Struct pattern.
2025-03-19 Liam Naddell <liam.naddell@mail.utoronto.ca>
* expand/rust-expand-visitor.h:
remove auto keyword
* expand/rust-macro-builtins-helpers.cc:
allow for changing macro invoc types on eager expansions to
semicoloned macros
* expand/rust-macro-builtins-helpers.h:
add default semicoloned argument
* expand/rust-macro-builtins-include.cc:
allow for eager expansion for include and include_bytes
allow for parsing include invocations as items instead of
expressions, which allows invocations at global scope
* expand/rust-macro-expand.cc:
push Expr type for eager invocations
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-builder-internal.h:
Use `make_*` functions to create BIR::Statements.
* checks/errors/borrowck/rust-bir.h: Make a complete constructor
and introduce `make_*` functions to create various
BIR::Statements.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-borrow-checker-diagnostics.cc
(BorrowCheckerDiagnostics::report_loan_errors): Add label to
where the borrow occurs and where the invalid access occurs.
(BorrowCheckerDiagnostics::get_statement):
Fetch BIR::Statement from Polonius::Point
(BorrowCheckerDiagnostics::get_loan):
Fetch BIR::Loan from Polonius::Loan
* checks/errors/borrowck/rust-borrow-checker-diagnostics.h:
Function definition of helpers.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
Add location parameter.
* checks/errors/borrowck/rust-bir-builder.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-internal.h: Add helper
function for pushing return statements.
* checks/errors/borrowck/rust-bir.h: Remove `expr` parameter as
it is only needed for ASSIGNMENT statements, for which we
already have a constructor.
2025-03-19 badumbatish <tanghocle456@gmail.com>
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit):
Implement resolve expr for inline asm ast
(translate_operand): Likewise.
* resolve/rust-ast-resolve-expr.h: Likewise.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-builder-internal.h:
Fill location for loan.
* checks/errors/borrowck/rust-bir-place.h (struct Loan):
Add location field.
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc
(ExprStmtBuilder::visit): Added location parameter.
* checks/errors/borrowck/rust-bir-builder-internal.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h:
Likewise.
* checks/errors/borrowck/rust-bir-builder-pattern.h: Likewise.
* checks/errors/borrowck/rust-bir-builder.h: Likewise.
* checks/errors/borrowck/rust-bir.h: Likewise.
2025-03-19 badumbatish <tanghocle456@gmail.com>
* hir/rust-ast-lower-expr.cc (translate_operand_in):
Turn to switch case, use new helper functions
(translate_operand_out): Likewise.
(translate_operand_inout): Likewise.
(translate_operand_split_in_out): Likewise.
(translate_operand_const): Likewise.
(translate_operand_sym): Likewise.
(translate_operand_label): Likewise.
(from_operand): Likewise.
(ASTLoweringExpr::visit): Likewise.
2025-03-19 badumbatish <tanghocle456@gmail.com>
* hir/rust-ast-lower-expr.cc (from_operand):
Set up the lowering for operand
(ASTLoweringExpr::visit): Likewise
* hir/tree/rust-hir-expr.h (struct InlineAsmRegOrRegClass):
Not necessary, kept from ast
(struct AnonConst): Set up lowering for operand
(class InlineAsmOperand): Likewise, add getters
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/polonius/rust-polonius.h (struct FullPoint):
Added comments and made extraction of statement more verbose for
better understanding.
* checks/errors/borrowck/ffi-polonius/src/lib.rs: Likewise.
2025-03-19 badumbatish <tanghocle456@gmail.com>
* ast/rust-expr.h (struct InlineAsmOperand): changed to class
(class InlineAsmOperand): Have appropriate constructor,
and getter
* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
Use the new implement constructors and new control flow.
(parse_reg_operand_in): Likewise
(parse_reg_operand_out): Likewise
(parse_reg_operand_inout): Likewise
(parse_reg_operand_const): Likewise
2025-03-19 badumbatish <tanghocle456@gmail.com>
* ast/rust-expr.h (struct InlineAsmOperand):
Add construction for register_type
* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
Fix parsing logic & reassignment logic
(parse_reg_operand_in): Fix parsing
(parse_reg_operand_out): Fix parsing
(parse_reg_operand_inout): Fix parsing
(parse_reg_operand_unexpected): Remove rust_unreachable()
(parse_asm_arg): Fix parsing logic
* expand/rust-macro-builtins-asm.h: Add = operator overloading
2025-03-19 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/borrowck/polonius/rust-polonius.h (struct FullPoint):
This is the correct way of extracting the required bits.
2025-03-19 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs: Remove extern
type feature.
* checks/errors/borrowck/ffi-polonius/src/lib.rs: Define FFIVector
per the nomicon's recommendation
https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs
2025-03-19 Liam Naddell <liam.naddell@mail.utoronto.ca>
* ast/rust-ast.cc:
Fix Attribute constructors to copy inner_attribute
* checks/errors/rust-unsafe-checker.cc:
Add pass for #[may_dangle] in safe impl's
* hir/rust-ast-lower-item.cc:
Add support for unsafe impl's
* hir/rust-ast-lower-type.cc:
Lower attributes in impl's from AST to HIR
* hir/rust-hir-dump.cc:
Change single attribute to AttrVec
* hir/tree/rust-hir-item.h:
Add unsafe support to Impl blocks in HIR
* hir/tree/rust-hir.cc:
Change single attribute to AttrVec
* hir/tree/rust-hir.h:
Add has/get_outer_attribute to GenericParam
2025-03-19 Antonio Gomes <antoniospg100@gmail.com>
* expand/rust-cfg-strip.cc:
Strip struct expr fields and strip fields in struct definition
* expand/rust-cfg-strip.h:
Signatures for new function maybe_strip_struct_expr_fields
2025-03-18 Marc Poulhiès <dkm@kataplop.net>
PR rust/119333
* Make-lang.in: Force offline mode for cargo
2025-03-18 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/errors/borrowck/ffi-polonius/.cargo/config.toml: New file, force vendored deps.
* checks/errors/borrowck/ffi-polonius/vendor/datafrog/.cargo-checksum.json: New file.
* checks/errors/borrowck/ffi-polonius/vendor/datafrog/CODE_OF_CONDUCT.md: New file.
* checks/errors/borrowck/ffi-polonius/vendor/datafrog/Cargo.toml: New file.
* checks/errors/borrowck/ffi-polonius/vendor/datafrog/LICENSE-APACHE: New file.
* checks/errors/borrowck/ffi-polonius/vendor/datafrog/LICENSE-MIT: New file.
* checks/errors/borrowck/ffi-polonius/vendor/datafrog/README.md: New file.
* checks/errors/borrowck/ffi-polonius/vendor/datafrog/RELEASES.md: New file.
* checks/errors/borrowck/ffi-polonius/vendor/datafrog/examples/borrow_check.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/datafrog/examples/graspan1.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/datafrog/src/join.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/datafrog/src/lib.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/datafrog/src/map.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/datafrog/src/test.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/datafrog/src/treefrog.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/.cargo-checksum.json: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/CHANGELOG.md: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/Cargo.toml: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/LICENSE-APACHE: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/LICENSE-MIT: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/README.md: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/benches/value.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/src/__private_api.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/src/kv/error.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/src/kv/key.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/src/kv/mod.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/src/kv/source.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/src/kv/value.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/src/lib.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/src/macros.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/src/serde.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/log/triagebot.toml: New file.
* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/.cargo-checksum.json: New file.
* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/Cargo.toml: New file.
* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/README.md: New file.
* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/facts.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/lib.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/output/datafrog_opt.rs:
New file.
* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/output/initialization.rs:
New file.
* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/output/liveness.rs:
New file.
* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/output/location_insensitive.rs:
New file.
* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/output/mod.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/polonius-engine/src/output/naive.rs: New file.
* checks/errors/borrowck/ffi-polonius/vendor/rustc-hash/.cargo-checksum.json: New file.
* checks/errors/borrowck/ffi-polonius/vendor/rustc-hash/CODE_OF_CONDUCT.md: New file.
* checks/errors/borrowck/ffi-polonius/vendor/rustc-hash/Cargo.toml: New file.
* checks/errors/borrowck/ffi-polonius/vendor/rustc-hash/LICENSE-APACHE: New file.
* checks/errors/borrowck/ffi-polonius/vendor/rustc-hash/LICENSE-MIT: New file.
* checks/errors/borrowck/ffi-polonius/vendor/rustc-hash/README.md: New file.
* checks/errors/borrowck/ffi-polonius/vendor/rustc-hash/src/lib.rs: New file.
2025-03-17 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit):
Add rich error message and error code similiar to rustc with
associaed type and trait name
2025-03-17 Liam Naddell <liam.naddell@mail.utoronto.ca>
* expand/rust-expand-visitor.cc:
Fix ICE caused by unique_ptr UB and buggy iterator use
2025-03-17 badumbatish <tanghocle456@gmail.com>
* ast/rust-fmt.h (enum ParseMode):
Drop typedef in Cpp
2025-03-17 badumbatish <tanghocle456@gmail.com>
* ast/rust-fmt.cc (Pieces::collect):
Added options for ParseMode
* ast/rust-fmt.h (collect_pieces): Likewise.
(struct Pieces): Likewise.
* expand/rust-macro-builtins-format-args.cc (MacroBuiltin::format_args_handler):
Likewise.
2025-03-17 badumbatish <tanghocle456@gmail.com>
* ast/rust-expr.h (struct AnonConst):
Change assertion of constructor
(struct InlineAsmOperand):
Change assertion of constructor
2025-03-17 Liam Naddell <liam.naddell@mail.utoronto.ca>
* typecheck/rust-hir-type-check-expr.cc:
Fix ICE caused by not finding enum variant by adding new error
message
2025-03-17 Antonio Gomes <antoniospg100@gmail.com>
* hir/tree/rust-hir-expr.h: Add new get_operator_str method in
ArithmeticOrLogicalExpr and CompoundAssignmentExpr
* hir/tree/rust-hir.cc: Likewise
* typecheck/rust-hir-type-check-expr.cc: Improve error message for
operator expressions to display the correct operator symbol
2025-03-17 Kushal Pal <kushalpal109@gmail.com>
* Make-lang.in: Compile new file.
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
Use new class to report errors.
* checks/errors/borrowck/rust-borrow-checker-diagnostics.cc: New file.
* checks/errors/borrowck/rust-borrow-checker-diagnostics.h:
New file, adds new class.
2025-03-17 Kushal Pal <kushalpal109@gmail.com>
* Make-lang.in: Compile new file, rust-polonius.cc
* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs: Opaque
type to represent FFIVector from C++.
* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi_generated.rs:
Change types of fields in Output.
* checks/errors/borrowck/ffi-polonius/src/lib.rs: Added helper
functions to contruct Polonius output on C++ side,
used helpers to contruct Polonius output on C++ side.
* checks/errors/borrowck/polonius/rust-polonius-ffi.h (make_vector):
FFIVector is a wrapper around std::vector for transfering data
from Rust to C++.
(struct Output): Use pointers to FFIVector instead of bool to
store Polonius output data.
* checks/errors/borrowck/polonius/rust-polonius.h (FFIVector__new):
Helper function.
(FFIVector__new_vec_pair): Likewise.
(FFIVector__new_vec_triple): Likewise.
(FFIVector__push): Likewise.
(FFIVector__push_vec_pair): Likewise.
(FFIVector__push_vec_triple): Likewise.
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
Convert FFIVector to std::vector representation for easier
navigation.
* checks/errors/borrowck/polonius/rust-polonius.cc: New file,
implementation of helper functions.
2025-03-17 Marc Poulhiès <dkm@kataplop.net>
* hir/rust-hir-dump.cc (Dump::do_matcharm): New.
(Dump::do_matchcase): New.
(Dump::visit(MatchExpr)): Adjust, don't use as_string.
* hir/rust-hir-dump.h (Dump::do_matcharm, Dump::do_matchcase): New.
2025-03-17 Liam Naddell <liam.naddell@mail.utoronto.ca>
* ast/rust-expr.h:
Remove unnecessary include.
2025-03-17 badumbatish <tanghocle456@gmail.com>
* ast/rust-expr.h (struct AnonConst):
Safe-guard InlineAsm structs
(struct InlineAsmOperand): Likewise.
* expand/rust-macro-builtins-asm.cc (parse_reg_operand_in):
Likewise.
(parse_reg_operand_out): Likewise.
(parse_reg_operand_inout): Likewise.
2025-03-17 badumbatish <tanghocle456@gmail.com>
* ast/rust-expr.h (struct TupleTemplateStr):
Store parse result of parse_format_string(s)
* expand/rust-macro-builtins-asm.cc (parse_format_strings):
Likewise
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_asm):
Clean up monadic operations on expected<>
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
Addresses warning, put warn unused in right place
(parse_reg_operand_inout): Likewise.
(parse_asm_arg): Likewise.
* expand/rust-macro-builtins-asm.h (enum WARN_UNUSED_RESULT): Likewise.
(enum InlineAsmParseError): Likewise.
(validate): Likewise.
(parse_asm_arg): Likewise.
(parse_format_strings): Likewise.
(parse_clobber_abi): Likewise.
(parse_reg_operand): Likewise.
(parse_reg_operand_in): Likewise.
(parse_reg_operand_out): Likewise.
(parse_reg_operand_lateout): Likewise.
(parse_reg_operand_inout): Likewise.
(parse_reg_operand_inlateout): Likewise.
(parse_reg_operand_const): Likewise.
(parse_reg_operand_sym): Likewise.
(parse_reg_operand_unexpected): Likewise.
(parse_asm): Likewise.
(check_and_set): Likewise.
(parse_options): Likewise.
(parse_reg): Likewise.
(parse_format_string): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.h (enum InlineAsmParseError):
Add WARN_UNUSED_RESULT parse error
(enum WARN_UNUSED_RESULT): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_clobber_abi):
added comments
(parse_options): Likewise
(parse_asm_arg): Likewise
(parse_asm): Likewise
* expand/rust-macro-builtins-asm.h: Likewise
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-expr.h:
Added tl::expected to parse_operand
* expand/rust-macro-builtins-asm.cc (parse_reg): Likewise.
(parse_reg_operand): Likewise.
(parse_reg_operand_const): Likewise.
(parse_reg_operand_inout): Likewise.
(parse_asm_arg): Likewise.
* expand/rust-macro-builtins-asm.h: Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (check_and_set):
Scaffold expected on parse_options and asm_arg
(parse_options): Likewise
(parse_asm_arg): Likewise
* expand/rust-macro-builtins-asm.h (check_and_set): Likewise
(parse_label): Likewise
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_reg_operand_in):
Finish expected parse_reg_operand
(parse_reg_operand_unexpected): Likewise
* expand/rust-macro-builtins-asm.h (parse_reg_operand_unexpected): Likewise
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_clobber_abi):
Finish incorporating expected of parse_reg_operand
(parse_reg): Likewise.
(parse_reg_operand): Likewise.
(parse_reg_operand_in): Likewise.
(parse_reg_operand_out): Likewise.
(parse_reg_operand_lateout): Likewise.
(parse_reg_operand_const): Likewise.
(parse_reg_operand_inout): Likewise.
(parse_reg_operand_sym): Likewise.
(MacroBuiltin::asm_handler): Likewise.
(parse_asm_arg): Likewise.
(parse_asm): Likewise.
(parse_format_strings): Likewise.
(validate): Likewise.
* expand/rust-macro-builtins-asm.h (class InlineAsmParseError): Likewise.
(enum InlineAsmParseError): Likewise.
(validate): Likewise.
(parse_format_strings): Likewise.
(parse_reg_operand_in): Likewise.
(parse_reg_operand_out): Likewise.
(parse_reg_operand_lateout): Likewise.
(parse_reg_operand_inout): Likewise.
(parse_reg_operand_inlateout): Likewise.
(parse_reg_operand_const): Likewise.
(parse_reg_operand_sym): Likewise.
2025-03-17 ansh <anshmalik2002@gmail.com>
* ast/rust-ast-collector.cc (TokenCollector::visit):
Handle case for RAW_STRING_LITERAL.
* ast/rust-ast.cc (AttributeParser::parse_meta_item_inner):
Likewise.
(AttributeParser::parse_literal): Likewise.
* ast/rust-ast.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_literal):
Likewise.
* lex/rust-lex.cc (Lexer::parse_raw_string): Likewise.
* lex/rust-token.cc (Token::as_string): Likewise.
* lex/rust-token.h (enum PrimitiveCoreType): Likewise.
* parse/rust-parse-impl.h (Parser::parse_attr_input): Likewise.
(Parser::parse_literal_expr): Likewise.
(Parser::parse_pattern_no_alt): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* hir/tree/rust-hir-expr.h:
Added ExprType::InlineAsm
* hir/tree/rust-hir.h:
Added ExprType::InlineAsm
2025-03-17 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-fragment.h (enum class): Add InvocKind and AsmKind enums.
* ast/rust-macro.h: Switch semicolon boolean to InvocKind enum.
* expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise.
* expand/rust-macro-builtins-asm.cc (MacroBuiltin::asm_handler): Likewise.
(parse_asm): Likewise.
* expand/rust-macro-builtins-asm.h (parse_asm): Likewise.
* expand/rust-macro-builtins-format-args.cc (MacroBuiltin::format_args_handler): Likewise.
* expand/rust-macro-builtins-include.cc (MacroBuiltin::include_bytes_handler): Likewise.
(MacroBuiltin::include_str_handler): Likewise.
(MacroBuiltin::include_handler): Likewise.
* expand/rust-macro-builtins-location.cc (MacroBuiltin::file_handler): Likewise.
(MacroBuiltin::column_handler): Likewise.
(MacroBuiltin::line_handler): Likewise.
* expand/rust-macro-builtins-log-debug.cc (MacroBuiltin::assert_handler): Likewise.
* expand/rust-macro-builtins-utility.cc (MacroBuiltin::compile_error_handler): Likewise.
(MacroBuiltin::concat_handler): Likewise.
(MacroBuiltin::env_handler): Likewise.
(MacroBuiltin::cfg_handler): Likewise.
(MacroBuiltin::stringify_handler): Likewise.
* expand/rust-macro-builtins.cc (format_args_maker): Likewise.
(enum class): Likewise.
(inline_asm_maker): Likewise.
(MacroBuiltin::sorry): Likewise.
(MacroBuiltin::proc_macro_builtin): Likewise.
* expand/rust-macro-builtins.h: Likewise.
* expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Likewise.
(MacroExpander::expand_eager_invocations): Likewise.
(MacroExpander::expand_invoc): Likewise.
* expand/rust-macro-expand.h (struct MacroExpander): Likewise.
2025-03-17 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-fragment.h: Pass `is_semicolon` information to builtin
macro transcribers.
* ast/rust-macro.h: Pass semicolon information to transcriber..
* expand/rust-macro-builtins-asm.cc (MacroBuiltin::asm_handler): Likewise.
(parse_asm): Likewise.
* expand/rust-macro-builtins-asm.h (parse_asm): Likewise.
* expand/rust-macro-builtins-format-args.cc (MacroBuiltin::format_args_handler): Likewise.
* expand/rust-macro-builtins-include.cc (MacroBuiltin::include_bytes_handler): Likewise.
(MacroBuiltin::include_str_handler): Likewise.
(MacroBuiltin::include_handler): Likewise.
* expand/rust-macro-builtins-location.cc (MacroBuiltin::file_handler): Likewise.
(MacroBuiltin::column_handler): Likewise.
(MacroBuiltin::line_handler): Likewise.
* expand/rust-macro-builtins-log-debug.cc (MacroBuiltin::assert_handler): Likewise.
* expand/rust-macro-builtins-utility.cc (MacroBuiltin::compile_error_handler): Likewise.
(MacroBuiltin::concat_handler): Likewise.
(MacroBuiltin::env_handler): Likewise.
(MacroBuiltin::cfg_handler): Likewise.
(MacroBuiltin::stringify_handler): Likewise.
* expand/rust-macro-builtins.cc (format_args_maker): Likewise.
(inline_asm_maker): Likewise.
(MacroBuiltin::sorry): Likewise.
(MacroBuiltin::proc_macro_builtin): Likewise.
* expand/rust-macro-builtins.h: Likewise.
* expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Likewise.
(MacroExpander::expand_invoc): Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Remove rust_unreachable.
* ast/rust-ast.cc (InlineAsm::accept_vis): Likewise.
* hir/tree/rust-hir.cc (InlineAsm::accept_vis): Likewise.
2025-03-17 dave <dave@dmetwo.org>
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Check for ?Trait in visitor
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parseDirSpec):
Partial second layer of expected in parsing asm
(parse_clobber_abi): Likewise
(parse_operand): Likewise
(parse_reg_operand): Likewise
(parse_asm_arg): Likewise
* expand/rust-macro-builtins-asm.h (parse_clobber_abi): Likewise
(parse_reg_operand): Likewise
(parse_operand): Likewise
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_reg):
Expected first layer done
(parse_reg_operand): Likewise.
(parse_asm_arg): Likewise.
(parse_format_strings): Likewise.
(parse_asm): Likewise.
(validate): Likewise.
* expand/rust-macro-builtins-asm.h (parse_asm_arg): Likewise.
(validate): Likewise.
(parse_format_strings): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_clobber_abi):
Move parser and last_token_id to InlineAsmCtx to prepapre
for tl::expected.
(parse_reg): Likewise.
(parse_operand): Likewise.
(parse_reg_operand): Likewise.
(check_and_set): Likewise.
(parse_options): Likewise.
(parse_format_string): Likewise.
(parse_asm_arg): Likewise.
(parse_asm): Likewise.
* expand/rust-macro-builtins-asm.h (class InlineAsmParseError): Likewise.
(parse_asm_arg): Likewise.
(check_and_set): Likewise.
(parse_operand): Likewise.
(parse_reg_operand): Likewise.
(parse_options): Likewise.
(parse_reg): Likewise.
(parse_clobber_abi): Likewise.
(parse_format_string): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
Update parser to parse strings in the first stage
(parse_label): not needed right now
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_asm):
Scaffolding validation of asm!
(validate): Likewise
* expand/rust-macro-builtins-asm.h (validate): Likewise
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-expr.h (struct InlineAsmOperand):
Partial support for operand
* expand/rust-macro-builtins-asm.cc (parse_reg_operand): Likewise.
(parse_label): Likewise.
* expand/rust-macro-builtins-asm.h (parse_label): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-expr.h (struct InlineAsmOperand):
Refactoring and supporting more parse_reg_operand
* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
Likewise.
(rust_debug): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-ast-collector.cc (TokenCollector::visit):
Fix visitor-related warnings
* ast/rust-ast-collector.h: Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast-visitor.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-struct.h: Likewise.
* checks/errors/borrowck/rust-function-collector.h: Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-const-checker.h: Likewise.
* expand/rust-derive.h: Likewise.
* expand/rust-macro-builtins-asm.cc (parse_reg_operand): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/rust-hir-dump.h: Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
Add potentially_nonpromoted_keywords set str
(check_identifier): likewise
* expand/rust-macro-builtins-asm.h (parse_format_string):
likewise
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
Successful parse of in and inout, albeit with str
(check_identifier): Likewise.
(parse_asm_arg): Likewise.
* expand/rust-macro-builtins-asm.h (parse_format_string): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-ast-visitor.h:
Scaffolding HIRFullVisitor for inline asm
* ast/rust-ast.cc (InlineAsm::accept_vis): Likewise.
* hir/tree/rust-hir-visitor.h (RUST_HIR_VISITOR_H): Likewise.
* hir/tree/rust-hir.cc (InlineAsm::accept_vis): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-ast-visitor.h:
Scaffolding ast visitor for InlineAsm
* ast/rust-ast.cc (InlineAsm::accept_vis): Likewise.
* ast/rust-expr.h: Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
Fix compile warnings.
(parse_options): Likewise.
(parse_asm): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit):
Partial unsafe support for inline asm
* checks/errors/rust-unsafe-checker.h: Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
* hir/tree/rust-hir.cc (InlineAsm::accept_vis): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-expr.h:
Add support for AST to HIR inline asm translation
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-expr.h: Likewise.
* hir/tree/rust-hir-expr.h (class InlineAsm): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-expr.h (struct AnonConst):
major refactoring of inline asm, mostly concerns
naming convention, trinary conditionals, warnings,
adding rust_unreachables in not-yet supported errors.
(struct InlineAsmRegOrRegClass): Likewise.
(struct InlineAsmOperand): Likewise.
* expand/rust-macro-builtins-asm.cc (parse_clobber_abi): Likewise.
(parse_reg): Likewise.
(parse_operand): Likewise.
(parse_reg_operand): Likewise.
(check_and_set): Likewise.
(parse_options): Likewise.
(parse_format_string): Likewise.
(parse_asm_arg): Likewise.
(parse_asm): Likewise.
* expand/rust-macro-builtins-asm.h (parse_asm_arg): Likewise.
(check_identifier): Likewise.
(check_and_set): Likewise.
(parse_operand): Likewise.
(parse_reg_operand): Likewise.
(parse_options): Likewise.
(parse_reg): Likewise.
(parse_clobber_abi): Likewise.
* expand/rust-macro-builtins.cc (enum class): Likewise.
(inline_asm_maker): Likewise.
* checks/errors/borrowck/ffi-polonius/Cargo.lock: Removed. Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-expr.h (struct AnonConst):
Got AST::Fragment to be created from InlineAsm.
(struct InlineAsmOperand): Likewise.
(class InlineAsm): Likewise.
* expand/rust-macro-builtins-asm.cc (parse_reg_operand): Likewise.
(parse_asm): likewise
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_reg):
Working towards parse_reg and parse_reg_operand
(parse_reg_operand):
Working towards parse_reg and parse_reg_operand
(parse_asm_arg):
Add todo about errors
* expand/rust-macro-builtins-asm.h (parse_global_asm):
remove dead code.
(parse_nonglobal_asm):
remove dead code.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parseAsmArg):
Renamed parseAsmArg to conform to other function names
(parse_asm_arg): Likewise.
(parse_asm): Likewise.
* expand/rust-macro-builtins-asm.h (parseAsmArg): Likewise.
(parse_asm_arg): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-expr.h (struct InlineAsmRegOrRegClass):
Remove union
(struct InlineAsmOperand): Make instances of inside struct.
* expand/rust-macro-builtins-asm.cc (parse_clobber_abi):
Change signature with inlineAsmCtx.
(parse_reg): Likewise.
(parse_operand): Likewise.
(parse_reg_operand): Likewise.
(check_and_set): Likewise.
(parse_options): Likewise.
(parse_format_string): Likewise.
(parseAsmArg): Likewise.
(parse_asm): Likewise.
* expand/rust-macro-builtins-asm.h (class InlineAsmContext): Likewise.
(parseAsmArg): Likewise.
(check_and_set): Likewise.
(parse_reg_operand): Likewise.
(parse_options): Likewise.
(parse_reg): Likewise.
(parse_clobber_abi): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc
(MacroBuiltin::global_asm_handler):
Remove global_asm and non_global_asm handler
(MacroBuiltin::nonglobal_asm_handler): Likewise.
(MacroBuiltin::asm_handler): Likewise.
* expand/rust-macro-builtins.cc (enum class): Likewise.
(inline_asm_maker): Likewise.
* expand/rust-macro-builtins.h: Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-expr.h:
Safegaurd InlineAsm's clone_expr_... with unreachable.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-ast-full-decls.h (enum class):
Rename InlineAsmOptions to InlineAsmOption for clarity
* ast/rust-expr.h (enum class): Likewise.
* expand/rust-macro-builtins-asm.cc (check_and_set): Likewise.
(parse_options): Likewise.
* expand/rust-macro-builtins-asm.h (check_and_set): Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-expr.h (struct InlineAsmRegOrRegClass):
Scaffolding parse_reg
* expand/rust-macro-builtins-asm.cc (parse_reg): Likewise.
(parse_operand): Likewise.
(parseAsmArg): Likewise.
* checks/errors/borrowck/ffi-polonius/Cargo.lock: New file.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.h (parseAsmArg):
Resolve static decl warning
(parse_nonglobal_asm):
Resolve static decl warning
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (check_and_set):
Add checks for duplicate options in inline asm
(parse_options): likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-expr.h: parsing of options(...)
* expand/rust-macro-builtins-asm.cc (check_and_set):
likewise.
(parse_options): likewise.
(parseAsmArg): likewise.
* expand/rust-macro-builtins-asm.h (check_and_set):
likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_clobber_abi):
implemented parse_clobber_abi
(parse_format_string): likewise.
(parseAsmArg): likewise.
(parse_asm): likewise.
* expand/rust-macro-builtins-asm.h (parseAsmArg): likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parseDirSpec): replace
scaffolded InlineAsm with real InlineAsm.
(parse_clobber_abi): likewise.
(check_and_set): likewise.
(parse_options): likewise.
(parseAsmArg): likewise.
(parse_asm): likewise.
* expand/rust-macro-builtins-asm.h (struct AsmParseError): likewise.
(enum InlineAsmDirSpec): likewise.
(enum InlineAsmRegOrRegClass): likewise.
(struct AsmArg): likewise.
(parseAsmArg): likewise.
(check_and_set): likewise.
(parse_operand): likewise.
(parse_options): likewise.
(parse_reg): likewise.
(parse_clobber_abi): likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-expr.h: Make InlineAsm non-abstract for usage in parsing.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-expr.h: Introduced is_global_asm to InlineAsm AST
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_clobber_abi): format
(check_and_set): helper function, is try_set_option equivalent
(parse_options): new function
* expand/rust-macro-builtins-asm.h (enum InlineAsmOptions):
removed
(check_and_set): decl of helper function
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_clobber_abi): title.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_options): title.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (parse_clobber_abi): title.
(parseAsmArg): title.
* expand/rust-macro-builtins-asm.h (parse_clobber_abi): title.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (enum InlineAsmRegOrRegClass): title.
(parseAsmArg): title.
(check_identifier): title.
(parse_operand): title.
(parse_options): title.
(parse_reg): title.
(parseDirSpec): title.
(parse_asm): title.
* expand/rust-macro-builtins-asm.h: New file.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins-asm.cc (struct AsmParseError): title.
(enum InlineAsmDirSpec): title.
(enum InlineAsmOptions): title.
(struct AsmArg): title.
(parseAsmArg): title.
(parse_global_asm): title.
(parse_nonglobal_asm): title.
(parse_asm): title.
(parseDirSpec): title.
(parse_format_string): title.
(MacroBuiltin::global_asm_handler): title.
(MacroBuiltin::nonglobal_asm_handler): title.
* expand/rust-macro-builtins.cc: title.
* expand/rust-macro-builtins.h: title.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-feature-gate.cc (FeatureGate::visit): Gate the
excluded pattern.
* checks/errors/rust-feature-gate.h: Update the function prototype
and delete two empty implementations in order to use default visitor
behavior.
* checks/errors/rust-feature.cc (Feature::create): Add the new
exclusive range pattern feature gate.
* checks/errors/rust-feature.h: Add new feature enum variant for
exclusive range patterns.
* parse/rust-parse-impl.h (Parser::parse_pattern_no_alt): Forward the
token location to the AST.
(Parser::parse_ident_leading_pattern): Likewise.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-pattern.cc (tokenid_to_rangekind): Add a new function to
get a range kind from the current token type.
(RangePattern::as_string): Change the string representation for range
pattern in order to handle excluded ranges.
* ast/rust-pattern.h (enum class): Add new enum class to differentiate
range kinds.
(tokenid_to_rangekind): New prototype for a function that converts a
token id to it's corresponding range kind.
(class RangePattern): Change the class to accept a range kind instead
of an ellipsis boolean.
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Abort
when an excluded pattern has been found as we do not handle their
lowering yet.
* parse/rust-parse-impl.h (Parser::parse_literal_or_range_pattern):
Parse excluded range patterns.
(Parser::parse_pattern_no_alt): Likewise.
(Parser::parse_ident_leading_pattern): Likewise.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-feature-gate.cc (FeatureGate::visit): Gate raw
borrow.
* checks/errors/rust-feature-gate.h: Update function prototype.
* checks/errors/rust-feature.cc: Add raw_ref_op gate.
* checks/errors/rust-feature.h: Likewise.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-expr.h: Add a getter for mutability.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Panic when a
raw reference is met.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-builder.cc (Builder::ref): Adapt constructor to the new
API.
* ast/rust-ast-collector.cc (TokenCollector::visit): Emit a raw weak
keyword when required.
* ast/rust-ast.cc (BorrowExpr::as_string): Change as_string
representation to handle raw ref operator.
* ast/rust-expr.h (class BorrowExpr): Add raw discriminant.
* expand/rust-macro-builtins-include.cc: Adapt constructor to the new
API.
* parse/rust-parse-impl.h: Handle the raw weak keyword.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Output field
attributes.
* ast/rust-expr.h (class StructExprField): Add outer attributes member.
* parse/rust-parse-impl.h (Parser::parse_struct_expr_field): Parse
outer attributes and store them in the appropriate AST node.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-feature-gate.cc: Visit and gate may_dangle
attributes.
* checks/errors/rust-feature-gate.h: Update visit function prototype
and add a new member function to check on a set of attributes whether
one is may_dangle.
* checks/errors/rust-feature.cc (Feature::create): Add new
dropck_eyepatch feature.
* checks/errors/rust-feature.h: Likewise.
* util/rust-attribute-values.h: Add new may_dangle attribute value.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Visit outer
attributes.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Change outer
attribute visit, we need to visit all of them.
* ast/rust-ast.cc (LifetimeParam::as_string): Change as_string
implementation to allow multiple outer attributes.
(TypeParam::as_string): Likewise.
* ast/rust-ast.h (class LifetimeParam): Allow multiple outer
attributes.
* ast/rust-item.h (class TypeParam): Likewise.
* ast/rust-path.h: Likewise.
* parse/rust-parse-impl.h (Parser::parse_generic_param): Change call
to outer attribute parsing to collect several attributes.
(Parser::parse_lifetime_param): Likewise.
(Parser::parse_type_param): Likewise.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_generic_param): Change token
reference to be the last token after all outer attributes have been
parsed.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-feature-gate.cc (FeatureGate::visit): Allow
visitor recursion in functions. Also add the gate for the box syntax.
* checks/errors/rust-feature-gate.h: Remove several recursion fences
in the feature gate visitor.
* checks/errors/rust-feature.cc (Feature::create): Add a new feature.
(Feature::as_name): Likewise.
* checks/errors/rust-feature.h: Add box_syntax gate.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Add visit member
function for BoxExpr nodes.
* ast/rust-ast-collector.h: Add visit function prototype.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Add visit member
function to default ast visitor.
* ast/rust-ast-visitor.h: Add visit function's prototype.
* ast/rust-ast.cc (BoxExpr::as_string): Add as_string function
implementation for BoxExpr.
(BoxExpr::accept_vis): Add accept_vis implementation to BoxExpr.
* ast/rust-expr.h (class BoxExpr): Add BoxExpr class to represent boxed
expressions.
* expand/rust-derive.h: Add BoxExpr visit function prototype.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Add BoxExpr
visitor implementation.
* hir/rust-ast-lower-base.h: Add visit function's prototype.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Add BoxExpr
visitor implementation.
* hir/rust-ast-lower-expr.h: Add visit function's prototype.
* parse/rust-parse-impl.h (Parser::parse_box_expr): Add parse_box_expr
function's implementation.
* parse/rust-parse.h: Add parse_box_expr function's prototype.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Add resolver
visit implementation.
* resolve/rust-ast-resolve-base.h: Add resolver's visit function
prototype.
2025-03-17 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-default-resolver.cc
(DefaultResolver::visit):
Scope with Rib::Kind::ConstantItem instead
of Rib::Kind::Item.
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Remove redundancy in override of
ConstantItem visitor.
2025-03-17 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-builtins.cc
(MacroBuiltin::builtin_transcribers):
Add entries for "rustc_const_stable" and "rustc_const_unstable".
* util/rust-attributes.cc
(__definitions): Add entries for RUSTC_CONST_STABLE and
RUSTC_CONST_UNSTABLE.
* util/rust-attribute-values.h
(Attributes::RUSTC_CONST_STABLE): New.
(Attributes::RUSTC_CONST_UNSTABLE): New.
2025-03-17 Kushal Pal <kushalpal109@gmail.com>
* ast/rust-expr.h (class OperatorExpr):
Location should be private.
* hir/tree/rust-hir-expr.h (class OperatorExpr): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* checks/errors/rust-feature-gate.cc (FeatureGate::visit): make
gccrs recognize negative_impls
* checks/errors/rust-feature-gate.h: likewise.
* checks/errors/rust-feature.cc (Feature::create): likewise.
* checks/errors/rust-feature.h: likewise.
2025-03-17 SIGMazer <mazinasd7@gmail.com>
* rust-system.h: Add system include <stack>
2025-03-17 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-default-resolver.cc
(DefaultResolver::visit):
New for AST::CallExpr and AST::MethodCallExpr.
* resolve/rust-default-resolver.h
(DefaultResolver::visit): Likewise.
2025-03-17 jjasmine <tanghocle456@gmail.com>
* ast/rust-fmt.h: Remove useless cstddef header from rust-fmt
2025-03-17 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/errors/borrowck/rust-borrow-checker.cc (mkdir_wrapped): Remove.
(BorrowChecker::go): Use `mkdir` instead.
* expand/rust-proc-macro.cc (register_callback): Use Windows APIs to
open dynamic proc macro library.
(load_macros_array): Likewise.
* parse/rust-parse.cc (defined): Replace separators in paths using
std::replace.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* metadata/rust-export-metadata.cc (ExportContext::emit_trait):
Adapt call site to the new return type.
(ExportContext::emit_function): Likewise.
(ExportContext::emit_macro): Likewise.
* util/rust-hir-map.cc (Mappings::lookup_ast_item): Change the
function's return type.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/privacy/rust-privacy-reporter.cc: Change call site
to accomodate new return type.
* checks/errors/privacy/rust-pub-restricted-visitor.cc: Likewise.
* util/rust-hir-map.cc (Mappings::lookup_visibility): Change the
function's return type.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Adapt
the function call to match its new prototype.
* resolve/rust-early-name-resolver-2.0.cc (Early::insert_once):
Likewise.
(Early::visit): Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
Likewise.
* util/rust-hir-map.cc (Mappings::lookup_macro_invocation): Change the
function's return type.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc (Early::insert_once): Change
call site to accomodate the new return type.
(Early::visit): Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Likewise.
* util/rust-hir-map.cc (Mappings::lookup_macro_def): Change the
function's return type.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-base.cc: Change call site to accomodate new
return type.
* backend/rust-compile-base.h: Change parameter to use a reference.
* backend/rust-compile-extern.h: Likewise.
* backend/rust-compile-implitem.cc (CompileTraitItem::visit):
Change call site for new return type.
* backend/rust-compile-item.cc (CompileItem::visit): Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveTypeToCanonicalPath::visit):
Likewise.
* typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit):
Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit):
Likewise.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit):
Likewise.
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn):
Likewise.
* util/rust-hir-map.h: Update the function's prototype and change the
function's return type.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-hir-map.cc (Mappings::insert_hir_pattern): Change call site
in order to accomodate new return type.
(Mappings::lookup_hir_pattern): Change the function's return type.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-hir-map.cc (Mappings::insert_hir_struct_field): Change
call site to accomodate new return type.
(Mappings::lookup_hir_struct_field): Change the function's return
type.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-hir-map.cc (Mappings::insert_hir_self_param): Adapt call
site to new return type.
(Mappings::lookup_hir_self_param): Change the function's return type.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-hir-map.cc (Mappings::insert_hir_param): Change call site
to accomodate new return type.
(Mappings::lookup_hir_param): Change the function's return type.
* util/rust-hir-map.h: Updat ethe function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-hir-map.cc (Mappings::insert_hir_stmt): Change call site
to accomodate new return type.
(Mappings::lookup_hir_stmt): Change the function's return type.
(Mappings::resolve_nodeid_to_stmt): Adapt call site to new return type.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-hir-map.cc (Mappings::insert_hir_type): Change call site
to accomodate the new return type.
(Mappings::lookup_hir_type): Change the function's return type.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-hir-map.cc (Mappings::insert_hir_generic_param): Change
call site to accomodate the new return type.
(Mappings::lookup_hir_generic_param): Wrap the function's return type
with an optional.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-hir-map.cc (Mappings::insert_hir_path_expr_seg): Change
call site to accomodate the new return type.
(Mappings::lookup_hir_path_expr_seg): Wrap the function's return type
with an optional.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-mangle-v0.cc (v0_path): Adapt call site to new returned
type.
* util/rust-hir-map.cc (Mappings::lookup_hir_expr): Change the
function's return type.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-item.cc (CompileItem::visit): Change call site
to accept new return type.
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile):
Likewise.
* backend/rust-mangle-v0.cc (v0_path): Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit):
Likewise.
* checks/lints/rust-lint-marklive.cc (MarkLive::go): Likewise.
(MarkLive::visit): Likewise.
* typecheck/rust-type-util.cc (query_type): Likewise.
* util/rust-hir-map.cc (Mappings::insert_hir_implitem): Likewise.
(Mappings::lookup_hir_implitem): Change return type.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* typecheck/rust-autoderef.cc: Adapt calling code to new return type.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise.
(TypeCheckExpr::resolve_operator_overload): Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_builtin_candidate):
Likewise.
* typecheck/rust-tyty.cc (ClosureType::setup_fn_once_output): Likewise.
* util/rust-hir-map.cc (Mappings::get_lang_item): Change return type.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/privacy/rust-visibility-resolver.cc: Update function
call to match the new return type.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
Likewise.
* util/rust-hir-map.cc (Mappings::insert_module): Likewise.
(Mappings::lookup_module): Change the function's return type.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile):
Adapt code around new return type.
* checks/errors/rust-const-checker.cc (ConstChecker::check_function_call):
Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::check_use_of_static):
Likewise.
(UnsafeChecker::check_function_call): Likewise.
* typecheck/rust-type-util.cc (query_type): Likewise.
* util/rust-hir-map.cc (Mappings::insert_hir_extern_item): Likewise.
(Mappings::lookup_hir_extern_item): Change return type.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address):
Update code around lookup return type.
* typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound):
Likewise.
* typecheck/rust-tyty.cc (ClosureType::setup_fn_once_output):
Likewise.
* util/rust-hir-map.cc (Mappings::insert_defid_mapping): Likewise.
(Mappings::lookup_trait_item_defid): Update return type with an
optional.
(Mappings::get_lang_item): Likewise.
* util/rust-hir-map.h: Update the functions prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-hir-map.cc (Mappings::insert_defid_mapping): Adapt call
to new return type.
(Mappings::insert_local_defid_mapping): Likewise.
(Mappings::lookup_local_defid): Change return type to wrap it with an
optional.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address):
Change calling code to accomodate new return type.
* checks/errors/privacy/rust-privacy-reporter.cc:
Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate):
Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_builtin_candidate):
Likewise.
* typecheck/rust-tyty.cc (ClosureType::setup_fn_once_output): Likewise.
* util/rust-hir-map.cc (Mappings::lookup_defid): Change function's
return type.
* util/rust-hir-map.h: Update function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
Adapt the code to the new return types.
* resolve/rust-ast-resolve.cc (NameResolution::go): Likewise.
* util/rust-hir-map.cc (Mappings::get_crate_name): Change return type
to const string reference optional.
(Mappings::get_current_crate_name): Likewise.
* util/rust-hir-map.h: Update function prototypes.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-ast-resolve-toplevel.h: Adapt the code to the new
return type.
* rust-session-manager.cc (Session::load_extern_crate): Likewise.
* util/rust-hir-map.cc (Mappings::crate_num_to_nodeid): Change the
return type.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-ast-resolve-toplevel.h: Adapt the code to the new
return type.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Likewise.
* rust-session-manager.cc (Session::load_extern_crate): Likewise.
* util/rust-hir-map.cc (Mappings::lookup_crate_name): Change the return
type to an optional.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* typecheck/rust-type-util.cc (query_type): Adapt code to accomodate
the new return type.
* util/rust-hir-map.cc (Mappings::lookup_impl_block_type): Change
the function's return type and remove the out pointer argument.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* typecheck/rust-type-util.cc (query_type): Change call to the function
in order to accomodate the new return type.
* util/rust-hir-map.cc (Mappings::lookup_hir_impl_block): Change the
function's return type to an optional.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::check_function_call):
Adapt function call to new return type.
* typecheck/rust-type-util.cc (query_type): Likewise.
* util/rust-hir-map.cc (Mappings::insert_hir_extern_block): Likewise.
(Mappings::lookup_hir_extern_block): Change return type to an optional.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile):
Adapt return type to new optional.
* backend/rust-mangle-v0.cc (v0_function_path): Change prototype to use
the generic arguments vector instead of the whole HIR function.
(v0_path): Fix a bug with a null pointer being used to create the
trait function mangling.
* util/rust-hir-map.cc (Mappings::insert_hir_trait_item): Adapt code
to new return type.
(Mappings::lookup_hir_trait_item): Change the return type of the
function to an optional.
* util/rust-hir-map.h: Update the function's prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile):
Adapt function call to new return type.
* backend/rust-mangle-v0.cc (v0_path): Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::check_function_call):
Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::check_use_of_static):
Likewise.
(UnsafeChecker::check_function_call): Likewise.
(UnsafeChecker::check_function_attr): Likewise.
* checks/lints/rust-lint-marklive.cc (MarkLive::go): Likewise.
(MarkLive::visit): Likewise.
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait):
Likewise.
* typecheck/rust-type-util.cc (query_type): Likewise.
* util/rust-hir-map.cc (Mappings::insert_hir_item): Likewise.
(Mappings::lookup_hir_item): Change function return type to use
optional.
* util/rust-hir-map.h: Update function prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-hir-map.cc (Mappings::resolve_nodeid_to_stmt): Change the
return type and remove pointer out argument.
* util/rust-hir-map.h: Update function prototype.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-expr.cc (CompileExpr::generate_closure_function):
Adapt code for new optional return type.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_base_type_privacy):
Likewise.
* util/rust-hir-map.cc (Mappings::lookup_hir_to_node): Change return
type to an optional.
* util/rust-hir-map.h: Adapt function prototype with the new return
type.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): Change call to use
the returned optional.
(CompileExpr::generate_closure_function): Likewise.
* backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve):
Likewise.
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Likewise.
* backend/rust-mangle-v0.cc (v0_path): Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc:
Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit):
Likewise.
* checks/lints/rust-lint-marklive.cc (MarkLive::visit): Likewise.
(MarkLive::visit_path_segment): Likewise.
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait):
Likewise.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
Likewise.
(ResolveWhereClauseItem::visit): Likewise.
* util/rust-hir-map.cc (Mappings::lookup_node_to_hir): Return an
optional instead of a boolean.
* util/rust-hir-map.h: Change function prototype to match the new
return type.
2025-03-17 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-default-resolver.cc
(DefaultResolver::visit):
Verify constant item has expression before attempting to visit
the later.
2025-03-17 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-expr.cc
(check_match_scrutinee): Add assertion.
* backend/rust-compile-pattern.cc
(CompilePatternCheckExpr::visit):
Handle HIR::PathInExpression matching a non-enum.
2025-03-17 Nobel Singh <nobel2073@gmail.com>
* backend/rust-compile-expr.cc (check_match_scrutinee): Handle structs
2025-03-17 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-base.cc
(HIRCompileBase::compile_function_body):
Adjust unit_expression calls.
(HIRCompileBase::unit_expression):
Remove unused Context parameter.
* backend/rust-compile-base.h
(HIRCompileBase::unit_expression): Likewise.
* backend/rust-compile-block.cc
(CompileBlock::visit): Adjust unit_expression calls.
* backend/rust-compile-expr.cc
(CompileExpr::visit): Likewise.
* backend/rust-compile-pattern.cc
(CompilePatternLet::visit): Likewise.
* backend/rust-compile-resolve-path.cc
(ResolvePathRef::attempt_constructor_expression_lookup):
Likewise.
* backend/rust-compile-type.cc
(TyTyResolveCompile::get_implicit_enumeral_node_type):
Remove unused Context parameter.
(TyTyResolveCompile::get_unit_type):
Likewise.
(TyTyResolveCompile::visit):
Adjust get_implicit_enumeral_node_type and get_unit_type calls.
* backend/rust-compile-type.h
(TyTyResolveCompile::get_implicit_enumeral_node_type):
Remove unused Context parameter.
(TyTyResolveCompile::get_unit_type):
Likewise.
2025-03-17 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h: Change dereference from a pointer to a reference
accessor.
* ast/rust-expr.h: Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.h: Likewise.
* ast/rust-pattern.h: Likewise.
* ast/rust-type.h: Likewise.
* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address):
Likewise.
* backend/rust-compile-context.h: Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
(CompileExpr::generate_closure_function): Likewise.
* backend/rust-compile-extern.h: Likewise.
* backend/rust-compile-implitem.cc (CompileTraitItem::visit): Likewise.
* backend/rust-compile-intrinsic.cc (Intrinsics::compile): Likewise.
* backend/rust-compile-item.cc (CompileItem::visit): Likewise.
* backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve):
Likewise.
(HIRCompileBase::query_compile): Likewise.
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Likewise.
(TyTyResolveCompile::create_dyn_obj_record): Likewise.
* backend/rust-compile.cc (HIRCompileBase::coerce_to_dyn_object):
Likewise.
* backend/rust-mangle-v0.cc (v0_path): Likewise.
(v0_mangle_item): Likewise.
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
Likewise.
* checks/errors/privacy/rust-privacy-check.cc (Resolver::resolve):
Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::ConstChecker):
Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::UnsafeChecker):
Likewise.
* checks/lints/rust-lint-marklive-base.h: Likewise.
* checks/lints/rust-lint-marklive.cc (MarkLive::go): Likewise.
(MarkLive::visit): Likewise.
(MarkLive::visit_path_segment): Likewise.
* checks/lints/rust-lint-marklive.h: Likewise.
* checks/lints/rust-lint-scan-deadcode.h: Likewise.
* expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Likewise.
* expand/rust-macro-expand.h (struct MacroExpander): Change mapping
from pointer to a reference.
* expand/rust-proc-macro.cc (BangProcMacro::BangProcMacro): Replace
pointer accessor with reference accessor.
(AttributeProcMacro::AttributeProcMacro): Likewise.
(CustomDeriveProcMacro::CustomDeriveProcMacro): Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_lifetime):
Likewise.
(ASTLoweringBase::lower_loop_label): Likewise.
(ASTLoweringBase::lower_path_expr_seg): Likewise.
(ASTLoweringBase::lower_self): Likewise.
(ASTLoweringBase::handle_lang_item_attribute): Likewise.
(ASTLoweringBase::lower_extern_block): Likewise.
(ASTLoweringBase::lower_macro_definition): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-block.h: Likewise.
* hir/rust-ast-lower-enumitem.h: Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::translate): Likewise.
(ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-extern.h: Likewise.
* hir/rust-ast-lower-implitem.cc (ASTLowerImplItem::translate):
Likewise.
(ASTLowerImplItem::visit): Likewise.
(ASTLowerTraitItem::translate): Likewise.
(ASTLowerTraitItem::visit): Likewise.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::translate): Likewise.
(ASTLoweringItem::visit): Likewise.
(ASTLoweringSimplePath::lower): Likewise.
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::translate):
Likewise.
(ASTLoweringPattern::visit): Likewise.
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::translate): Likewise.
(ASTLoweringStmt::visit): Likewise.
* hir/rust-ast-lower-struct-field-expr.h: Likewise.
* hir/rust-ast-lower-type.cc (ASTLowerTypePath::visit): Likewise.
(ASTLowerQualifiedPathInType::visit): Likewise.
(ASTLoweringType::translate): Likewise.
(ASTLoweringType::visit): Likewise.
(ASTLowerGenericParam::translate): Likewise.
(ASTLowerGenericParam::visit): Likewise.
(ASTLoweringTypeBounds::translate): Likewise.
(ASTLoweringTypeBounds::visit): Likewise.
(ASTLowerWhereClauseItem::translate): Likewise.
(ASTLowerWhereClauseItem::visit): Likewise.
* hir/rust-ast-lower.cc (ASTLowering::go): Likewise.
(ASTLoweringBlock::visit): Likewise.
(ASTLoweringIfBlock::visit): Likewise.
(ASTLoweringIfLetBlock::visit): Likewise.
(ASTLowerStructExprField::visit): Likewise.
(ASTLoweringExprWithBlock::visit): Likewise.
(ASTLowerPathInExpression::visit): Likewise.
(ASTLoweringBase::lower_qual_path_type): Likewise.
(ASTLowerQualPathInExpression::visit): Likewise.
* metadata/rust-export-metadata.cc (ExportContext::emit_trait):
Likewise.
(ExportContext::emit_function): Likewise.
(ExportContext::emit_macro): Likewise.
(PublicInterface::PublicInterface): Likewise.
(PublicInterface::expected_metadata_filename): Likewise.
* metadata/rust-export-metadata.h: Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit):
Likewise.
(ResolveItem::visit): Likewise.
(ResolveExternItem::visit): Likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path):
Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go):
Likewise.
(ResolveTypeToCanonicalPath::visit): Likewise.
* resolve/rust-ast-resolve-type.h: Likewise.
* resolve/rust-ast-resolve.cc (NameResolution::NameResolution):
Likewise.
(NameResolution::go): Likewise.
* resolve/rust-ast-resolve.h: Likewise.
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes):
Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::EarlyNameResolver):
Likewise.
* resolve/rust-late-name-resolver-2.0.cc (next_node_id): Likewise.
(next_hir_id): Likewise.
* resolve/rust-name-resolution-context.cc (NameResolutionContext::NameResolutionContext):
Likewise.
* resolve/rust-name-resolver.cc (Resolver::Resolver): Likewise.
(Resolver::generate_builtins): Likewise.
(Resolver::setup_builtin): Likewise.
* resolve/rust-name-resolver.h: Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Likewise.
(TopLevel::handle_use_glob): Likewise.
* rust-session-manager.cc (Session::get_instance): Likewise.
(Session::handle_input_files): Likewise.
(Session::handle_crate_name): Likewise.
(Session::compile_crate): Likewise.
(Session::load_extern_crate): Likewise.
* rust-session-manager.h: Likewise.
* typecheck/rust-autoderef.cc (Adjuster::try_unsize_type): Likewise.
* typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion):
Likewise.
(TypeCoercionRules::coerce_unsafe_ptr): Likewise.
(TypeCoercionRules::coerce_borrowed_pointer): Likewise.
(TypeCoercionRules::coerce_unsized): Likewise.
* typecheck/rust-coercion.h: Likewise.
* typecheck/rust-hir-dot-operator.cc (MethodResolver::select):
Likewise.
* typecheck/rust-hir-inherent-impl-overlap.h: Likewise.
* typecheck/rust-hir-path-probe.cc (PathProbeType::process_enum_item_for_candiates):
Likewise.
(PathProbeType::process_impl_items_for_candidates): Likewise.
(PathProbeImplTrait::process_trait_impl_items_for_candidates):
Likewise.
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait):
Likewise.
(TraitItemReference::get_parent_trait_mappings): Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal):
Likewise.
(TypeCheckBase::get_marker_predicate): Likewise.
* typecheck/rust-hir-type-check-base.h: Likewise.
* typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit):
Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise.
(TypeCheckExpr::resolve_operator_overload): Likewise.
(TypeCheckExpr::resolve_fn_trait_call): Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit):
Likewise.
(TypeCheckImplItem::visit): Likewise.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit):
Likewise.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
Likewise.
(TypeCheckExpr::resolve_segments): Likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::emit_pattern_size_error):
Likewise.
(ClosureParamInfer::Resolve): Likewise.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve):
Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): Likewise.
(TypeCheckType::resolve_root_path): Likewise.
(TypeResolveGenericParam::visit): Likewise.
(ResolveWhereClauseItem::visit): Likewise.
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn):
Likewise.
* typecheck/rust-type-util.cc (query_type): Likewise.
* typecheck/rust-typecheck-context.cc (TypeCheckContext::compute_inference_variables):
Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Likewise.
(TypeBoundsProbe::assemble_builtin_candidate): Likewise.
(TypeCheckBase::get_predicate_from_bound): Likewise.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise.
(TypeCheckMethodCallExpr::check): Likewise.
* typecheck/rust-tyty-call.h: Likewise.
* typecheck/rust-tyty-cmp.h: Likewise.
* typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::override_context):
Likewise.
(SubstitutionRef::monomorphize): Likewise.
* typecheck/rust-tyty-util.cc (TyVar::get_implicit_infer_var):
Likewise.
(TyVar::monomorphized_clone): Likewise.
(TyWithLocation::TyWithLocation): Likewise.
* typecheck/rust-tyty.cc (BaseType::satisfies_bound): Likewise.
(InferType::clone): Likewise.
(ADTType::handle_substitions): Likewise.
(TupleType::handle_substitions): Likewise.
(FnType::handle_substitions): Likewise.
(ClosureType::setup_fn_once_output): Likewise.
(ArrayType::handle_substitions): Likewise.
(SliceType::handle_substitions): Likewise.
(ReferenceType::handle_substitions): Likewise.
(PointerType::handle_substitions): Likewise.
(ParamType::handle_substitions): Likewise.
* typecheck/rust-tyty.h: Likewise.
* typecheck/rust-unify.cc (UnifyRules::UnifyRules): Likewise.
(UnifyRules::commit): Likewise.
* util/rust-hir-map.cc: Change getter return type to a reference.
* util/rust-hir-map.h: Update function's prototype.
2025-03-17 Mael Cravero <mael.cravero@embecosm.com>
* rust-gcc.cc: remove unnecessary TREE_SIDE_EFFECTS and TREE_READONLY
macros used in arithmetic overflow checks.
2025-03-17 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc
(ExprStmtBuilder::visit): Use std::ignore.
2025-03-17 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi_generated.rs: Error reporting.
* checks/errors/borrowck/ffi-polonius/src/lib.rs: Error reporting.
* checks/errors/borrowck/polonius/rust-polonius-ffi.h (struct FactsView):
Error reporting.
(struct Output): Error reporting.
* checks/errors/borrowck/polonius/rust-polonius.h (struct Facts): Error reporting.
* checks/errors/borrowck/rust-borrow-checker.cc: Error reporting.
2025-03-17 Jakub Dupak <dev@jakubdupak.com>
* Make-lang.in: Link Polonius.
* checks/errors/borrowck/rust-borrow-checker.cc: Run Polonius.
2025-03-17 Jakub Dupak <dev@jakubdupak.com>
* Make-lang.in: Build Polonius.
2025-03-17 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/polonius/rust-polonius.h (struct FullPoint):
Polonius facts dump.
(struct Facts): Polonius facts dump.
* checks/errors/borrowck/rust-bir-dump.cc (Dump::go):
Polonius facts dump.
(Dump::visit): Polonius facts dump.
(Dump::visit_place): Polonius facts dump.
(Dump::visit_move_place): Polonius facts dump.
(Dump::visit_scope): Polonius facts dump.
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go): Polonius facts dump.
2025-03-17 Kushal Pal <kushalpal109@gmail.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): Lines
removed as the objects are unused.
2025-03-17 zhanghe9702 <zhanghe9702@163.com>
* backend/rust-tree.h: removing the CLASSTYPE_VBASECLASSES macro
which is duplicated three times.
2025-03-06 Simon Martin <simon@nasilyan.com>
* rust-diagnostics.h (RUST_ATTRIBUTE_GCC_DIAG): Fix comment
typo, paramter -> parameter.
2024-12-02 Owen Avery <powerboat9.gamer@gmail.com>
Thomas Schwinge <tschwinge@baylibre.com>
* typecheck/rust-hir-type-check-toplevel.cc: Removed.
* typecheck/rust-hir-type-check-toplevel.h: Removed.
2024-11-28 David Malcolm <dmalcolm@redhat.com>
PR c/104896
* backend/rust-compile-expr.cc
(CompileExpr::compile_integer_literal): Replace "%<%s%>" with
"%qs" in message wording.
(CompileExpr::compile_float_literal): Likewise.
* backend/rust-compile-intrinsic.cc (Intrinsics::compile):
Likewise.
* backend/rust-tree.cc (maybe_warn_nodiscard): Likewise.
* checks/lints/rust-lint-scan-deadcode.h: Likewise.
* lex/rust-lex.cc (Lexer::parse_partial_unicode_escape): Likewise.
(Lexer::parse_raw_byte_string): Likewise.
* lex/rust-token.cc (Token::get_str): Likewise.
* metadata/rust-export-metadata.cc
(PublicInterface::write_to_path): Likewise.
* parse/rust-parse.cc
(peculiar_fragment_match_compatible_fragment): Likewise.
(peculiar_fragment_match_compatible): Likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path):
Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go):
Likewise.
* rust-session-manager.cc (validate_crate_name): Likewise.
(Session::load_extern_crate): Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise.
(TypeCheckExpr::resolve_fn_trait_call): Likewise.
* typecheck/rust-hir-type-check-implitem.cc
(TypeCheckImplItemWithTrait::visit): Likewise.
* typecheck/rust-hir-type-check-item.cc
(TypeCheckItem::validate_trait_impl_block): Likewise.
* typecheck/rust-hir-type-check-struct.cc
(TypeCheckStructExpr::visit): Likewise.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit):
Likewise.
* typecheck/rust-tyty.cc (BaseType::bounds_compatible): Likewise.
* typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch):
Likewise.
* util/rust-attributes.cc (AttributeChecker::visit): Likewise.
2024-11-22 Andrew Pinski <quic_apinski@quicinc.com>
PR bootstrap/117737
* resolve/rust-ast-resolve-expr.cc (INCLUDE_MEMORY): Remove.
* rust-attribs.cc (INCLUDE_MEMORY): Remove.
* rust-system.h (INCLUDE_MEMORY): Remove.
2024-11-01 David Malcolm <dmalcolm@redhat.com>
PR bootstrap/117361
* Make-lang.in (s-selftest-rust): Use GCC_FOR_SELFTESTS.
(selftest-rust-gdb): Likewise.
(selftest-rust-valgrind): Likewise.
2024-10-25 Jakub Jelinek <jakub@redhat.com>
* util/optional.h: Remove trailing whitespace.
* util/expected.h: Likewise.
* util/rust-unicode-data.h: Likewise.
2024-10-24 David Malcolm <dmalcolm@redhat.com>
Gaius Mulley <gaiusmod2@gmail.com>
PR other/116613
* resolve/rust-ast-resolve-expr.cc: Add #define INCLUDE_MEMORY.
* rust-attribs.cc: Likewise.
* rust-system.h: Likewise.
2024-10-18 Alejandro Colomar <alx@kernel.org>
* backend/rust-tree.h (array_type_nelts_top)
* backend/rust-tree.cc (array_type_nelts_top):
Remove function.
2024-10-18 Alejandro Colomar <alx@kernel.org>
* backend/rust-tree.cc (array_type_nelts_top):
Rename array_type_nelts => array_type_nelts_minus_one
2024-09-26 Owen Avery <powerboat9.gamer@gmail.com>
* checks/errors/borrowck/rust-bir.h
(class AbstractExpr): Add virtual destructor.
2024-09-25 Mikael Morin <mikael@gcc.gnu.org>
PR other/116801
* lang.opt.urls: Regenerate.
2024-09-20 David Malcolm <dmalcolm@redhat.com>
PR other/116613
* resolve/rust-ast-resolve-expr.cc
(funny_ice_finalizer): : Convert first param from
diagnostic_context * to diagnostic_text_output_format &.
(ResolveExpr::visit): Update for renaming.
2024-08-12 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/errors/borrowck/rust-bir-builder.h: Cast size_t values to unsigned
long before printing.
* checks/errors/borrowck/rust-bir-fact-collector.h: Likewise.
2024-08-12 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/errors/borrowck/rust-bir-fact-collector.h (points): Rename
`push_subset(PlaceId, PlaceId)` to `push_subset_place(PlaceId, PlaceId)`
2024-08-05 Thomas Schwinge <tschwinge@baylibre.com>
* Make-lang.in (RUST_LIBDEPS): Inline into all users.
2024-08-05 Thomas Schwinge <tschwinge@baylibre.com>
* Make-lang.in (LIBS): Don't override.
(crab1$(exeext):): Use 'CRAB1_LIBS'.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Visit
inherent impl type.
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs: Bump copyright.
* checks/errors/borrowck/ffi-polonius/src/lib.rs: Bump copyright.
* checks/errors/borrowck/polonius/rust-polonius-ffi.h: Bump copyright.
* checks/errors/borrowck/polonius/rust-polonius.h: Bump copyright.
* checks/errors/borrowck/rust-bir-dump.cc: Bump copyright.
* checks/errors/borrowck/rust-bir-fact-collector.h: Bump copyright.
* checks/errors/borrowck/rust-bir-free-region.h: Bump copyright.
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-dump.cc (renumber_places):
Remove unecessary braces.
(Dump::go): Remove unecessary braces.
(Dump::visit): Remove unecessary braces.
(Dump::visit_scope): Remove unecessary braces.
* checks/errors/borrowck/rust-bir-fact-collector.h (class FactCollector):
Remove unecessary braces.
(points): Remove unecessary braces.
* checks/errors/borrowck/rust-bir-free-region.h: Remove unecessary braces.
* checks/errors/borrowck/rust-bir-place.h: Remove unecessary braces.
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
Remove unecessary braces.
* checks/errors/borrowck/rust-function-collector.h: Remove unecessary braces.
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-fact-collector.h: New file.
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
Enable fact collection.
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-place.h (struct Lifetime):
Extended regions and loans.
(struct Loan): Representation of loan (result of borrowing)
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
Fix let stmt handling.
* checks/errors/borrowck/rust-bir-builder-pattern.h: improved
pattern translation
* checks/errors/borrowck/rust-bir-builder-internal.h: region binding
* checks/errors/borrowck/rust-bir-builder-expr-stmt.h (class ExprStmtBuilder):
Region support.
(class RenumberCtx): Region support.
* checks/errors/borrowck/rust-bir-builder.h (class Builder): Region support.
* checks/errors/borrowck/rust-bir-dump.cc (get_lifetime_name): Region support.
(renumber_places): Region support.
(Dump::go): Region support.
(Dump::visit): Region support.
(Dump::visit_lifetime): Region support.
(Dump::visit_scope): Region support.
* checks/errors/borrowck/rust-bir.h (class AbstractExpr): Region support.
(struct Function): Region support.
(class BorrowExpr): Region support.
(class CallExpr): Region support.
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* typecheck/rust-tyty-variance-analysis-private.h (class FieldVisitorCtx):
Region extraction.
* typecheck/rust-tyty-variance-analysis.cc (query_field_regions): Region extraction.
(FieldVisitorCtx::collect_regions): Region extraction.
(FieldVisitorCtx::add_constraints_from_ty): Region extraction.
(FieldVisitorCtx::add_constraints_from_region): Region
extraction.
(FieldVisitorCtx::add_constrints_from_param): Region extraction.
* typecheck/rust-tyty-variance-analysis.h (query_field_regions):
Region extraction.
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-free-region.h: New file.
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/ffi-polonius/Cargo.toml: New file.
* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs: New file.
* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi_generated.rs: New file.
* checks/errors/borrowck/ffi-polonius/src/lib.rs: New file.
* checks/errors/borrowck/polonius/rust-polonius-ffi.h: New file.
* checks/errors/borrowck/polonius/rust-polonius.h: New file.
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-dump.cc (Dump::visit): const
visitor
* checks/errors/borrowck/rust-bir-dump.h: const visitor
* checks/errors/borrowck/rust-bir-visitor.h: const visitor
* checks/errors/borrowck/rust-bir.h: const getter
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Emit moves.
* checks/errors/borrowck/rust-bir-builder-internal.h: Emit moves.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Emit moves.
* checks/errors/borrowck/rust-bir-dump.cc (Dump::visit_move_place): Emit moves.
(Dump::visit): Emit moves.
* checks/errors/borrowck/rust-bir-place.h (struct Place): Emit moves.
* checks/errors/borrowck/rust-bir-visitor.h: Emit moves.
* checks/errors/borrowck/rust-bir.h (enum class): Emit moves.
(class AbstractExpr): Emit moves.
(BasicBlock::is_terminated): Emit moves.
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::setup_loop):
Loop handling.
(ExprStmtBuilder::visit): Handle scopes.
* checks/errors/borrowck/rust-bir-builder-internal.h (struct BuilderContext):
Handle scopes.
* checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Dump scopes.
(Dump::visit): Add scopes dump.
(Dump::indent): Add indentation logic.
(Dump::visit_scope): Dump scope.
* checks/errors/borrowck/rust-bir-dump.h: Dump methods.
* checks/errors/borrowck/rust-bir-place.h (std::numeric_limits::max): Scope constants.
(struct Scope): Scope representation.
(class PlaceDB): Scope tracking.
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-place.h:
Create place tree traverse API.
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
Use callable API
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/bir-design-notes.md (nodes): Rename node to statement.
(Nodes): Rename node to statement.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
Rename node to statement.
* checks/errors/borrowck/rust-bir-builder-internal.h: Rename node to statement.
* checks/errors/borrowck/rust-bir-builder.h: Rename node to statement.
* checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Rename node to statement.
(Dump::visit): Rename node to statement.
* checks/errors/borrowck/rust-bir-dump.h (class Dump): Rename node to statement.
* checks/errors/borrowck/rust-bir-visitor.h (class Node): Rename node to statement.
(class Statement): Rename node to statement.
* checks/errors/borrowck/rust-bir.h (class Node): Rename node to statement.
(class Statement): Rename node to statement.
(class AbstractExpr): Rename node to statement.
(struct Function): Rename node to statement.
(struct BasicBlock): Rename node to statement.
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-dump.cc: Use rust-system.h
* checks/errors/borrowck/rust-bir-dump.h (RUST_BIR_DUMP_H): Use rust-system.h
* checks/errors/borrowck/rust-bir-place.h (RUST_BIR_PLACE_H): Use rust-system.h
* checks/errors/borrowck/rust-function-collector.h: Use rust-system.h
* rust-system.h: Use rust-system.h
* typecheck/rust-hir-type-check.h: Use rust-system.h
* typecheck/rust-tyty-subst.cc: Use rust-system.h
* typecheck/rust-tyty-subst.h: Use rust-system.h
* typecheck/rust-tyty.h: Use rust-system.h
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* typecheck/rust-unify.cc (UnifyRules::go): Always unify to `ltype` if
we are matching against a `Never` in `rtype`.
(UnifyRules::expect_never): Always unify to the expected type.
2024-08-01 Owen Avery <powerboat9.gamer@gmail.com>
* lex/rust-lex.cc
(Lexer::parse_raw_string):
Bring handling of edge cases to par with parse_raw_byte_string.
2024-08-01 Owen Avery <powerboat9.gamer@gmail.com>
* parse/rust-parse-impl.h
(Parser::parse_vis_item):
Call parse_function instead of parse_async_item when finding
UNSAFE or EXTERN_KW during lookahead.
2024-08-01 Owen Avery <powerboat9.gamer@gmail.com>
* util/rust-attribute-values.h
(Attributes::UNSTABLE): New.
* util/rust-attributes.cc
(__definitions): Add Attributes::UNSTABLE.
2024-08-01 Owen Avery <powerboat9.gamer@gmail.com>
* util/rust-attribute-values.h
(Attributes::RUSTC_DEPRECATED): New.
* util/rust-attributes.cc
(__definitions): Add Attributes::RUSTC_DEPRECATED.
2024-08-01 Owen Avery <powerboat9.gamer@gmail.com>
* lex/rust-lex.cc
(Lexer::parse_raw_byte_string):
Bring handling of edge cases to par with parse_byte_string.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-forever-stack.h: Change dfs function prototype and
declare dfs return type structure.
* resolve/rust-forever-stack.hxx: Adapt dfs function to the new return
type.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-compile-resolve-path.cc: Attempt to resolve names
also using new name resolution context.
* backend/rust-compile-resolve-path.h: Add new declaration.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_glob):
Change function prototype to use a reference instead.
(TopLevel::handle_use_dec): Likewise.
(TopLevel::handle_rebind): Add name resolution on rebind use
declarations.
(flatten_rebind): Change prototype to accept a pair of path/alias.
(flatten_list): Adapt call to flatten_rebind.
(flatten): Adapt call to flatten_rebind.
(flatten_glob): Remove unused part.
(TopLevel::visit): Add rebind resolution.
* resolve/rust-toplevel-name-resolver-2.0.h: Adapt function prototypes.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add mapping
implementation.
* resolve/rust-late-name-resolver-2.0.h: Add function visitor prototype
override.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_dec):
Replace the string format %<%s%> with the proper %qs format.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
Only get immutable name resolution context when name resolution 2.0 is
used.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
Likewise.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-canonical-path.h: Also assign crate number.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Add
Self generic parameter injection and a warning.
* resolve/rust-toplevel-name-resolver-2.0.h: Add function prototype.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-item.cc (CompileItem::visit): Check the resolver
flag and use the new one when required.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove
empty visit function.
* resolve/rust-default-resolver.h: Remove function prototype.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove
visitor implementation and scoping.
* resolve/rust-default-resolver.h: Remove function prototype.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Add
constant identifiers to the resolver.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Change
search location for struct types.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Change enum type namespace.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Add tuple struct type to the resolver's context.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Add the struct constructor when the struct is a unit.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Change the
namespace for values from "label" to "values".
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove
function implementation.
* resolve/rust-default-resolver.h: Remove function prototype.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Visit
constant item's types.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Visit
function return type.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
Change error message to match old resolver and test case.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Add
the struct constructor to the value namespace.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc (Early::visit): Adapt
resolved type to the new API.
(Early::visit_attributes): Retrieve the node id from the definition.
* resolve/rust-forever-stack.h: Change the return type of getter
functions. Those functions now return a definition type instead of a
node id.
* resolve/rust-forever-stack.hxx: Change member function implementation
in the forever stack to accomodate it's API changes.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Use internal
node id. Emit an error when resolving multiple ambiguous values.
* resolve/rust-rib.cc (Rib::Definition::Definition): Add a default
constructor.
(Rib::Definition::is_ambiguous): Add a new function to determine
whether a function definition is ambiguous or not.
(Rib::Definition::to_string): Add a member function to convert a given
definition to a string.
(Rib::insert): Add new rules for value insertion in a rib. Insertion
order does not impact the result anymore: inserting a shadowable value
after a non shadowable one does not trigger an error anymore. All
shadowable values inserted in a rib are kepts until being replaced by a
non shadowable one.
(Rib::get): Return a definition instead of a node id.
* resolve/rust-rib.h: Update function prototypes.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_glob):
Update return value container to match the new function's prototype.
(TopLevel::handle_use_dec): Likewise.
(flatten_glob): Likewise.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-forever-stack.h: Add a new function prototype to insert
a shadowable definition.
* resolve/rust-forever-stack.hxx: Add the new insert_shadowable
function to insert shadowable definition into the forever stack.
* resolve/rust-name-resolution-context.cc (NameResolutionContext::insert_shadowable):
Likewise with the name resolution context.
* resolve/rust-name-resolution-context.h: Add name resolution context
insert_shadowable member function prototype.
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Insert shadowable definition into the forever stack for glob use
declaration.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add a check
for missing item.
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::go):
Add a new function in the visitor to dispatch the visitor to items in
the given module.
(TopLevel::handle_use_glob): Change call to visitor to use the pointer.
* resolve/rust-toplevel-name-resolver-2.0.h: Add prototype for new
member function.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/lints/rust-lint-marklive.cc (MarkLive::find_ref_node_id):
Add code path for the resolver 2.0
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Remove failing
label context resolve call.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Insert names into their namespace.
(TopLevel::visit): Insert ast module.
(TopLevel::handle_use_dec): Resolve use declaration.
(TopLevel::handle_use_glob): Use globbing visitor.
(flatten_list): Use globbing path vector.
(flatten_glob): Likewise.
(flatten): Likewise.
(prefix_subpaths): Add a function to prefix subpath.
* resolve/rust-toplevel-name-resolver-2.0.h (class GlobbingVisitor):
Add globbing visitor.
* util/rust-hir-map.cc (Mappings::insert_ast_module): Add function to
insert module in module hashmap.
(Mappings::lookup_ast_module): Add function to retrieve ast module.
* util/rust-hir-map.h: Add module map and getter/setter prototypes.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Module
should be added to the type namespace in order to be retrieved later.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::setup_builtin_types):
Setup bool as builtin type.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (insert_macros): Add
constraint over the ast node id.
(TopLevel::visit): Likewise.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Change
error message.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_dec):
Use the new dict to track down already resolved use declarations.
* resolve/rust-toplevel-name-resolver-2.0.h: Add new dict to store
previous use declarations.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::insert_or_error_out):
Add new constraint to duplicate errors.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-forever-stack.hxx: Start using Rib::Definition for
shadowable information.
* resolve/rust-late-name-resolver-2.0.cc (next_node_id): New.
(next_hir_id): New.
(Late::setup_builtin_types): Improve builtin type setup.
* resolve/rust-rib.cc (Rib::Definition::Definition): New constructor.
(Rib::Definition::Shadowable): Likewise.
(Rib::Definition::NonShadowable): Likewise.
(Rib::Rib): Fix general constructor.
(Rib::insert): Use Definition class.
(Rib::get): Likewise.
* resolve/rust-rib.h: New Definition class, new prototypes.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-name-resolution-context.cc (NameResolutionContext::map_usage):
Use newtype pattern.
(NameResolutionContext::lookup): Likewise.
* resolve/rust-name-resolution-context.h (class Usage): New class.
(class Definition): Likewise.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Create instances
of Usage and Definition.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-compile-base.cc: Use new ImmutableNrCtx.
* backend/rust-compile-context.h: Likewise.
* backend/rust-compile-expr.cc: Likewise.
* backend/rust-compile-item.cc: Likewise.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Start
fetching name resolution information in the typechecker.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
Likewise.
* typecheck/rust-hir-type-check-path.cc: Use nr 2.0.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-name-resolution-context.cc (NameResolutionContext::lookup):
Add lookup function.
* resolve/rust-name-resolution-context.h: Include mappings and optional.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-session-manager.cc (Session::compile_crate): Create an immutable
view of the name resolution context.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-session-manager.cc: Add files for dumping name resolution, call
name resolution dump function.
(Session::dump_name_resolution): New.
* rust-session-manager.h: New declaration.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-session-manager.cc (Session::compile_crate): Create name resolution
context for Session::expansion and subsequent name resolution passes.
(Session::expansion): Take name resolution context as a parameter
instead.
* rust-session-manager.h (Session::expansion): Fix declaration.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Compile it.
* resolve/rust-immutable-name-resolution-context.cc: New file.
* resolve/rust-immutable-name-resolution-context.h: New file.
2024-08-01 Thomas Schwinge <tschwinge@baylibre.com>
* lex/rust-lex.cc (is_identifier_start): Placate clang-format.
2024-08-01 jjasmine <tanghocle456@gmail.com>
* Make-lang.in: add new .o builds for new .cc files
* expand/rust-cfg-strip.h (RUST_CFG_STRIP_H): Add include guards
for rust-cfg-strip
* expand/rust-macro-builtins.cc (make_macro_path_str): moved to new respective files
(make_token): moved to new respective files
(make_string): moved to new respective files
(macro_end_token): moved to new respective files
(try_extract_string_literal_from_fragment): moved to new respective files
(try_expand_many_expr): moved to new respective files
(parse_single_string_literal): moved to new respective files
(source_relative_path): moved to new respective files
(load_file_bytes): moved to new respective files
(MacroBuiltin::assert_handler): moved to new respective files
(MacroBuiltin::file_handler): moved to new respective files
(MacroBuiltin::column_handler): moved to new respective files
(MacroBuiltin::include_bytes_handler): moved to new respective files
(MacroBuiltin::include_str_handler): moved to new respective files
(MacroBuiltin::compile_error_handler): moved to new respective files
(MacroBuiltin::concat_handler): moved to new respective files
(MacroBuiltin::env_handler): moved to new respective files
(MacroBuiltin::cfg_handler): moved to new respective files
(MacroBuiltin::include_handler): moved to new respective files
(MacroBuiltin::line_handler): moved to new respective files
(MacroBuiltin::stringify_handler): moved to new respective files
(struct FormatArgsInput): moved to new respective files
(struct FormatArgsParseError): moved to new respective files
(format_args_parse_arguments): moved to new respective files
(MacroBuiltin::format_args_handler): moved to new respective files
* expand/rust-macro-builtins.h (builtin_macro_from_string):
merge tl::optional from master
* expand/rust-macro-builtins-asm.cc: New file.
* expand/rust-macro-builtins-format-args.cc: New file.
* expand/rust-macro-builtins-helpers.cc: New file.
* expand/rust-macro-builtins-helpers.h: New file.
* expand/rust-macro-builtins-include.cc: New file.
* expand/rust-macro-builtins-location.cc: New file.
* expand/rust-macro-builtins-log-debug.cc: New file.
* expand/rust-macro-builtins-test-bench.cc: New file.
* expand/rust-macro-builtins-trait.cc: New file.
* expand/rust-macro-builtins-utility.cc: New file.
2024-08-01 Guillaume Gomez <guillaume1.gomez@gmail.com>
* expand/rust-derive.cc (DeriveVisitor::derive): Fix typo
2024-08-01 jjasmine <tanghocle456@gmail.com>
* hir/rust-ast-lower-extern.h: Add translate_visiblity
* hir/tree/rust-hir-item.h: Fix constructor of ExternalTypeItem
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit):
Collect variance info from types.
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* Make-lang.in: Add new .cc file.
* rust-session-manager.cc (Session::compile_crate): Run
analysis.
* typecheck/rust-tyty-variance-analysis-private.h: New file.
* typecheck/rust-tyty-variance-analysis.cc: New file.
* typecheck/rust-tyty-variance-analysis.h: New file.
* typecheck/rust-typecheck-context.cc
(TypeCheckContext::get_variance_analysis_ctx):
Variance analysis context.
* typecheck/rust-hir-type-check.h (TypeCheckItem::visit):
Variance analysis context.
2024-08-01 Jakub Dupak <dev@jakubdupak.com>
* typecheck/rust-tyty-subst.cc (SubstitutionRef::get_arg_at):
Add unified API.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-builtins.cc (struct FormatArgsInput): Store the format_str
as a string instead of an AST::Expr.
(format_args_parse_arguments): Transform format_expr into a format string
properly - add note for handling eager macro invocations later on.
(MacroBuiltin::format_args_handler): Parse the correct input, append
newline to format_str if necessary.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.h: Rename AST::AstBuilder -> AST::Builder
* ast/rust-ast-builder.cc: Likewise.
* expand/rust-derive.cc: Use new AST::Builder name.
* expand/rust-derive.h: Likewise.
* ast/rust-builtin-ast-nodes.h: Add required getters.
* expand/rust-expand-format-args.cc (format_arg): New.
(get_trait_name): New.
(expand_format_args): Properly expand basic format_args!() invocations.
* expand/rust-expand-format-args.h (expand_format_args): Fix signature.
* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler):
Call into expand_format_args().
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-fmt.cc (ffi::RustHamster::to_string): New.
(Pieces::collect): Adapt to use new handle API.
(Pieces::~Pieces): Likewise.
(Pieces::Pieces): Likewise.
(Pieces::operator=): Likewise.
* ast/rust-fmt.h (struct RustString): Add members.
(struct FormatArgsHandle): New.
(clone_pieces): Adapt for new FFI API.
(destroy_pieces): Likewise.
(struct Pieces): Store new FormatArgsHandle type.
* expand/rust-expand-format-args.cc (expand_format_args): Use proper
namespace.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): FormatArgs
nodes are already resolved, so do nothing.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Add new object.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Remove calls to
FormatArgsLowering.
* expand/rust-expand-format-args.cc: New file.
* expand/rust-expand-format-args.h: New file.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-macro.h: Use proper node id instead of the one in the base
Expr class - which is uninitialized.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Remove reference
to unique pointer and replace it with a direct reference to the wrapped
data.
* ast/rust-ast.cc (VariadicParam::as_string): Likewise.
(BlockExpr::normalize_tail_expr): Likewise.
* ast/rust-expr.h: Likewise and add pointer getter in order to allow
pointer reseat.
* ast/rust-item.h: Likewise and add pointer getter for reseat.
* ast/rust-path.h: Likewise.
* ast/rust-pattern.h: Likewise.
* ast/rust-stmt.h: Likewise.
* ast/rust-type.h: Likewise.
* expand/rust-cfg-strip.cc (CfgStrip::maybe_strip_struct_fields):
Remove references to unique pointers and replace it with direct
references to the wrapped object.
(CfgStrip::maybe_strip_tuple_fields): Likewise.
(CfgStrip::maybe_strip_generic_args): Likewise.
(CfgStrip::maybe_strip_qualified_path_type): Likewise.
(CfgStrip::visit): Likewise.
* expand/rust-expand-visitor.cc (ExpandVisitor::maybe_expand_expr):
Likewise.
(ExpandVisitor::maybe_expand_type): Likewise.
(ExpandVisitor::visit): Likewise.
* expand/rust-expand-visitor.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_binding):
Likewise.
(ASTLoweringBase::lower_generic_args): Likewise.
(ASTLoweringBase::lower_self): Likewise.
(ASTLoweringBase::lower_type_no_bounds): Likewise.
(ASTLoweringBase::lower_bound): Likewise.
(ASTLoweringBase::lower_range_pattern_bound): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-block.h: Likewise.
* hir/rust-ast-lower-enumitem.h: Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::translate): Likewise.
(ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-expr.h: Likewise.
* hir/rust-ast-lower-extern.h: Likewise.
* hir/rust-ast-lower-implitem.cc (ASTLowerImplItem::translate):
Likewise.
(ASTLowerImplItem::visit): Likewise.
(ASTLowerTraitItem::translate): Likewise.
(ASTLowerTraitItem::visit): Likewise.
* hir/rust-ast-lower-implitem.h: Likewise.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::translate): Likewise.
(ASTLoweringItem::visit): Likewise.
* hir/rust-ast-lower-item.h: Likewise.
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::translate):
Likewise.
(ASTLoweringPattern::visit): Likewise.
* hir/rust-ast-lower-pattern.h: Likewise.
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Likewise.
* hir/rust-ast-lower-struct-field-expr.h: Likewise.
* hir/rust-ast-lower-type.cc (ASTLowerTypePath::visit): Likewise.
(ASTLowerQualifiedPathInType::visit): Likewise.
(ASTLoweringType::translate): Likewise.
(ASTLoweringType::visit): Likewise.
(ASTLowerGenericParam::translate): Likewise.
(ASTLowerGenericParam::visit): Likewise.
(ASTLoweringTypeBounds::translate): Likewise.
(ASTLoweringTypeBounds::visit): Likewise.
(ASTLowerWhereClauseItem::visit): Likewise.
* hir/rust-ast-lower-type.h: Likewise.
* hir/rust-ast-lower.cc (ASTLowering::go): Likewise.
(ASTLoweringBlock::visit): Likewise.
(ASTLoweringIfBlock::visit): Likewise.
(ASTLoweringIfLetBlock::visit): Likewise.
(ASTLowerStructExprField::visit): Likewise.
(ASTLoweringExprWithBlock::visit): Likewise.
(ASTLoweringBase::lower_qual_path_type): Likewise.
(ASTLoweringBase::lower_closure_param): Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::resolve_visibility):
Likewise.
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::go): Likewise.
(ResolveExpr::visit): Likewise.
(ResolveExpr::resolve_closure_param): Likewise.
* resolve/rust-ast-resolve-expr.h: Likewise.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit):
Likewise.
(ResolveItem::go): Likewise.
(ResolveItem::visit): Likewise.
(ResolveItem::resolve_impl_item): Likewise.
(ResolveItem::resolve_extern_item): Likewise.
(ResolveImplItems::go): Likewise.
(ResolveExternItem::go): Likewise.
(ResolveExternItem::visit): Likewise.
* resolve/rust-ast-resolve-item.h: Likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::go): Likewise.
(ResolvePath::resolve_path): Likewise.
* resolve/rust-ast-resolve-path.h: Likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::go):
Likewise.
(PatternDeclaration::visit): Likewise.
(resolve_range_pattern_bound): Likewise.
* resolve/rust-ast-resolve-pattern.h: Likewise.
* resolve/rust-ast-resolve-stmt.cc (ResolveStmt::visit): Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve-struct-expr-field.cc (ResolveStructExprField::go):
Likewise.
(ResolveStructExprField::visit): Likewise.
* resolve/rust-ast-resolve-struct-expr-field.h: Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveType::visit): Likewise.
(ResolveRelativeTypePath::go): Likewise.
(ResolveRelativeQualTypePath::resolve_qual_seg): Likewise.
(ResolveTypeToCanonicalPath::go): Likewise.
(ResolveTypeToCanonicalPath::visit): Likewise.
(ResolveGenericArgs::resolve_disambiguated_generic): Likewise.
(ResolveGenericArgs::go): Likewise.
* resolve/rust-ast-resolve-type.h: Likewise.
* resolve/rust-ast-resolve.cc (NameResolution::go): Likewise.
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::resolve_qualified_path_type):
Likewise.
(EarlyNameResolver::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Likewise.
* checks/errors/rust-ast-validation.cc: Likewise.
2024-08-01 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-item.h: Change getter function prototype to return a
reference directly instead of a reference to the wrapper type.
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Fix
the code to accept references instead.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_self): Change
function implementation to return a reference.
* hir/rust-ast-lower-base.h: Accept a reference instead of a unique
pointer reference.
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Adapt the code
to a reference instead of a unique pointer.
2024-08-01 Thomas Schwinge <tschwinge@baylibre.com>
* backend/rust-tree.cc (c_common_type_for_mode): Placate clang-format.
2024-08-01 0xn4utilus <gyanendrabanjare8@gmail.com>
* ast/rust-ast-collector.cc (TokenCollector::visit):
Remove dead code.
* ast/rust-ast-collector.h: Likewise.
* ast/rust-ast-full-decls.h (class ExternalFunctionItem):
Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit):
Likewise.
* ast/rust-ast-visitor.h: Likewise.
* ast/rust-ast.cc (ExternalFunctionItem::as_string): Likewise.
(ExternalFunctionItem::accept_vis): Likewise.
* checks/errors/rust-ast-validation.cc (ASTValidation::visit):
Likewise.
* checks/errors/rust-ast-validation.h: Likewise.
* checks/errors/rust-feature-gate.h: Likewise.
* expand/rust-cfg-strip.cc (CfgStrip::visit):
Likewise.
* expand/rust-cfg-strip.h: Likewise.
* expand/rust-derive.h: Likewise.
* expand/rust-expand-visitor.cc (ExpandVisitor::visit):
Likewise.
* expand/rust-expand-visitor.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit):
Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* metadata/rust-export-metadata.cc (ExportContext::emit_function):
Likewise.
* parse/rust-parse-impl.h: Likewise.
* parse/rust-parse.h: Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit):
Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
* resolve/rust-default-resolver.cc (DefaultResolver::visit):
Likewise.
* resolve/rust-default-resolver.h: Likewise.
* util/rust-attributes.cc (AttributeChecker::visit): Likewise.
* util/rust-attributes.h: Likewise.
2024-08-01 0xn4utilus <gyanendrabanjare8@gmail.com>
* checks/errors/rust-feature-gate.cc (FeatureGate::visit):
Check if function is_external or not.
* hir/rust-ast-lower-extern.h: Use AST::Function
instead of AST::ExternalFunctionItem.
* parse/rust-parse-impl.h (Parser::parse_external_item):
Likewise.
(Parser::parse_pattern): Fix clang format.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveExternItem::visit):
Likewise.
* resolve/rust-ast-resolve-item.h: Likewise.
* resolve/rust-default-resolver.cc (DefaultResolver::visit):
Check if param has_pattern before using get_pattern.
2024-08-01 0xn4utilus <gyanendrabanjare8@gmail.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit):
Add external function validation support. Add ErrorCode::E0130.
* parse/rust-parse-impl.h (Parser::parse_function): Parse
external functions from `parse_function`.
(Parser::parse_external_item): Clang format.
(Parser::parse_pattern): Clang format.
* parse/rust-parse.h: Add default parameter
`is_external` in `parse_function`.
2024-08-01 0xn4utilus <gyanendrabanjare8@gmail.com>
* ast/rust-ast.h: Add Kind Enum to
Pattern.
* ast/rust-macro.h: Add get_pattern_kind().
* ast/rust-path.h: Likewise.
* ast/rust-pattern.h: Likewise.
2024-08-01 0xn4utilus <gyanendrabanjare8@gmail.com>
* ast/rust-ast.cc (Function::Function): Add `is_external_function` field.
(Function::operator=): Likewise.
* ast/rust-ast.h: New constructor for ExternalItem.
* ast/rust-item.h (class Function): Add `is_external_function`
field. Update `get_node_id`.
* ast/rust-macro.h: Update copy constructor.
2024-08-01 Sourabh Jaiswal <sourabhrj31@gmail.com>
* expand/rust-expand-visitor.cc
(ExpandVisitor::expand_inner_items): Adjust to use has_value ()
(ExpandVisitor::expand_inner_stmts): Likewise
* expand/rust-macro-builtins.cc (builtin_macro_from_string): Likewise
(make_macro_path_str): Likewise
* util/rust-hir-map.cc (Mappings::insert_macro_def): Likewise
* util/rust-lang-item.cc (LangItem::Parse): Adjust to return tl::optional
(LangItem::toString) Likewise
* util/rust-token-converter.cc (handle_suffix): Adjust to use value.or ()
(from_literal) Likewise
* util/bi-map.h (BiMap::lookup): Adjust to use tl::optional for
lookups
2024-08-01 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-pattern.h
(class TupleStructPattern): Assert that items != nullptr.
(class TuplePattern): Likewise.
(TupleStructPattern::has_items): Remove.
(TuplePattern::has_tuple_pattern_items): Likewise.
* parse/rust-parse-impl.h
(Parser::parse_ident_leading_pattern):
Prevent construction of TupleStructPattern with
(items == nullptr).
(Parser::parse_pattern_no_alt): Likewise.
* ast/rust-ast-collector.cc
(TokenCollector::visit): Remove usage of
TupleStructPattern::has_items.
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): Likewise.
* resolve/rust-early-name-resolver.cc
(EarlyNameResolver::visit): Likewise.
2024-08-01 jjasmine <tanghocle456@gmail.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add error emitting
2024-08-01 jjasmine <tanghocle456@gmail.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add error emitting
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Add
documentation regarding future tasks.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Compile the new source file.
* ast/rust-ast-collector.cc (TokenCollector::visit): Error out when
visiting FormatArgs nodes.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* ast/rust-ast.cc (FormatArgs::get_locus): New.
* ast/rust-builtin-ast-nodes.h: Improve FormatArgs API.
* ast/rust-fmt.cc (Pieces::~Pieces): Cleanup.
(Pieces::Pieces): Likewise.
* ast/rust-fmt.h (struct Pieces): Add pieces_vector member.
* hir/rust-ast-lower-format-args.cc: New file.
* hir/rust-ast-lower-format-args.h: New file.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.cc: Make FormatArgs inherit from AST::Expr
* ast/rust-builtin-ast-nodes.h: Improve FormatArg* nodes and helpers.
* ast/rust-fmt.cc (Pieces::collect): Fix interface to match FFI function.
* ast/rust-fmt.h (collect_pieces): Likewise.
(struct Pieces): Add append_newline parameter.
* expand/rust-macro-builtins.cc: Add proper parsing of format_args
input.
* hir/rust-ast-lower-base.cc: Include diagnostics header.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* parse/rust-parse.h: New method.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-builtins.cc (format_args_maker): New function.
(try_expand_many_expr): Add comment about reworking function.
(MacroBuiltin::format_args_handler): Add newline parameter.
* expand/rust-macro-builtins.h: Likewise.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-builtin-ast-nodes.h: New file.
* ast/rust-ast-full-decls.h (class FormatArgs): Declare new class.
* ast/rust-ast-collector.cc: Handle FormatArgs nodes properly.
* ast/rust-ast-collector.h: Likewise.
* ast/rust-ast-full.h: Likewise.
* ast/rust-ast-visitor.cc: Likewise.
* ast/rust-ast-visitor.h: Likewise.
* ast/rust-ast.cc: Likewise.
* ast/rust-ast.h: Likewise.
* expand/rust-derive.h: Likewise.
* hir/rust-ast-lower-base.cc: Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-expr.cc: Likewise.
* hir/rust-ast-lower-expr.h: Likewise.
* resolve/rust-ast-resolve-base.cc: Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
2024-08-01 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-default-resolver.cc
(DefaultResolver::visit): Visit inner AST nodes of ClosureExprInner,
ClosureExprInnerTyped, IfExpr, IfExprConseqElse, MatchExpr,
PathInExpression, EnumItemTuple, EnumItemStruct, and
EnumItemDiscriminant.
* ast/rust-item.h
(EnumItemDiscriminant::has_expr): New function.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/rust-ast-lower-extern.h: Lower to HIR::ExternalTypeItem nodes.
* hir/tree/rust-hir-item.h (class ExternalTypeItem): Create private
visibility by default as extern types have no visibility - add a comment
about the correctness of this.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/tree/rust-hir-item.h (class ExternalTypeItem): New class.
* hir/tree/rust-hir.cc (ExternalTypeItem::as_string): Likewise.
* backend/rust-compile-extern.h: Add base for handling HIR::ExternalTypeItem
node.
* checks/errors/borrowck/rust-bir-builder-struct.h: Likewise.
* checks/errors/borrowck/rust-function-collector.h: Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-const-checker.h: Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.h: Likewise.
* hir/rust-ast-lower-extern.h: Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/rust-hir-dump.h: Likewise.
* hir/tree/rust-hir-full-decls.h (class ExternalTypeItem): Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
(ExternalTypeItem::accept_vis): Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.h: Likewise.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-ast-resolve-implitem.h: Declare external types as new
types.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-lang-item.h (class RustLangItem): Renamed to...
(class LangItem): ...this. Rename ItemType enum to Kind
* util/rust-lang-item.cc: Rename methods to use new class name.
* backend/rust-compile-expr.cc (CompileExpr::visit): Use new lang-item API.
(CompileExpr::resolve_operator_overload): Likewise.
* backend/rust-compile-expr.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_lang_item_attribute): Likewise.
* typecheck/rust-autoderef.cc (Adjuster::try_deref_type): Likewise.
(AutoderefCycle::cycle): Likewise.
* typecheck/rust-autoderef.h: Likewise.
* typecheck/rust-hir-type-bounds.h: Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): Likewise.
* typecheck/rust-hir-type-check-base.h: Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::visit): Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): Likewise.
(TypeBoundsProbe::assemble_builtin_candidate): Likewise.
(TypeCheckBase::get_predicate_from_bound): Likewise.
* typecheck/rust-tyty.cc (ClosureType::setup_fn_once_output): Likewise.
* util/rust-hir-map.cc (Mappings::get_lang_item): Likewise.
(Mappings::lookup_trait_item_lang_item): Likewise.
* util/rust-hir-map.h: Likewise.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Compile new rust-lang-item.o.
* util/rust-lang-item.h: Split into header and source.
* util/rust-lang-item.cc: Cleanup parsing of lang items by using a hashmap
and returning optional values, cleanup handling of exhaustive lang item
lookups.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_lang_item_attribute): Use
new optional API.
2024-08-01 jjasmine <tanghocle456@gmail.com>
* expand/rust-macro-builtins.cc: Change BuiltinMacro in
builtin_macro_from_string to tl::optional<>
* expand/rust-macro-builtins.h (enum class): Change BuiltinMacro
in builtin_macro_from_string to tl::optional<>
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
Resolved wrong type dependency of builtin_macro_from_string
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-fmt.cc (Pieces::collect): Fix signature to take ownership
of the given string.
* ast/rust-fmt.h (struct Pieces): Store parsed string in the struct.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler):
Transform entire invocation token stream into string for the parser.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler):
Construct string to parser properly.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-fmt.cc (Pieces::~Pieces): Call libformat_parser's release
function in destructor.
* ast/rust-fmt.h (struct PieceSlice): Add capacity.
(destroy_pieces): New.
(struct Pieces): Add destructor.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-fmt.cc (Pieces::collect): Use new Pieces API.
* ast/rust-fmt.h: Update interface with new FFI bindings.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-fmt.h: Add remaining FFI types.
2024-08-01 Thomas Schwinge <tschwinge@baylibre.com>
* Make-lang.in (LIBFORMAT_PARSER): Point to 'libformat_parser'
build in libgrust.
(%.toml:, $(LIBFORMAT_PARSER):): Remove.
2024-08-01 Thomas Schwinge <tschwinge@baylibre.com>
* Make-lang.in (LIBFORMAT_PARSER): Point to the GCC build
directory.
* ($(LIBFORMAT_PARSER)): Build in the GCC build directory.
2024-08-01 Thomas Schwinge <tschwinge@baylibre.com>
* Make-lang.in (LIBFORMAT_PARSER): Point to the actual build artifact.
($(LIBFORMAT_PARSER)): Don't cache it.
2024-08-01 Thomas Schwinge <tschwinge@baylibre.com>
* Make-lang.in (LIBPROC_MACRO_INTERNAL): New.
(RUST_LIBDEPS, crab1$(exeext), rust/libformat_parser.a): Use it.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Compile libformat_parser.
* ast/rust-fmt.cc: New FFI definitions.
* ast/rust-fmt.h: Likewise.
* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Call
into libformat_parser.
* expand/rust-macro-builtins.h: Define format_args!() handler proper.
2024-08-01 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Compile rust-fmt object
* ast/rust-fmt.cc: New file.
* ast/rust-fmt.h: New file.
2024-08-01 Marc Poulhiès <dkm@kataplop.net>
* rust-lang.cc (grs_langhook_type_for_mode): simplify code for
xImode. Add missing long_double_type_node.
2024-08-01 Owen Avery <powerboat9.gamer@gmail.com>
* hir/rust-ast-lower-pattern.cc
(ASTLoweringPattern::visit):
Reset is_let_top_level while visiting GroupedPattern.
2024-08-01 Thomas Schwinge <thomas@codesourcery.com>
* backend/rust-compile-base.cc (HIRCompileBase::compile_function):
For 'main', initialize 'main_identifier_node'.
2024-07-12 Daniel Bertalan <dani@danielbertalan.dev>
* metadata/rust-imports.cc (Import::try_package_in_directory):
Change NULL to nullptr.
2024-06-25 Kewen Lin <linkw@linux.ibm.com>
* rust-gcc.cc (float_type): Use TYPE_PRECISION of
{float,double,long_double}_type_node to replace
{FLOAT,DOUBLE,LONG_DOUBLE}_TYPE_SIZE.
2024-06-11 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Remove overazealous LIBS = -ldl -lpthread line, link
crab1 against CRAB1_LIBS.
2024-04-15 Thomas Schwinge <tschwinge@baylibre.com>
* Make-lang.in (RUST_LIBDEPS): Inline into single user.
2024-04-15 Thomas Schwinge <tschwinge@baylibre.com>
* Make-lang.in (LIBPROC_MACRO_INTERNAL): New.
(RUST_LIBDEPS, crab1$(exeext)): Use it.
2024-04-15 Thomas Schwinge <tschwinge@baylibre.com>
* Make-lang.in (RUST_LDFLAGS): Inline into single user.
2024-04-15 Thomas Schwinge <tschwinge@baylibre.com>
* Make-lang.in (RUST_LDFLAGS): Remove
'libgrust/libproc_macro_internal'.
2024-04-09 Christophe Lyon <christophe.lyon@linaro.org>
* Make-lang.in (rust.install-dvi, rust.install-html): New rules.
2024-03-04 Mark Wielaard <mark@klomp.org>
* lang.opt.urls: Regenerate.
2024-02-21 0xn4utilus <gyanendrabanjare8@gmail.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit):
Add variadic check on all parameters.
2024-02-21 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-pattern.cc
(CompilePatternLet::visit):
Lookup type of sub-pattern, not tuple pattern itself.
2024-02-21 Marc Poulhiès <dkm@kataplop.net>
* backend/rust-builtins.cc
(BuiltinsContext::register_rust_mappings): Add powi and reformat.
* backend/rust-builtins.h: Add missing copyright header.
2024-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-expand.h (struct MacroExpander): Nitpick: fix
formatting of emitted error.
2024-02-21 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-ast-resolve-item.cc
(flatten_glob): Use Import class.
(flatten_rebind): Likewise.
(flatten_list): Likewise.
(flatten): Likewise.
(flatten_use_dec_to_paths): Likewise.
(flatten_use_dec_to_imports): Likewise.
(ResolveItem::visit): Likewise.
(Import::add_prefix): New.
(rust_flatten_nested_glob): Adjust test.
(rust_flatten_glob): Likewise.
(rust_flatten_rebind_none): Likewise.
(rust_flatten_rebind): Likewise.
(rust_flatten_rebind_nested): Likewise.
(rust_flatten_list): Likewise.
* resolve/rust-ast-resolve-item.h
(class Import): New.
2024-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* typecheck/rust-hir-type-check-implitem.h: Fix typo in field
(region_costraints -> region_constraints).
2024-02-07 Kushal Pal <kushalpal109@gmail.com>
* parse/rust-parse-impl.h (Parser::parse_trait_item):
Handle macros in trait items similar to how its handled for trait
implementation items.
2024-02-07 Kushal Pal <kushalpal109@gmail.com>
* ast/rust-ast-collector.cc (TokenCollector::visit):
Remove obsolete classes and functions.
* ast/rust-ast-collector.h:
Likewise.
* ast/rust-ast-full-decls.h (class TraitFunctionDecl):
Likewise.
(class TraitItemFunc):
Likewise.
(class TraitMethodDecl):
Likewise.
(class TraitItemMethod):
Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit):
Likewise.
* ast/rust-ast-visitor.h:
Likewise.
* ast/rust-ast.cc (TraitItemFunc::TraitItemFunc):
Likewise.
(TraitItemFunc::operator=):
Likewise.
(TraitItemFunc::as_string):
Likewise.
(TraitFunctionDecl::as_string):
Likewise.
(TraitItemMethod::TraitItemMethod):
Likewise.
(TraitItemMethod::operator=):
Likewise.
(TraitItemMethod::as_string):
Likewise.
(TraitMethodDecl::as_string):
Likewise.
(TraitItemFunc::accept_vis):
Likewise.
(TraitItemMethod::accept_vis):
Likewise.
* ast/rust-item.h (class TraitFunctionDecl):
Likewise.
(class TraitItemFunc):
Likewise.
(class TraitMethodDecl):
Likewise.
(class TraitItemMethod):
Likewise.
* checks/errors/rust-ast-validation.cc (ASTValidation::visit):
Likewise.
* checks/errors/rust-ast-validation.h:
Likewise.
* checks/errors/rust-feature-gate.h:
Likewise.
* expand/rust-cfg-strip.cc (CfgStrip::maybe_strip_trait_function_decl):
Likewise.
(CfgStrip::maybe_strip_trait_method_decl):
Likewise.
(CfgStrip::visit):
Likewise.
* expand/rust-cfg-strip.h:
Likewise.
* expand/rust-derive.h:
Likewise.
* expand/rust-expand-visitor.cc (ExpandVisitor::expand_trait_function_decl):
Likewise.
(ExpandVisitor::expand_trait_method_decl):
Likewise.
(ExpandVisitor::visit):
Likewise.
* expand/rust-expand-visitor.h:
Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit):
Likewise.
* hir/rust-ast-lower-base.h:
Likewise.
* hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit):
Likewise.
* hir/rust-ast-lower-implitem.h:
Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit):
Likewise.
* resolve/rust-ast-resolve-base.h:
Likewise.
* resolve/rust-ast-resolve-implitem.h (visit):
Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit):
Likewise.
* resolve/rust-ast-resolve-item.h:
Likewise.
* resolve/rust-default-resolver.cc (DefaultResolver::visit):
Likewise.
* resolve/rust-default-resolver.h:
Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Likewise.
* resolve/rust-toplevel-name-resolver-2.0.h:
Likewise.
* util/rust-attributes.cc (AttributeChecker::visit):
Likewise.
* util/rust-attributes.h:
Likewise.
2024-02-07 Kushal Pal <kushalpal109@gmail.com>
* parse/rust-parse-impl.h (Parser::parse_trait_item):
Use parse_function() to parse trait functions.
2024-02-07 Kushal Pal <kushalpal109@gmail.com>
* hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit):
Provide visitor for AST::Function.
* hir/rust-ast-lower-implitem.h:
Likewise.
* resolve/rust-ast-resolve-implitem.h:
Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit):
Likewise.
* resolve/rust-ast-resolve-item.h:
Likewise.
2024-02-07 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit):
Add checks for Trait functions.
2024-02-07 Kushal Pal <kushalpal109@gmail.com>
* ast/rust-ast.h: Replace TraitItem with AssociatedItem.
* ast/rust-item.h (class Trait): Likewise.
* expand/rust-expand-visitor.cc (ExpandVisitor::visit):
Likewise.
* parse/rust-parse-impl.h (Parser::parse_trait): Likewise.
* parse/rust-parse.h: Likewise.
2024-02-07 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): use destructure
2024-02-07 Nobel Singh <nobel2073@gmail.com>
* Make-lang.in: Add rust-ast-lower-implitem.cc to list of objects.
* hir/rust-ast-lower-implitem.h (RUST_AST_LOWER_IMPLITEM_H): Remove
implementation.
* hir/rust-ast-lower-implitem.cc: Copy implementation from header.
2024-02-07 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): refactor
* typecheck/rust-hir-type-check.h: new prototype
* typecheck/rust-typecheck-context.cc (TypeCheckContext::compute_inference_variables): x
2024-02-07 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-type.cc: remove hack
2024-02-07 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): remove hack
2024-02-07 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args): fix
2024-02-07 Nobel Singh <nobel2073@gmail.com>
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_qualifiers):
Change default ABI to C for extern functions
(ASTLoweringBase::lower_extern_block): Likewise
2024-02-07 Jakub Dupak <dev@jakubdupak.com>
* typecheck/rust-tyty.cc (BaseType::BaseType): Store orig ref.
(BaseType::get_orig_ref): Add getter.
* typecheck/rust-tyty.h: Store orig ref.
2024-02-07 Jakub Dupak <dev@jakubdupak.com>
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit):
Add region constraints.
(TypeCheckImplItem::visit): Add region constraints.
* typecheck/rust-hir-type-check-implitem.h: Add region constraints.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::ResolveImplBlockSelf):
Add region constraints.
(TypeCheckItem::visit): Add region constraints.
(TypeCheckItem::resolve_impl_item): Add region constraints.
(TypeCheckItem::resolve_impl_block_substitutions): Add region constraints.
* typecheck/rust-hir-type-check-item.h: Add region constraints.
* typecheck/rust-hir-type-check-type.cc (ResolveWhereClauseItem::Resolve):
Add region constraints.
(ResolveWhereClauseItem::visit): Add region constraints.
* typecheck/rust-hir-type-check-type.h (class ResolveWhereClauseItem):
Add region constraints.
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn):
Add region constraints.
* typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::TypeBoundPredicate):
Add region constraints.
* typecheck/rust-tyty-subst.cc (SubstitutionRef::get_region_constraints):
Add region constraints.
* typecheck/rust-tyty-subst.h (class BaseType): Add region constraints.
(struct RegionConstraints): Add region constraints.
* typecheck/rust-tyty.cc (BaseType::monomorphized_clone): Add region constraints.
(ADTType::clone): Add region constraints.
(FnType::clone): Add region constraints.
(ProjectionType::clone): Add region constraints.
* typecheck/rust-tyty.h: Add region constraints.
2024-02-07 Jakub Dupak <dev@jakubdupak.com>
* typecheck/rust-hir-trait-resolve.cc: add regions
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal):
add regions, resolve generic lifetimes
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): add regions
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit):
add regions, resolve lifetimes
(TypeCheckImplItem::visit): add regions, resove lifetimes
* typecheck/rust-hir-type-check-implitem.h: add default value for result
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): add regions,
resove lifetimes
(TypeCheckItem::resolve_impl_block_substitutions): add regions, resove lifetimes
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): add regions,
resove lifetimes
(TypeCheckExpr::resolve_root_path): add regions, resove lifetimes
(TypeCheckExpr::resolve_segments): add regions, resove lifetimes
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): add regions,
resove lifetimes
(TypeCheckType::resolve_root_path): add regions, resove lifetimes
(ResolveWhereClauseItem::Resolve): add regions, resove lifetimes
(ResolveWhereClauseItem::visit): add regions, resove lifetimes
* typecheck/rust-hir-type-check.cc (TypeCheckContext::LifetimeResolver::resolve):
add regions, resolve lifetimes
(TraitItemReference::get_type_from_fn): add regions, resove lifetimes
* typecheck/rust-hir-type-check.h: add regions, resove lifetimes
* typecheck/rust-substitution-mapper.cc (SubstMapper::SubstMapper): add regions,
resove lifetimes
(SubstMapper::Resolve): add regions, resove lifetimes
(SubstMapper::InferSubst): add regions, resove lifetimes
(SubstMapper::visit): add regions, resove lifetimes
* typecheck/rust-substitution-mapper.h: add regions, resove lifetimes
* typecheck/rust-typecheck-context.cc (TypeCheckContext::TypeCheckContext):
lifetime resolution
(TypeCheckContext::regions_from_generic_args): lifetime resolution helper
* typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::TypeBoundPredicate):
add regions, resove lifetimes
(TypeBoundPredicate::operator=): add regions, resove lifetimes
(TypeBoundPredicate::apply_generic_arguments): add regions, resove lifetimes
(TypeBoundPredicateItem::get_tyty_for_receiver): add regions, resove lifetimes
* typecheck/rust-tyty-subst.cc (SubstitutionArgumentMappings::get_regions):
add regions, resove lifetimes
(SubstitutionArgumentMappings::get_mut_regions): getter
(SubstitutionArgumentMappings::error): split error and empty
(SubstitutionArgumentMappings::empty): split error and empty
(SubstitutionArgumentMappings::find_symbol): helper
(SubstitutionRef::get_num_lifetime_params): getter
(SubstitutionRef::get_num_type_params): getter
(SubstitutionRef::needs_substitution): extend to regions
(SubstitutionRef::get_mappings_from_generic_args): helper
(SubstitutionRef::infer_substitions): add regions
* typecheck/rust-tyty-subst.h (class RegionParamList): region param handler
* typecheck/rust-tyty.cc (BaseType::monomorphized_clone): add regions, resove lifetimes
(InferType::default_type): add regions, resove lifetimes
(FnType::clone): add regions, resove lifetimes
(ReferenceType::ReferenceType): add regions
(ReferenceType::get_region): getter
(ReferenceType::clone): add regions
* typecheck/rust-tyty.h: add regions, resove
2024-02-07 Jakub Dupak <dev@jakubdupak.com>
* hir/tree/rust-hir-item.h: Add missing getter
2024-02-07 Jakub Dupak <dev@jakubdupak.com>
* typecheck/rust-tyty-region.h: New file.
2024-02-07 Jakub Dupak <dev@jakubdupak.com>
* typecheck/rust-hir-type-check.h (class Lifetime): add interned lifetime class
* typecheck/rust-typecheck-context.cc (TypeCheckContext::TypeCheckContext): add
resolution tool
(TypeCheckContext::intern_lifetime): add method to intern lifetime from tyctx
(TypeCheckContext::lookup_lifetime): add method to lookup lifetime from tyctx
(TypeCheckContext::intern_and_insert_lifetime): add a helper method
2024-02-07 Raiki Tamura <tamaron1203@gmail.com>
* rust-lang.cc (run_rust_tests): Add test.
* rust-system.h: Add <algorithm>.
* util/make-rust-unicode.py: Output NFC_Quick_Check table.
* util/rust-codepoint.h (struct Codepoint): Add is_supplementary
method.
* util/rust-unicode-data.h: Generated.
* util/rust-unicode.cc (binary_search_sorted_array): Removed.
(lookup_cc): Remove namespace.
(is_alphabetic): Use std::binary_search
(nfc_quick_check): New function.
(nfc_normalize): Use nfc_quick_check.
(is_nfc_qc_maybe): New function.
(is_nfc_qc_no): New function.
(rust_nfc_qc_test): New test.
* util/rust-unicode.h (is_nfc_qc_no): New function.
(is_nfc_qc_maybe): New function.
(enum class): New enum class.
(nfc_quick_check): New function.
(rust_nfc_qc_test): New test.
2024-02-07 Kushal Pal <kushalpal109@gmail.com>
* parse/rust-parse-impl.h (Parser::parse_function):
Skip token if its a COMMA.
2024-01-30 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-full-decls.h
(class TraitImplItem): Remove forward declaration.
(class AssociatedItem): Add forward declaration.
* ast/rust-ast.h
(class TraitImplItem): Remove.
(class TraitItem): Inherit from AssociatedItem.
(SingleASTNode::take_trait_impl_item):
Return std::unique_ptr<AssociatedItem> instead of
std::unique_ptr<TraitImplItem>.
* ast/rust-item.h
(class Function): Inherit from AssociatedItem instead of
TraitImplItem.
(class TypeAlias): Likewise.
(class ConstantItem): Likewise.
(class TraitImpl): Store items as AssociatedItem.
* expand/rust-derive-clone.cc
(DeriveClone::clone_fn): Return std::unique_ptr<AssociatedItem>.
(DeriveClone::clone_impl): Take std::unique_ptr<AssociatedItem>.
* expand/rust-derive-clone.h
(DeriveClone::clone_fn): Return std::unique_ptr<AssociatedItem>.
(DeriveClone::clone_impl): Take std::unique_ptr<AssociatedItem>.
* expand/rust-expand-visitor.cc
(ExpandVisitor::visit): Handle changes to
SingleASTNode::take_trait_impl_item.
* parse/rust-parse-impl.h
(Parser::parse_impl): Parse TraitImpl as containing AssociatedItem.
(Parser::parse_trait_impl_item): Return
std::unique_ptr<AssociatedItem>.
(Parser::parse_trait_impl_function_or_method): Likewise.
* parse/rust-parse.h
(Parser::parse_trait_impl_item): Return
std::unique_ptr<AssociatedItem>.
(Parser::parse_trait_impl_function_or_method): Likewise.
2024-01-30 Robert Goss <goss.robert@gmail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit) Add additional check
* typecheck/rust-hir-type-check-struct-field.h: A helper method to make error added
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve) Update message
2024-01-30 Jakub Dupak <dev@jakubdupak.com>
* hir/rust-ast-lower-type.cc (ASTLoweringTypeBounds::visit): fix for lifetimes
(ASTLowerWhereClauseItem::visit): fix for lifetimes
2024-01-30 Jakub Dupak <dev@jakubdupak.com>
* parse/rust-parse-impl.h (Parser::parse_where_clause): fix parsing
(Parser::parse_where_clause_item): fix parsing
(Parser::parse_type_bound_where_clause_item): fix parsing
(Parser::parse_trait_bound): fix parsing
* parse/rust-parse.h: fix parsing
2024-01-30 Kushal Pal <kushalpal109@gmail.com>
* lex/rust-lex.cc (Lexer::dump_and_skip):
Changed " " to '\n'
2024-01-30 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-fragment.cc
(Fragment::assert_single_fragment): Update.
* ast/rust-ast.h
(class TraitImplItem): Move definition before that of TraitItem.
(class TraitItem):
Inherit from TraitImplItem instead of AssociatedItem.
(class SingleASTNode): Unify handling of associated items.
(SingleASTNode::take_assoc_item): Move from...
(SingleASTNode::take_impl_item): ...here, but leave stub calling
take_assoc_item behind.
(SingleASTNode::take_trait_item):
Cast associated item to TraitItem.
(SingleASTNode::take_trait_impl_item):
Cast associated item to TraitImplItem.
* ast/rust-ast.cc
(SingleASTNode::SingleASTNode):
Unify handling of associated items.
(SingleASTNode::operator=): Likewise.
(SingleASTNode::accept_vis): Likewise.
(SingleASTNode::is_error): Likewise.
(SingleASTNode::as_string): Likewise.
* ast/rust-item.h
(class Function): Remove direct inheritence from AssociatedItem.
(class ConstantItem): Likewise.
* ast/rust-macro.h
(class MacroInvocation):
Remove direct inheritence from AssociatedItem and TraitImplItem.
2024-01-30 Robert Goss <goss.robert@gmail.com>
* typecheck/rust-hir-type-check-struct-field.h: Allow visit to return a bool
* typecheck/rust-hir-type-check-struct.cc: Improve check of repeat fields
2024-01-30 Kushal Pal <kushalpal109@gmail.com>
* parse/rust-parse-impl.h (Parser::parse_inherent_impl_item):
Added switch-case for ASYNC token.
2024-01-30 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit):
Enclose const in single quotes.
2024-01-30 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit):
Added check for `async` functions inside trait.
* parse/rust-parse-impl.h (Parser::parse_trait_item):
Added switch-case for ASYNC token.
2024-01-30 Nirmal Patel <nirmal@nirmal.dev>
* lex/rust-lex.cc (Lexer::parse_byte_string): Handle newline
while parsing byte strings
(Lexer::parse_string): Handle newline while parsing strings
2024-01-30 Jakub Dupak <dev@jakubdupak.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): Use new API.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Use new API.
* typecheck/rust-tyty-cmp.h: Remove old API.
* typecheck/rust-tyty.cc (FnPtr::is_equal): Use new API.
* typecheck/rust-tyty.h: Remove old API.
* typecheck/rust-unify.cc (UnifyRules::expect_fnptr): Use new API.
2024-01-30 Jakub Dupak <dev@jakubdupak.com>
* hir/rust-ast-lower-type.cc (ASTLoweringType::visit): For lifetimes.
2024-01-30 Jakub Dupak <dev@jakubdupak.com>
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_lifetime): Propagate static
requirement.
* hir/rust-ast-lower-base.h: Propagate static requirement.
* hir/rust-ast-lower-implitem.h: Propagate static requirement.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Propagate static requirement.
* hir/rust-ast-lower-type.cc (ASTLoweringType::translate): Propagate static requirement.
(ASTLoweringType::visit): Propagate static requirement.
* hir/rust-ast-lower-type.h: Propagate static requirement.
2024-01-30 Jakub Dupak <dev@jakubdupak.com>
* parse/rust-parse-impl.h (Parser::parse_generic_param): Lifetime elision control.
(Parser::parse_lifetime_where_clause_item): Lifetime elision control.
(Parser::parse_type_param_bound): Lifetime elision control.
(Parser::parse_lifetime_bounds): Lifetime elision control.
(Parser::parse_lifetime): Lifetime elision control.
(Parser::parse_path_generic_args): Lifetime elision control.
(Parser::parse_self_param): Lifetime elision control.
(Parser::parse_break_expr): Lifetime elision control.
(Parser::parse_continue_expr): Lifetime elision control.
(Parser::parse_reference_type_inner): Lifetime elision control.
* parse/rust-parse.h: Lifetime elision control.
2024-01-30 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast.h: Elided lifetime static constructor
* ast/rust-type.h: Default lifetime to elided.
* parse/rust-parse-impl.h (Parser::parse_lifetime_param): Use elided lifetime.
(Parser::parse_lifetime): Use elided lifetime/
(Parser::lifetime_from_token): Use elided lifetime.
(Parser::parse_self_param): Use elided lifetime.
(Parser::parse_reference_type_inner): Use elided lifetime.
2024-01-30 Jakub Dupak <dev@jakubdupak.com>
* parse/rust-parse-impl.h (Parser::lifetime_from_token): Fix matched pattern.
2024-01-30 Kushal Pal <kushalpal109@gmail.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit):
Added check for `async` function inside trait.
2024-01-30 Kushal Pal <kushalpal109@gmail.com>
* parse/rust-parse-impl.h (Parser::parse_trait_impl_item):
Handled `async` items
2024-01-30 Raiki Tamura <tamaron1203@gmail.com>
* Make-lang.in: Add .o files
* backend/rust-mangle.cc (struct V0Path): moved to splitted files
(v0_path): Likewise.
(legacy_mangle_name): Likewise.
(legacy_mangle_canonical_path): Likewise.
(legacy_hash): Likewise.
(v0_tuple_prefix): Likewise.
(v0_numeric_prefix): Likewise.
(v0_simple_type_prefix): Likewise.
(v0_complex_type_prefix): Likewise.
(v0_integer_62): Likewise.
(v0_opt_integer_62): Likewise.
(v0_disambiguator): Likewise.
(v0_type_prefix): Likewise.
(v0_generic_args): Likewise.
(v0_identifier): Likewise.
(v0_type_path): Likewise.
(v0_function_path): Likewise.
(v0_scope_path): Likewise.
(v0_crate_path): Likewise.
(v0_inherent_or_trait_impl_path): Likewise.
(v0_closure): Likewise.
(legacy_mangle_item): Likewise.
(v0_mangle_item): Likewise.
* backend/rust-mangle.h (legacy_mangle_item): Likewise.
(v0_mangle_item): Likewise.
* backend/rust-mangle-legacy.cc: New file.
* backend/rust-mangle-v0.cc: New file.
2024-01-30 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-place.h: Cleanup.
* checks/errors/borrowck/rust-borrow-checker.h: Cleanup.
2024-01-30 Jakub Dupak <dev@jakubdupak.com>
* typecheck/rust-tyty.h (BaseType::is): Cast API.
(SubstitutionRef>): Cast API.
(BaseType::as): Cast API.
(BaseType::try_as): Cast API.
2024-01-30 Jakub Dupak <dev@jakubdupak.com>
* typecheck/rust-tyty.h (class ClosureType): Inherit interface.
(class FnPtr): Inherit interface.
(class FnType): Inherit interface.
(class CallableTypeInterface): New interface.
(BaseType::is): Detect interface members API.
2024-01-30 Jakub Dupak <dev@jakubdupak.com>
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Refactor.
2024-01-30 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-builder-internal.h: Replace nodiscard.
* checks/errors/borrowck/rust-bir-place.h: Replace nodiscard.
2024-01-30 Jakub Dupak <dev@jakubdupak.com>
* typecheck/rust-tyty.h: Fix nodiscard to warn unused.
2024-01-30 Jakub Dupak <dev@jakubdupak.com>
* hir/tree/rust-hir-item.h: Ad lifetime getter.
* hir/tree/rust-hir-path.h: Make getter const ref.
* hir/tree/rust-hir.h: Const ref and new getter.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in (GRS_OBJS): Add rust-attribs.o.
* backend/rust-builtins.cc (builtin_const, builtin_noreturn)
(builtin_novops): Remove.
(BuiltinsContext::lookup_simple_builtin): Adjust.
(BuiltinsContext::setup_overflow_fns): Remove.
(BuiltinsContext::define_function_type): Set builtin type to
errormark so the builtin is considered unavailable.
(BuiltinsContext::setup_math_fns): Remove.
(BuiltinsContext::setup_atomic_fns): Remove.
(build_c_type_nodes): Refactor based on D frontend.
(BuiltinsContext::define_builtin_types): Likewise.
(DEF_PRIMITIVE_TYPE): New.
(DEF_FUNCTION_TYPE_0): New.
(DEF_FUNCTION_TYPE_1): New.
(DEF_FUNCTION_TYPE_2): New.
(DEF_FUNCTION_TYPE_3): New.
(DEF_FUNCTION_TYPE_4): New.
(DEF_FUNCTION_TYPE_5): New.
(DEF_FUNCTION_TYPE_6): New.
(DEF_FUNCTION_TYPE_7): New.
(DEF_FUNCTION_TYPE_8): New.
(DEF_FUNCTION_TYPE_9): New.
(DEF_FUNCTION_TYPE_10): New.
(DEF_FUNCTION_TYPE_11): New.
(DEF_FUNCTION_TYPE_VAR_0): New.
(DEF_FUNCTION_TYPE_VAR_1): New.
(DEF_FUNCTION_TYPE_VAR_2): New.
(DEF_FUNCTION_TYPE_VAR_3): New.
(DEF_FUNCTION_TYPE_VAR_4): New.
(DEF_FUNCTION_TYPE_VAR_5): New.
(DEF_FUNCTION_TYPE_VAR_6): New.
(DEF_FUNCTION_TYPE_VAR_7): New.
(DEF_FUNCTION_TYPE_VAR_11): New.
(DEF_POINTER_TYPE): New.
(BuiltinsContext::setup): Adjust.
(BuiltinsContext::define_builtin_attributes): New.
(DEF_ATTR_NULL_TREE): New.
(DEF_ATTR_INT): New.
(DEF_ATTR_STRING): New.
(DEF_ATTR_IDENT): New.
(DEF_ATTR_TREE_LIST): New.
(handle_flags): Remove.
(BuiltinsContext::define_builtins): New.
(DEF_BUILTIN): New.
(BuiltinsContext::define_builtin): Remove.
(BuiltinsContext::register_rust_mappings): New. Add all missing
builtins.
(BuiltinsContext::lookup_gcc_builtin): Adjust.
* backend/rust-builtins.h (DEF_PRIMITIVE_TYPE): New.
(DEF_FUNCTION_TYPE_0): New.
(DEF_FUNCTION_TYPE_1): New.
(DEF_FUNCTION_TYPE_2): New.
(DEF_FUNCTION_TYPE_3): New.
(DEF_FUNCTION_TYPE_4): New.
(DEF_FUNCTION_TYPE_5): New.
(DEF_FUNCTION_TYPE_6): New.
(DEF_FUNCTION_TYPE_7): New.
(DEF_FUNCTION_TYPE_8): New.
(DEF_FUNCTION_TYPE_9): New.
(DEF_FUNCTION_TYPE_10): New.
(DEF_FUNCTION_TYPE_11): New.
(DEF_FUNCTION_TYPE_VAR_0): New.
(DEF_FUNCTION_TYPE_VAR_1): New.
(DEF_FUNCTION_TYPE_VAR_2): New.
(DEF_FUNCTION_TYPE_VAR_3): New.
(DEF_FUNCTION_TYPE_VAR_4): New.
(DEF_FUNCTION_TYPE_VAR_5): New.
(DEF_FUNCTION_TYPE_VAR_6): New.
(DEF_FUNCTION_TYPE_VAR_7): New.
(DEF_FUNCTION_TYPE_VAR_11): New.
(DEF_POINTER_TYPE): New.
(DEF_ATTR_NULL_TREE): New.
(DEF_ATTR_INT): New.
(DEF_ATTR_STRING): New.
(DEF_ATTR_IDENT): New.
(DEF_ATTR_TREE_LIST): New.
* backend/rust-compile-intrinsic.cc (Intrinsics::compile): Add
comment.
(op_with_overflow_inner): Adjust.
(copy_handler_inner): Adjust.
(prefetch_data_handler): Adjust.
(build_atomic_builtin_name): Adjust.
(atomic_load_handler_inner): Adjust.
(uninit_handler): Adjust.
(move_val_init_handler): Adjust.
(expect_handler_inner): Adjust.
* rust-gcc.cc (fetch_overflow_builtins): Adjust.
* rust-lang.cc (rust_localize_identifier): Adjust.
(LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): New.
* rust-attribs.cc: New file.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-cfg-strip.cc (CfgStrip::visit): Change calls from visitor
to default visitor.
(CfgStrip::go): Add call to visit crate.
* expand/rust-cfg-strip.h (class CfgStrip): Update prototypes and
remove empty ones.
* ast/rust-ast-visitor.cc: add WhereClause condition check.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-expand-visitor.cc (ExpandVisitor::go): Add call to visit
on the crate.
(ExpandVisitor::visit): Remove some visit functions in favor of their
default visitor counterpart.
* expand/rust-expand-visitor.h (class ExpandVisitor): Inherit from
default visitor and remove now useless function prototypes.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove
duplicated functions.
* resolve/rust-default-resolver.h (class DefaultResolver): Make the
default resolver inherit from the default visitor.
2024-01-30 Owen Avery <powerboat9.gamer@gmail.com>
* checks/errors/rust-feature.cc
(Feature::name_hash_map):
Add entries for Name::LANG_ITEMS and Name::NO_CORE.
* checks/errors/rust-feature.h
(Feature::Name::LANG_ITEMS): New.
(Feature::Name::NO_CORE): New.
2024-01-30 Kushal Pal <kushalpal109@gmail.com>
* backend/rust-compile-base.cc (HIRCompileBase::setup_abi_options):
Renamed `WIN64` to `WIN_64`
* util/rust-abi.cc (get_abi_from_string): Likewise
(get_string_from_abi): Likewise
* util/rust-abi.h (enum ABI): Likewise
2024-01-30 Nobel Singh <nobel2073@gmail.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add
check for const funtion.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add
a validation check and emit an error depending on the context.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Adapt defintion
getter.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* expand/rust-cfg-strip.cc (CfgStrip::visit): Likewise.
* expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise.
* hir/rust-ast-lower-implitem.h: Likewise.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Likewise.
* util/rust-attributes.cc (AttributeChecker::visit): Likewise.
* parse/rust-parse-impl.h: Allow empty function body during parsing.
* ast/rust-ast.cc (Function::Function): Constructor now take an
optional for the body.
(Function::operator=): Adapt to new optional member.
(Function::as_string): Likewise.
* ast/rust-item.h (class Function): Make body optional and do not
rely on nullptr anymore.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::resolve_generic_args):
Move function.
(EarlyNameResolver::resolve_qualified_path_type): Likewise.
(EarlyNameResolver::visit): Add a top level visit function for crate
and remove duplicated code.
* resolve/rust-early-name-resolver.h (class EarlyNameResolver): Update
overriden function list.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-attributes.cc (AttributeChecker::visit): Add visit function
for crates.
* util/rust-attributes.h (class AttributeChecker): Update function
prototypes.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-feature-gate.cc (FeatureGate::visit): Add a visit
function for the crate level.
(FeatureGate::check): Add call to crate visit.
* checks/errors/rust-feature-gate.h (class FeatureGate): Remove now
useless visit functions (traversal only).
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add
const check.
* checks/errors/rust-ast-validation.h: Add visit function prototype.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add
async const check.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_vis_item): Allow parsing async
items in const.
(Parser::parse_async_item): Account for const offset during async
lookahead.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-builder.cc (AstBuilder::fn_qualifiers): Change
constructor to match the new arguments.
* ast/rust-ast-collector.cc (TokenCollector::visit): Change behavior
to handle both const and async specifiers at the same time.
* ast/rust-ast.cc (FunctionQualifiers::as_string): Likewise.
* ast/rust-item.h (class FunctionQualifiers): Remove AsyncConstStatus
and replace it with both Async and Const status. Also change the safety
arguments to use an enum instead of a boolean.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_qualifiers):
Update constructor call.
* hir/tree/rust-hir-item.h: Add Const and Async status, remove
AsyncConstStatus, update the constructor.
* hir/tree/rust-hir.cc (FunctionQualifiers::as_string): Update with
the new status.
* parse/rust-parse-impl.h (Parser::parse_function_qualifiers): Update
constructor call.
* util/rust-common.h (enum Mutability): Make an enum class.
(enum class): Add Async and Const enum class to avoid booleans.
(enum Unsafety): Change to an enum class.
2024-01-30 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-full-decls.h
(class InherentImplItem): Remove.
* ast/rust-ast.h
(class InherentImplItem): Remove.
(class SingleASTNode):
Store pointer to AssociatedItem instead of InherentImplItem.
* ast/rust-ast.cc
(SingleASTNode::SingleASTNode):
Use clone_associated_item instead of clone_inherent_impl_item.
(SingleASTNode::operator=): Likewise.
* ast/rust-item.h
(class InherentImpl):
Use AssociatedItem rather than InherentImplItem.
(class Function): Likewise.
(class ConstantItem): Likewise.
* ast/rust-macro.h
(class MacroInvocation): Likewise.
* expand/rust-expand-visitor.cc
(ExpandVisitor::visit): Likewise.
* parse/rust-parse-impl.h
(Parser::parse_impl): Likewise.
(Parser::parse_inherent_impl_item): Likewise.
(Parser::parse_inherent_impl_function_or_method): Likewise.
* parse/rust-parse.h
(Parser::parse_inherent_impl_item): Likewise.
(Parser::parse_inherent_impl_function_or_method): Likewise.
2024-01-30 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.cc (HIRCompileBase::compile_locals_for_block): removed
* backend/rust-compile-base.h: update header
* backend/rust-compile-block.cc (CompileBlock::visit): remove old logic
* backend/rust-compile-expr.cc (CompileExpr::generate_closure_function): likewise
* backend/rust-compile-stmt.cc (CompileStmt::visit): likewise
* backend/rust-compile-var-decl.h: ensure we setup tuple bindings correctly
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-item.h: Add safety getter to modules.
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Check
a module's safety and emit an error when meeting an unsafe module.
* checks/errors/rust-ast-validation.h: Add function prototype.
* parse/rust-parse-impl.h (Parser::parse_module): Move the module locus
to the first token instead of the mod keyword.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_vis_item): Dispatch to parse
module when meeting an unsafe module.
(Parser::parse_module): Set unsafe status when the parser encounter an
unsafe keyword.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-item.h: Add safety status to Modules in the AST.
* parse/rust-parse-impl.h (Parser::parse_module): Adapt constructors.
2024-01-30 Owen Avery <powerboat9.gamer@gmail.com>
* hir/tree/rust-hir-pattern.h
(class TupleItems): New.
(class TupleStructItems): Inherit from TupleItems.
(class TuplePatternItems): Likewise.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::insert_or_error_out): New functions.
(TopLevel::handle_use_dec): New function.
(flatten_rebind): Likewise.
(flatten_list): Likewise.
(flatten_glob): Likewise.
(flatten): Likewise.
(TopLevel::visit): Visit various `use` declaration nodes.
* resolve/rust-toplevel-name-resolver-2.0.h: Declare functions and
visitors.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc
(Early::visit): Remove visitors.
* resolve/rust-early-name-resolver-2.0.h: Likewise.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-item.h (class UseTree): Add `node_id` member.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::insert_or_error_out): Add documentation comment.
(TopLevel::go): Likewise.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc
(Early::insert_once): New function.
(Early::visit): Likewise.
* resolve/rust-early-name-resolver-2.0.h: Likewise.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Store mappings
after having resolved them.
* resolve/rust-late-name-resolver-2.0.h: Add `TypePath` visitor.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-late-name-resolver-2.0.cc
(Late::setup_builtin_types): New function.
(Late::go): Setup builtin types.
* resolve/rust-late-name-resolver-2.0.h:
* resolve/rust-name-resolution-context.cc
(NameResolutionContext::map_usage): New function.
* resolve/rust-name-resolution-context.h: Likewise.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-name-resolution-context.h: Store a reference to the
mappings.
* resolve/rust-name-resolution-context.cc
(NameResolutionContext::NameResolutionContext): Likewise.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Use
the DefaultResolver in the toplevel visitor.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Compile late name resolver.
* resolve/rust-late-name-resolver-2.0.cc: New file.
* resolve/rust-late-name-resolver-2.0.h: New file.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-name-resolution-context.h: Add a Labels stack.
2024-01-30 M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
* parse/rust-parse-impl.h (Parser::parse_item): Likewise.
(Parser::parse_vis_item): Likewise.
(Parser::parse_async_item): Likewise.
* parse/rust-parse.h: Made declaration for parse_async_item.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-lex.cc (Lexer::classify_keyword): Update keyword map name.
* lex/rust-token.h (enum PrimitiveCoreType): Remove some deprecated
comments.
* util/rust-keyword-values.cc (get_keywords): Update the keyword map
name.
(RS_TOKEN): Define as empty
(RS_TOKEN_KEYWORD_2015): Add the emission value.
(RS_TOKEN_KEYWORD_2018): Likewise.
* util/rust-keyword-values.h (RS_KEYWORD_LIST): Introduce the keyword
list.
(RS_TOKEN_KEYWORD_2018): Define multiple new keywords.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Replace raw value.
* parse/rust-parse-impl.h (Parser::is_macro_rules_def): Likewise.
(Parser::parse_item): Likewise.
(Parser::parse_vis_item): Likewise.
(Parser::parse_macro_rules_def): Likewise.
(Parser::parse_union): Likewise.
(Parser::parse_trait_impl_item): Likewise.
(Parser::parse_stmt): Likewise.
(Parser::parse_stmt_or_expr): Likewise.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-keyword-values.h (class WeakKeywords): Add new class with
weak keyword constexpr.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Replace raw value
with keyword call.
* ast/rust-ast.h: Likewise.
* parse/rust-parse-impl.h (Parser::parse_path_ident_segment): Likewise.
(Parser::parse_macro_match_fragment): Likewise.
(Parser::parse_extern_crate): Likewise.
(Parser::parse_use_tree): Likewise.
(Parser::parse_const_item): Likewise.
(Parser::parse_literal_expr): Likewise.
(Parser::parse_maybe_named_param): Likewise.
(Parser::parse_pattern_no_alt): Likewise.
(Parser::left_denotation): Likewise.
(Parser::parse_path_in_expression_pratt): Likewise.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-token.h (enum PrimitiveCoreType): Add await keyword
definition.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-token.h (enum PrimitiveCoreType): Change macro for
underscore in token list.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-token.h (enum PrimitiveCoreType): Change enum macro calls.
(RS_TOKEN_KEYWORD): Remove generic token keyword macro.
(RS_TOKEN_KEYWORD_2015): Introduce keywords for edition 2015.
(RS_TOKEN_KEYWORD_2018): Likewise with edition 2018.
* lex/rust-token.cc (RS_TOKEN_KEYWORD): Remove old macro definition.
(RS_TOKEN_KEYWORD_2015): Replace with 2015 definition...
(RS_TOKEN_KEYWORD_2018): ... and 2018 definition.
* util/rust-keyword-values.cc (RS_TOKEN_KEYWORD): Likewise.
(RS_TOKEN_KEYWORD_2015): Likewise.
(RS_TOKEN_KEYWORD_2018): Likewise.
* util/rust-keyword-values.h (RS_TOKEN_KEYWORD): Likewise.
(RS_TOKEN_KEYWORD_2015): Likewise.
(RS_TOKEN_KEYWORD_2018): Likewise.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-token.h (enum PrimitiveCoreType): Change keyword suffix from
tok to kw.
* ast/rust-ast-collector.cc (TokenCollector::visit): Update suffix to
match the new declaration.
* lex/rust-lex.cc (Lexer::parse_raw_identifier): Likewise.
* parse/rust-parse-impl.h (can_tok_start_type): Likewise.
(Parser::parse_item): Likewise.
(Parser::parse_vis_item): Likewise.
(Parser::parse_extern_crate): Likewise.
(Parser::parse_function): Likewise.
(Parser::parse_function_qualifiers): Likewise.
(Parser::parse_struct): Likewise.
(Parser::parse_enum): Likewise.
(Parser::parse_static_item): Likewise.
(Parser::parse_trait_item): Likewise.
(Parser::parse_inherent_impl_item): Likewise.
(Parser::parse_trait_impl_item): Likewise.
(Parser::parse_extern_block): Likewise.
(Parser::parse_external_item): Likewise.
(Parser::parse_stmt): Likewise.
(Parser::parse_return_expr): Likewise.
(Parser::parse_match_expr): Likewise.
(Parser::parse_type): Likewise.
(Parser::parse_for_prefixed_type): Likewise.
(Parser::parse_type_no_bounds): Likewise.
(Parser::parse_stmt_or_expr): Likewise.
* parse/rust-parse.cc (peculiar_fragment_match_compatible): Likewie.
* util/rust-token-converter.cc (convert): Likewise.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add
zero field check during ast validation pass.
* checks/errors/rust-ast-validation.h: Add union visit function
prototype.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add
ast validation pass to reject variadic arguments on regular functions.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add auto
trait associated item check in AST validation pass.
* parse/rust-parse-impl.h: Remove old error emission done during
parsing pass.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Reject
auto traits with super traits.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add
check for generics on auto traits.
* checks/errors/rust-ast-validation.h: Add visit function prototype.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-forever-stack.hxx: Remove debug log.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Format.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-forever-stack.h: New method.
* resolve/rust-forever-stack.hxx: Likewise.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-forever-stack.h: New method.
* resolve/rust-forever-stack.hxx: Likewise.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-forever-stack.hxx: Do not copy segment when
dereferencing iterator in `find_starting_point`.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-forever-stack.h: Fix `ForeverStack::resolve_path`
signature.
* resolve/rust-forever-stack.hxx: Likewise.
* resolve/rust-early-name-resolver-2.0.cc (Early::visit): Use new API.
(Early::visit_attributes): Likewise.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-forever-stack.hxx: Add specific behavior for
`ForeverStack::get` when dealing with labels.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-forever-stack.h: Improve resolve_path API.
* resolve/rust-forever-stack.hxx: Likewise and fix implementation.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-rib.h: Add Namespace enum.
2024-01-30 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.h: Change Path API to be more consistent.
* ast/rust-path.h: Likewise.
* ast/rust-ast-collector.cc (TokenCollector::visit): Use new API.
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise.
* resolve/rust-forever-stack.hxx: Likewise.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_function): Early return on
unrecoverable errors.
(Parser::parse_trait_item): Likewise.
(Parser::parse_self_param): Update return type.
* parse/rust-parse.h (enum ParseSelfError): Add enumeration to describe
different self parameter parsing errors.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_self_param): Fix the loop
exit condition.
2024-01-30 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-item.h (struct Visibility): Move Visibility from here...
* ast/rust-ast.h (struct Visibility): ...to here.
* parse/rust-parse-impl.h (Parser::parse_trait_item): Parse visibility
before giving it back to the item parsing function.
(Parser::parse_trait_type): Add visibility modifier.
* parse/rust-parse.h (RUST_PARSE_H): Change function prototype.
2024-01-18 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address):
Cast size_t value to unsigned long.
* expand/rust-proc-macro.cc (load_macros): Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* hir/tree/rust-hir-pattern.h
(TupleStructItems::ItemType::RANGE): Rename to...
(TupleStructItems::ItemType::RANGED): ...here.
(TupleStructItems::ItemType::NO_RANGE): Rename to...
(TupleStructItems::ItemType::MULTIPLE): ...here.
(TuplePatternItems::TuplePatternItemType): Rename to...
(TuplePatternItems::ItemType): ...here.
: Handle renames.
* backend/rust-compile-pattern.cc: Likewise.
* typecheck/rust-hir-type-check-pattern.cc: Likewise.
* checks/errors/borrowck/rust-bir-builder-pattern.h: Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-lex.cc (Lexer::parse_decimal_int_or_float): Remove
additional zero after empty floating point.
* parse/rust-parse-impl.h (Parser::left_denotation): Handle float with
empty floating point.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* backend/rust-compile-expr.cc (CompileExpr::generate_closure_function):
Fix reference to node.
* backend/rust-mangle.cc (struct V0Path): Modified to accept closures.
(v0_crate_path): Modified to accept closures.
(v0_closure): New function to mangle closures.
(v0_path): Modified to accept closures
* util/rust-mapping-common.h (UNKNOWN_NODEID): Change to UINT32_MAX.
(UNKNOWN_HIRID): Change to UINT32_MAX.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Move from here...
* ast/rust-ast-visitor.h: ... to here.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Move to header
file.
(TokenCollector::visit_items_joined_by_separator): Likewise.
(TokenCollector::visit_as_line): Likewise.
(TokenCollector::visit_items_as_lines): Likewise.
(TokenCollector::visit_items_as_block): Likewise.
* ast/rust-ast-collector.h: Add implementation.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Add visitor for
VariadicParam and remove Self parameter visitor from Function visit.
* expand/rust-cfg-strip.cc (CfgStrip::maybe_strip_self_param): Remove
function.
(CfgStrip::maybe_strip_trait_method_decl): Remove self parameter visit.
(CfgStrip::maybe_strip_function_params): Handle new function
parameters.
(CfgStrip::visit): Handle VariadicParam, SelfParam and FunctionParam.
* expand/rust-expand-visitor.cc (ExpandVisitor::expand_self_param):
Remove function.
(ExpandVisitor::expand_trait_method_decl): Do not visit self parameter.
(ExpandVisitor::visit): Add visit for VariadicParam, FunctionParam and
SelfParam.
(ExpandVisitor::expand_function_params): Visit parameters instead.
* expand/rust-expand-visitor.h: Update function prototypes.
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Update visit
with new parameters.
(ResolveTraitItems::visit): Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
Update visit functions with the new visitor functions for VariadicParam
SelfParam and FunctionParam.
* resolve/rust-early-name-resolver.h: Update function prototypes.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Update visitor
according to the new function parameter structures.
* ast/rust-ast-visitor.h: Update prototypes and add visitor virtual
functions for SelfParam, FunctionParam and VariadicParam.
* ast/rust-ast.cc (Function::Function): Move constructor in
implementation instead of header.
(Function::operator=): Likewise.
(Function::as_string): Update function with pointer dereference.
(VariadicParam::as_string): Likewise.
(TraitFunctionDecl::as_string): Likewise.
(TraitMethodDecl::as_string): Likewise.
(FunctionParam::accept_vis): Add function for visitor.
(SelfParam::accept_vis): Likewise.
(VariadicParam::accept_vis): Likewise.
(TraitItemFunc::TraitItemFunc): Move constructor to implementation
file.
(TraitItemFunc::operator=): Likewise.
(TraitItemMethod::TraitItemMethod): Likewise.
(TraitItemMethod::operator=): Likewise.
* ast/rust-item.h (class Function): Remove self optional member.
(class TraitMethodDecl): Likewise.
(class TraitFunctionDecl): Likewise.
(class Param): Add abstract parameter class.
(class SelfParam): Inherit from Param and remove parameter common
members.
(class FunctionParam): Likewise.
(class VariadicParam): Likewise.
(struct Visibility): Move structure declaration.
(class VisItem): Likewise.
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add
a self parameter check during AST validation.
* checks/errors/rust-ast-validation.h: Add function prototype.
* expand/rust-derive-clone.cc (DeriveClone::clone_fn): Update function
constructor.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_self): Rework
function for the new parameters.
(ASTLoweringBase::visit): Add visit functions for VariadicParam,
FunctionParam and SelfParam.
* hir/rust-ast-lower-base.h: Update function prototypes.
* parse/rust-parse-impl.h (Parser::parse_function): Update function
according to new function representation.
(Parser::parse_function_param): Return vector of abstract param instead
of FunctionParam.
(Parser::parse_method): Update according to new representation.
(Parser::parse_trait_item): Likewise.
(Parser::parse_self_param): Error out with
self pointers and prevent the lexer from eating regular function
parameters. Update return type.
* parse/rust-parse.h: Update function return types.
* ast/rust-ast-collector.h: Add VariadicParam visit prototype.
* ast/rust-ast.h (struct Visibility): Move struct declaration.
(class VisItem): Likewise.
* ast/rust-expr.h: Update included files.
* checks/errors/rust-feature-gate.h: Add visitor functions for
SelfParam, FunctionParam and VariadicParam.
* expand/rust-cfg-strip.h: Update function prototypes.
* expand/rust-derive.h: Likewise.
* hir/rust-ast-lower-implitem.h: Handle special arguments.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Likewise.
* metadata/rust-export-metadata.cc (ExportContext::emit_function):
Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Add visitor
functions.
* resolve/rust-ast-resolve-base.h: Update prototypes.
* resolve/rust-ast-resolve-stmt.h: Handle new parameter kind.
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Likewise.
* resolve/rust-default-resolver.h: Update prototype.
* util/rust-attributes.cc (AttributeChecker::visit): Add visitor
functions for SelfParam and VariadicParam.
* util/rust-attributes.h: Add visit prototypes.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add
check for additional named argument as well as variadic argument's
position.
* checks/errors/rust-ast-validation.h: Add visit function prototype for
external functions.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-visitor.cc (ContextualASTVisitor::visit): Push the new
trait context when visiting a trait.
* ast/rust-ast-visitor.h: Add visit function prototype and TRAIT
context.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Change
reported error location to the lifetime location.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Check if there is
a label before visit.
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Emit an
error when a label has a forbidden name.
* checks/errors/rust-ast-validation.h: Add function prototype.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-expr.h (class BreakExpr): Change Lifetime to LoopLabel.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Lower lifetime
inside the label instead.
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Resolve the
inner lifetime.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-lex.cc (Lexer::parse_raw_identifier): Use const value.
* parse/rust-parse-impl.h (Parser::parse_simple_path_segment):
Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-lex.cc (RS_TOKEN): Remove local map.
(RS_TOKEN_KEYWORD): Likewise.
(Lexer::classify_keyword): Change call to utils.
* util/rust-keyword-values.cc (get_keywords): Add init function.
(RS_TOKEN_KEYWORD): Call to X macro.
* util/rust-keyword-values.h: Change from set to a map.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-ast-validation.cc (RS_TOKEN): Remove locale set.
(RS_TOKEN_KEYWORD): Likewise.
(ASTValidation::visit): Change keyword set call to the one from utils.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* Make-lang.in: Add rust-keyword-values.cc to the list.
* util/rust-keyword-values.cc: New file.
* util/rust-keyword-values.h: New file.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-attribute-values.h (RUST_ATTRIBUTES_VALUE_H): Remove old
header guard.
(RUST_ATTRIBUTE_VALUES_H): Add new one.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-ast-validation.cc (RS_TOKEN): Add keyword set.
(RS_TOKEN_KEYWORD): Likewise.
(ASTValidation::visit): Add validation on lifetime visit.
* checks/errors/rust-ast-validation.h: Add function prototype.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-item.h
(class Method): Remove.
(Function::self_param): New.
(Function::has_self_param): New.
(Function::Function): Initialize self_param.
(Function::operator=): Likewise.
(Function::get_self_param): New.
* ast/rust-ast.cc
(Method::as_string): Remove.
(Method::accept_vis): Remove.
* ast/rust-ast-collector.cc
(TokenCollector::visit):
Remove AST::Method visitor, handle self_param in AST::Function visitor.
* ast/rust-ast-collector.h
(TokenCollector::visit): Remove AST::Method visitor.
* ast/rust-ast-full-decls.h (class Method): Remove.
* ast/rust-ast-visitor.h
(ASTVisitor::visit): Remove AST::Method visitor.
(DefaultASTVisitor::visit): Likewise.
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit):
Remove AST::Method visitor, handle self_param in AST::Function visitor.
* checks/errors/rust-feature-gate.cc
(FeatureGate::visit): Remove AST::Method visitor.
* checks/errors/rust-feature-gate.h
(FeatureGate::visit): Likewise..
* expand/rust-cfg-strip.cc
(CfgStrip::visit):
Remove AST::Method visitor, handle self_param in AST::Function visitor.
* expand/rust-cfg-strip.h
(CfgStrip::visit): Remove AST::Method visitor.
* expand/rust-derive-clone.cc
(DeriveClone::clone_fn): Return AST::Function instead of AST::Method.
* expand/rust-derive.h (DeriveVisitor::visit): Remove AST::Method visitor.
* expand/rust-expand-visitor.cc
(ExpandVisitor::visit):
Remove AST::Method visitor, handle self_param in AST::Function visitor.
* expand/rust-expand-visitor.h:
(ExpandVisitor::visit): Remove AST::Method visitor.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h (ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-implitem.h
(ASTLowerImplItem::visit):
Remove AST::Method visitor, handle self_param in AST::Function visitor.
* parse/rust-parse-impl.h: Include optional.h.
(Parser::parse_function): Adjust AST::Function construction.
(Parser::parse_inherent_impl_function_or_method):
Construct AST::Function instead of AST::Method,
adjust AST::Function construction.
(Parser::parse_trait_impl_function_or_method): Likewise.
(Parser::parse_method):
Return std::unique_ptr<AST::Function> instead of AST::Method.
* parse/rust-parse.h
(Parser::parse_method): Likewise.
* resolve/rust-ast-resolve-base.cc
(ResolverBase::visit): Remove AST::Method visitor.
* resolve/rust-ast-resolve-base.h
(ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-implitem.h
(ResolveToplevelImplItem::visit): Likewise.
* resolve/rust-ast-resolve-item.cc
(ResolveItem::visit): Remove AST::Method visitor,
handle self_param in AST::Function visitor.
* resolve/rust-ast-resolve-item.h
(ResolveItem::visit): Remove AST::Method visitor.
* resolve/rust-default-resolver.cc
(DefaultResolver::visit): Remove AST::Method visitor.
* resolve/rust-default-resolver.h
(DefaultResolver::visit): Likewise.
* resolve/rust-early-name-resolver.cc
(EarlyNameResolver::visit): Remove AST::Method visitor,
handle self_param in AST::Function visitor.
* resolve/rust-early-name-resolver.h
(EarlyNameResolver::visit): Remove AST::Method visitor.
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.h
(TopLevel::visit): Likewise.
* util/rust-attributes.cc
(AttributeChecker::visit): Likewise.
* util/rust-attributes.h
(AttributeChecker::visit): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_named_function_param): Add
new parsing ability.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.cc (ExternalFunctionItem::as_string): Adapt as_string
function to the new ast representation.
(NamedFunctionParam::as_string): Likewise.
* ast/rust-item.h: Add a function to test whether a FunctionParam has
a name pattern.
* expand/rust-cfg-strip.cc (CfgStrip::visit): Adapt cfg strip visitor
for the new variadic arguments.
* hir/rust-ast-lower-extern.h: Adapt lowering to the new variadic
function representation.
* metadata/rust-export-metadata.cc (ExportContext::emit_function):
Change call to constructor.
* parse/rust-parse-impl.h (Parser::parse_named_function_param): Change
NamedFunctionParam parsing to accomodate new variadic representation.
(Parser::parse_external_item): Change external item parsing to use the
new NamedFunctionParam variadics.
* parse/rust-parse.h: Add new parsing function prototypes.
* ast/rust-ast-collector.cc (TokenCollector::visit): Rework token
collection to take into account variadic parameters.
* ast/rust-ast-visitor.cc: Likewise.
* expand/rust-expand-visitor.cc (ExpandVisitor::visit): Change function
bound to avoid getting the type of a variadic parameter.
* resolve/rust-ast-resolve-item.cc (ResolveExternItem::visit):
Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-item.h (class NamedFunctionParam): Add variadic boolean and
another constructor.
* hir/rust-ast-lower-extern.h: Avoid last parameter when variadic.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-item.h: Add a getter to check if a given function is
variadic.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_function_param): Parse
variadic functions.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-item.h (class FunctionParam): Add some informations to
function parameters in order to be able to store variadic argument as
a function parameter.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Adapt
the call to the new visit functions.
(ASTValidation::check): Launch the parent class visitor root function.
* checks/errors/rust-ast-validation.h (class ASTValidation): Inherit
from the contextual visitor.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-visitor.cc (ContextualASTVisitor::visit): Add multiple
context saving calls.
* ast/rust-ast-visitor.h (class DefaultASTVisitor): Make visit
functions virtual.
(class ContextualASTVisitor): Add a stack like container for the
current context chain.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* Make-lang.in: Add the new visitor object file.
* ast/rust-ast-visitor.h (class DefaultASTVisitor): Create the default
visitor class.
* ast/rust-ast.h: Add a new reference getter for visitor pattern.
* ast/rust-ast-visitor.cc: New file.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h: Add some missing mutable reference getters.
* ast/rust-expr.h: Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-path.h: Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Check for presence
of a type and use the default value instead of the type.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/rust-ast-validation.cc (ASTValidation::check): Launch
check over the whole given crate.
(ASTValidation::visit): Implement visitor for some members of the ast.
* checks/errors/rust-ast-validation.h: Update some prototype according
to implemented visitor functions. Also add a context tracker.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* rust-session-manager.cc (Session::compile_crate): Add call to ast
validation.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lang.opt: Add the new compile options and update the enum values.
* rust-session-manager.h (struct CompileOptions): Add the new steps to
the enumeration.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* Make-lang.in: Add the new object file the list.
* checks/errors/rust-ast-validation.cc: New file.
* checks/errors/rust-ast-validation.h: New file.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-cfg-strip.cc (CfgStrip::visit): Add expr value check.
* expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h: Move implementation from here...
* ast/rust-ast.cc (SingleASTNode::SingleASTNode): ...to here.
(SingleASTNode::operator=): ...and here...
(SingleASTNode::accept_vis): ...and here...
(SingleASTNode::is_error): ...and here...
(SingleASTNode::as_string): ...also here.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h: Add override specifier.
* ast/rust-item.h: Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-macro-invoc-lexer.cc (MacroInvocLexer::split_current_token):
Add implementation for multiple token split.
* expand/rust-macro-invoc-lexer.h: Add function prototype.
* expand/rust-proc-macro-invoc-lexer.cc (ProcMacroInvocLexer::split_current_token):
Add implementation for 2+ token split for procedural macros.
* expand/rust-proc-macro-invoc-lexer.h: Add function prototype.
* lex/rust-lex.cc (Lexer::split_current_token): Add function to split a
token in multiple other tokens.
* lex/rust-lex.h: Add function prototype for split_current_token.
* parse/rust-parse-impl.h (Parser::left_denotation): Handle float tuple
index identified as a float literal.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* hir/rust-hir-dump.cc (Dump::visit): Remove obsolete member.
* hir/tree/rust-hir-expr.h (class BorrowExpr): Remove obsolete member.
* hir/tree/rust-hir.cc (BorrowExpr::as_string): Remove obsolete member.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Fix typo.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-expr.cc
(patterns_mergeable): Remove.
(struct PatternMerge): Remove.
(sort_tuple_patterns): Remove.
(simplify_tuple_match): Remove.
(CompileExpr::visit): Modify compilation of MatchExpr.
* backend/rust-compile-pattern.cc
(CompilePatternCaseLabelExpr::visit): Replace with...
(CompilePatternCheckExpr::visit): ...this.
* backend/rust-compile-pattern.h
(class CompilePatternCaseLabelExpr): Replace with...
(class CompilePatternCheckExpr): ...this.
* backend/rust-compile-type.cc
(TyTyResolveCompile::get_implicit_enumeral_node_type):
Make enumeral type equivalent to isize.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-base.cc (get_attributes): Add documentation for
indices 3 and 4.
(get_trait_name): Add documentation for index 1.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* Make-lang.in: Add gcc/rust/backend/rust-compile-proc-macro.cc to the
list of file to compile.
* backend/rust-compile.cc (attribute_array): Move to
rust-compile-proc-macro.cc
(derive_proc_macro): Likewise.
(bang_proc_macro): Likewise.
(attribute_proc_macro): Likewise.
(proc_macro_payload): Likewise.
(proc_macro): Likewise.
(proc_macro_buffer): Likewise.
(entrypoint): Likewise.
(proc_macro_array): Likewise.
(CompileCrate::add_proc_macro_symbols): Likewise.
* backend/rust-compile-proc-macro.cc: New file.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile.cc (proc_macro_buffer): Update type builder with
array length information.
(proc_macro_array): Update type initializer with array length
information.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile.cc (build_attribute_array): Renamed from...
(attribute_array): ...to attribute array.
(build_derive_proc_macro): Likewise from...
(derive_proc_macro): ... to derive_proc_macro.
(build_bang_proc_macro): Likewise from...
(bang_proc_macro): ...to bang_proc_macro.
(build_attribute_proc_macro): Likewise from...
(attribute_proc_macro): ... to attribute_proc_macro.
(build_proc_macro_payload): Likewise from...
(proc_macro_payload): to proc_macro_payload.
(build_proc_macro): Likewise from...
(proc_macro): ...to proc_macro.
(build_proc_macro_buffer): Likewise from...
(proc_macro_buffer): ... to proc_macro_buffer.
(build_entrypoint): Likewise from...
(entrypoint): ...to entrypoint.
(init_derive_proc_macro): Renamed to it's shorter counterpart.
(init_attribute_proc_macro): Likewise.
(init_bang_proc_macro): Likewise.
(init_proc_macro): Likewise.
(initialize_proc_macro_array): Likewise.
(proc_macro_array): Likewise.
(CompileCrate::add_proc_macro_symbols): Update function calls.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-base.h: Make static function address_expression
public.
* backend/rust-compile.cc (CompileCrate::add_proc_macro_symbols): Add
new global variable in export function.
(build_bang_proc_macro): Add a function to build the bang proc macro
structure type.
(build_proc_macro): Add a function to build the proc macro structure
type.
(build_proc_macro_payload): Add a function to build the proc macro
union used in proc macro structures.
(init_derive_proc_macro): Add a function to initialize custom derive
proc macros.
(init_attribute_proc_macro): Add a function to initialize attribute
proc macros.
(init_bang_proc_macro): Add a function to initialize bang proc macros.
(init_proc_macro): Add a function to initialize proc macro structures.
(initialize_proc_macro_array): Add a function to initialize the proc
macro buffer array.
(CompileCrate::add_proc_macro_symbols): Add call to the new functions
to correctly initialize proc macros as well as their entrypoint.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-proc-macro.cc (CustomDeriveProcMacro::CustomDeriveProcMacro):
Remove constant string declaration.
(load_macros_array): Add call to the new generation function.
(generate_proc_macro_decls_symbol): Add a new function to generate the
entrypoint symbol name from the stable crate id.
(PROC_MACRO_DECLS_FMT_ARGS):
New macro to keep formats arguments in sync between each call.
* expand/rust-proc-macro.h (generate_proc_macro_decls_symbol): Add
function prototype.
* rust-system.h: Include <iomanip>.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile.cc (build_attribute_array): Add a function to
build the attribute array type.
(build_derive_proc_macro): Add a function to build the derive proc
macro type.
(build_bang_proc_macro): Add a function to build the bang proc macro
type.
(build_attribute_proc_macro): Add a function to build the attribute
proc macro type.
(build_proc_macro): Add a function to build the proc macro tagged union
type.
(build_proc_macro_buffer): Add a function to build the proc macro
buffer type.
(build_entrypoint): Add a function to build the proc macro entrypoint
type.
* backend/rust-compile.h: Add function prototype.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-context.h: Add getters.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-base.cc (HIRCompileBase::setup_fndecl):
Make the function non static in order to be able to access the
compile context. Also add the whole proc macro infomrmation
collection.
(get_attributes): Add a function to retrieve the different
attributes from a derive procedural macro definition attribute.
(get_trait_name): Add a function to retrieve the trait name from
a derive procedural macro definition attribute.
* backend/rust-compile-base.h: Add function prototypes.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-base.cc (HIRCompileBase::setup_abi_options):
Reformat uncorrectly formatted comments.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-context.h (struct CustomDeriveInfo): Add
new derive procedural macro metadata information holder for
mappings.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h: Add const getter.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-base.cc (handle_proc_macro_common): Add
new attribute "gccrs_proc_macro" to all procedural macro
functions.
(get_abi): Add a function to retrieve the correct ABI depending
on wether the function is a proc macro or not.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-base.cc (HIRCompileBase::setup_fndecl):
Add proc macro handlers dispatch.
(handle_proc_macro_common): Add a function for common behavior
between all kinds of proc macros.
* backend/rust-compile-base.h: Add function prototypes.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::setup_loop): Move.
(ExprStmtBuilder::get_label_ctx): Move.
(ExprStmtBuilder::get_unnamed_loop_ctx): Moved.
(ExprStmtBuilder::visit): BIR improvements.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.h: Refactor.
* checks/errors/borrowck/rust-bir-builder-internal.h (class LifetimeResolver):
Refactor.
(struct BuilderContext): Move.Refactor.
(optional_from_ptr): Map on null ptr.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h (class LazyBooleanExprBuilder):
Refactor.
* checks/errors/borrowck/rust-bir-builder-pattern.h: Refactor.
* checks/errors/borrowck/rust-bir-builder-struct.h (class StructBuilder): Refactor.
* checks/errors/borrowck/rust-bir-builder.h: Refactor.
* checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Refactor.
(Dump::visit): Refactor.
(Dump::visit_place): Refactor.
(Dump::visit_move_place): Refactor.
(Dump::visit_lifetime): Refactor.
* checks/errors/borrowck/rust-bir-dump.h: Refactor.
* checks/errors/borrowck/rust-bir-place.h: Refactor.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/dev-notes.md: New file.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/bir-design-notes.md: New file.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Use goto.
* checks/errors/borrowck/rust-bir-builder-internal.h: Explicit goto.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Explicit goto.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Continue.
(ExprStmtBuilder::setup_loop): Continue.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-dump.cc (simplify_cfg): Detech infinite loops.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Push ctx.
(ExprStmtBuilder::setup_loop): Common loop infractructure setup.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.h: Loop ctx.
* checks/errors/borrowck/rust-bir-builder-internal.h (struct BuilderContext): Loop ctx.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Improve jumps dump.
(Dump::visit): Improve jumps dump.
* checks/errors/borrowck/rust-bir-dump.h (class Dump): Improve jumps dump.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-dump.cc (simplify_cfg): Simplify cfg logic.
(Dump::go): Run simplify cfg.
* checks/errors/borrowck/rust-bir-dump.h: Option to simplify cfg.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Use new print.
(print_comma_separated): Comma separation print.
(Dump::visit): Use new print.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* Make-lang.in: Build BIR dump.
* checks/errors/borrowck/rust-borrow-checker.cc (mkdir_wrapped): Cross-platform mkdir.
(dump_function_bir): Save dump to file.
(BorrowChecker::go): Run dump during borrowck.
* checks/errors/borrowck/rust-bir-dump.cc: New file.
* checks/errors/borrowck/rust-bir-dump.h: New file.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* Make-lang.in: Compile BIR expr visitor.
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go): Use BIR builder.
* rust-session-manager.cc (Session::compile_crate): Run borrow checker.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc: New file.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.h: New file.
* checks/errors/borrowck/rust-bir-builder-internal.h: New file.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: New file.
* checks/errors/borrowck/rust-bir-builder-pattern.h: New file.
* checks/errors/borrowck/rust-bir-builder-struct.h: New file.
* checks/errors/borrowck/rust-bir-builder.h: New file.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-borrow-checker.cc: Include to compile new code.
* checks/errors/borrowck/rust-bir-place.h: New file.
* checks/errors/borrowck/rust-bir-visitor.h: New file.
* checks/errors/borrowck/rust-bir.h: New file.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* lang.opt: CLI flag.
* rust-session-manager.cc (Session::compile_crate): Guard execution.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::BorrowChecker): Opt dump.
(BorrowChecker::go): Opt dump.
* checks/errors/borrowck/rust-borrow-checker.h (class BorrowChecker): Opt dump.
* lang.opt: Add compile until borrowcheck.
* rust-session-manager.cc (Session::enable_dump): Add BIR.
(Session::compile_crate): Handle new options.
* rust-session-manager.h (struct CompileOptions): Add BIR.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* Make-lang.in: Build borrowck.
* checks/errors/borrowck/rust-borrow-checker.cc: New file.
* checks/errors/borrowck/rust-borrow-checker.h: New file.
* checks/errors/borrowck/rust-function-collector.h: New file.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-pattern.h: Add override modifier to overriding methods.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-item.h: Add a new constructor for const with no value
expression.
* parse/rust-parse-impl.h (Parser::parse_const_item): Allow const with
no expression value.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* hir/tree/rust-hir-path.h: Avoid copy in getter.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): Rename method.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Rename method.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Rename method.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Rename method.
* hir/rust-hir-dump.cc (Dump::visit): Rename method.
* hir/tree/rust-hir-expr.h: Rename method.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Rename method.
* typecheck/rust-tyty.h: Rename method.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* backend/rust-compile-base.cc: Rename method.
* backend/rust-compile-expr.cc (sort_tuple_patterns): Rename method.
* backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Rename method.
(CompilePatternBindings::visit): Rename method.
(CompilePatternLet::visit): Rename method.
* backend/rust-compile-stmt.cc (CompileStmt::visit): Rename method.
* backend/rust-compile-var-decl.h: Rename method.
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::translate): Rename method.
* hir/rust-hir-dump.cc (Dump::visit): Rename method.
* hir/tree/rust-hir-path.h: Rename method.
* hir/tree/rust-hir-pattern.h: Rename method.
* hir/tree/rust-hir.h: Rename method.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::Resolve): Rename method.
(TypeCheckPattern::visit): Rename method.
(ClosureParamInfer::visit): Rename method.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Rename method.
* util/rust-hir-map.cc (Mappings::insert_hir_pattern): Rename method.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* hir/tree/rust-hir-expr.h: Add getter for name.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Implement for tuple pat.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): Implement for tupple pat.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* hir/tree/rust-hir-path.h: Avoid copy in getter.
* hir/tree/rust-hir-pattern.h: Avoid copy in getter.
* hir/tree/rust-hir.h: Avoid copy in getter.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-ast-resolve-implitem.h
(ResolveToplevelImplItem::go): Take AssociatedItem as parameter.
(ResolveTopLevelTraitItems::go): Likewise.
* resolve/rust-ast-resolve-item.cc
(ResolveTraitItems::go): Likewise.
(ResolveItem::resolve_impl_item): Likewise.
(ResolveImplItems::go): Likewise.
* resolve/rust-ast-resolve-item.h
(ResolveTraitItems::go): Likewise.
(ResolveItem::resolve_impl_item): Likewise.
(ResolveImplItems::go): Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* hir/rust-ast-lower-implitem.h
(ASTLoweringImplItem::translate): Take AssociatedItem as parameter.
(ASTLoweringTraitItem::translate): Likewise.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): Bail on labelled block.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Add loop ctx.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Resolve using loop logic.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* hir/rust-ast-lower.cc (ASTLoweringBlock::visit): Call loop lowering and add it to constr.
* hir/tree/rust-hir-expr.h (class LoopLabel): Move before BlockExpr and add to BlockExpr.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-builder.cc (AstBuilder::block): Add label arg to constructor call.
* ast/rust-expr.h (class LoopLabel): Move before BlockExpr.
(class BlockExpr): Add LoopLabel member.
* expand/rust-derive-clone.cc (DeriveClone::clone_fn): Add label arg to constructor call.
* parse/rust-parse-impl.h (Parser::parse_block_expr): Add label parameter.
(Parser::parse_labelled_loop_expr): Add label arg to constructor call.
* parse/rust-parse.h: Add label arg to constructor call.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast.h
(class AssociatedItem):
New, based on TraitItem, InherentImplItem, and TraitImplItem classes.
(class TraitItem): Inherit from AssociatedItem.
(class InherentImplItem): Likewise.
(class TraitImplItem): Likewise.
* ast/rust-item.h
(class Method): Update cloning functions.
(class Function): Likewise.
(class TypeAlias): Likewise.
(class ConstantItem): Likewise.
(class TraitItemFunc): Likewise.
(class TraitItemMethod): Likewise.
(class TraitItemConst): Likewise.
(class TraitItemType): Likewise.
* ast/rust-macro.h
(class MacroInvocation): Likewise.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* backend/rust-mangle.cc (v0_identifier): Fix broken encoding.
(v0_scope_path): Modify paramter.
(v0_path): Fix namespace for modules.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_closure_expr_pratt): Fix
closure parsing function to handle consecutive parameter lists.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-macro.h: Add PATH fragment to follow set restrictions.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::is_macro_rules_def): Add a function
that checks tokens given by the lexer represents an accurate macro
definition. This will reduce code duplication.
(Parser::parse_item): Replace condition with call to new checking
function.
(Parser::parse_stmt): Likewise.
* parse/rust-parse.h: Add function prototype for is_macro_rules_def.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_expr): Fix range from expr.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_item): Relax constraints
around default identifier at item scope to accept "default" macros.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_path_expr_segment): Accept
left shift tokens in order to let generic parsing function split the
token.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast.h
(Pattern::get_pattern_node_id): Rename to...
(Pattern::get_node_id): ...here.
* ast/rust-macro.h
(MacroInvocation::get_pattern_node_id): Rename to...
(MacroInvocation::get_node_id): ...here.
* ast/rust-path.h
(PathInExpression::get_pattern_node_id): Remove.
(QualifiedPathInExpression::get_pattern_node_id): Remove.
* ast/rust-pattern.h
(LiteralPattern::get_pattern_node_id): Remove.
(IdentifierPattern::get_pattern_node_id): Remove.
(WildcardPattern::get_pattern_node_id): Remove.
(RestPattern::get_pattern_node_id): Rename to...
(RestPattern::get_node_id): ...here.
(RangePattern::get_pattern_node_id): Remove.
(ReferencePattern::get_pattern_node_id): Remove.
(StructPattern::get_pattern_node_id): Remove.
(TupleStructPattern::get_pattern_node_id): Remove.
(TuplePattern::get_pattern_node_id): Remove.
(GroupedPattern::get_pattern_node_id): Remove.
(SlicePattern::get_pattern_node_id): Remove.
(AltPattern::get_pattern_node_id): Remove.
* resolve/rust-early-name-resolver.cc
(EarlyNameResolver::visit):
Use get_node_id instead of get_pattern_node_id.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_expr): Add comma delimiter.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_visibility): Relax constraints
over public visibility return condition in order to accept pub unit
types.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* typecheck/rust-tyty.cc (BaseType::is_unit): Refactor.
(BaseType::satisfies_bound): Refactor.
(BaseType::get_root): Refactor.
(BaseType::destructure): Refactor.
(BaseType::monomorphized_clone): Refactor.
(BaseType::is_concrete): Refactor.
(InferType::InferType): Refactor.
(InferType::clone): Refactor.
(InferType::apply_primitive_type_hint): Refactor.
(StructFieldType::is_equal): Refactor.
(ADTType::is_equal): Refactor.
(handle_substitions): Refactor.
(ADTType::handle_substitions): Refactor.
(TupleType::TupleType): Refactor.
(TupleType::is_equal): Refactor.
(TupleType::handle_substitions): Refactor.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* typecheck/rust-tyty.cc (InferType::InferType): Use static constant for kind information.
(ErrorType::ErrorType): Use static constant for kind information.
(TupleType::TupleType): Use static constant for kind information.
(BoolType::BoolType): Use static constant for kind information.
(IntType::IntType): Use static constant for kind information.
(UintType::UintType): Use static constant for kind information.
(FloatType::FloatType): Use static constant for kind information.
(USizeType::USizeType): Use static constant for kind information.
(ISizeType::ISizeType): Use static constant for kind information.
(CharType::CharType): Use static constant for kind information.
(ReferenceType::ReferenceType): Use static constant for kind information.
(PointerType::PointerType): Use static constant for kind information.
(ParamType::ParamType): Use static constant for kind information.
(StrType::StrType): Use static constant for kind information.
(NeverType::NeverType): Use static constant for kind information.
(PlaceholderType::PlaceholderType): Use static constant for kind information.
* typecheck/rust-tyty.h: Add static kind information to all TyTy classes.
Create safe cast and check methods.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_type_param_bound): Add missing
case for lifetime switch.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-token.cc (Token::as_string): Update function to output scope
resolution tokens correctly.
* parse/rust-parse-impl.h (Parser::parse_generic_param): Change call to
as_string.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* backend/rust-compile-context.h: Modify declaration.
* backend/rust-mangle.cc (struct V0Path): New struct.
(v0_path): New function.
(legacy_mangle_name): Take Context as argument.
(v0_numeric_prefix): Fix type strings.
(v0_complex_type_prefix): New function.
(v0_add_integer_62): Deleted
(v0_integer_62): New function.
(v0_add_opt_integer_62): Deleted.
(v0_opt_integer_62): New function.
(v0_add_disambiguator): Deleted.
(v0_disambiguator): New function.
(v0_type_prefix): Support more types.
(v0_generic_args): New function.
(v0_add_identifier): Deleted.
(v0_identifier): New function.
(v0_type_path): New function.
(v0_function_path): New function.
(v0_scope_path): New function.
(v0_crate_path): New function.
(v0_inherent_or_trait_impl_path): New function.
(v0_mangle_item): Use v0_path.
(Mangler::mangle_item): Take Context as argument.
* backend/rust-mangle.h (class Context): Add forward declaration.
* hir/tree/rust-hir-item.h: Fix include.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* hir/tree/rust-hir-pattern.h
(TupleStructItems::clone_tuple_struct_items_impl): Rename to...
(TupleStructItems::clone_tuple_items_impl): ...here.
(TupleStructItemsNoRange::clone_tuple_struct_items_impl): Rename to...
(TupleStructItemsNoRange::clone_tuple_items_impl): ...here.
(TupleStructItemsRange::clone_tuple_struct_items_impl): Rename to...
(TupleStructItemsRange::clone_tuple_items_impl): ...here.
(TuplePatternItems::clone_tuple_pattern_items_impl): Rename to...
(TuplePatternItems::clone_tuple_items_impl): ...here.
(TuplePatternItemsMultiple::clone_tuple_pattern_items_impl): Rename to...
(TuplePatternItemsMultiple::clone_tuple_items_impl): ...here.
(TuplePatternItemsRanged::clone_tuple_pattern_items_impl): Rename to...
(TuplePatternItemsRanged::clone_tuple_items_impl): ...here.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* hir/tree/rust-hir-pattern.h
(TuplePatternItems::get_pattern_type): Rename to...
(TuplePatternItems::get_item_type): ...here.
(TuplePatternItemsMultiple::get_pattern_type): Rename to...
(TuplePatternItemsMultiple::get_item_type): ...here.
(TuplePatternItemsRanged::get_pattern_type): Rename to...
(TuplePatternItemsRanged::get_item_type): ...here.
* backend/rust-compile-expr.cc: Adjust calls to renamed methods.
* backend/rust-compile-pattern.cc: Likewise.
* typecheck/rust-hir-type-check-pattern.cc: Likewise.
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* backend/rust-compile-expr.cc (CompileExpr::visit): Merge 2 if clauses.
* backend/rust-compile-extern.h: Fix typo in comment.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* parse/rust-parse-impl.h: Add missing token consumption
2024-01-16 Mohammed Rizan Farooqui <rizanfarooqui@gmail.com>
* expand/rust-macro-builtins.cc (MacroBuiltin::include_str_handler): Comment removed
(MacroBuiltin::env_handler): Comment removed
(MacroBuiltin::cfg_handler): Comment removed
(MacroBuiltin::line_handler): Comment removed
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* backend/rust-compile.cc (HIRCompileBase::coercion_site1): Fix wrong cast
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* rust-session-manager.cc (Session::expansion): Add early break on
error.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* util/rust-canonical-path.h: Add new segment kind for inherent impl.
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Use it.
* resolve/rust-ast-resolve-toplevel.h: Use it.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-expr.h: Fix spelling of "doesn't".
* backend/rust-compile-expr.cc: Fix spelling of "accessors".
* backend/rust-compile-implitem.h: Fix spelling of "normal".
* backend/rust-constexpr.cc: Fix spelling of "actual".
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* hir/rust-hir-dump.cc (Dump::debug): New.
(debug): New.
* hir/rust-hir-dump.h (debug): New.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* Make-lang.in: fixup formatting
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
* rust-session-manager.cc (Session::compile_crate): call new lint
* resolve/rust-ast-verify-assignee.h: Removed.
* checks/errors/rust-readonly-check.cc: New file.
* checks/errors/rust-readonly-check.h: New file.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit):
Added ErrorCode & more fixit hints.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-block.h: remove HIR::ForLoopExpr
* backend/rust-compile-expr.h: likewise
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): likewise
* checks/errors/privacy/rust-privacy-reporter.h: likewise
* checks/errors/rust-const-checker.cc (ConstChecker::visit): likewise
* checks/errors/rust-const-checker.h: likewise
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): likewise
* checks/errors/rust-unsafe-checker.h: likewise
* checks/lints/rust-lint-marklive.h: likewise
* hir/rust-ast-lower.cc (ASTLoweringExprWithBlock::visit): likewise
* hir/rust-hir-dump.cc (Dump::visit): likewise
* hir/rust-hir-dump.h: likewise
* hir/tree/rust-hir-expr.h (class ForLoopExpr): likewise
* hir/tree/rust-hir-full-decls.h (class ForLoopExpr): likewise
* hir/tree/rust-hir-visitor.h: likewise
* hir/tree/rust-hir.cc (ForLoopExpr::as_string): likewise
(ForLoopExpr::accept_vis): likewise
* typecheck/rust-hir-type-check-expr.h: likewise
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* backend/rust-compile-expr.cc (CompileExpr::visit): Fix typo in varIadic.
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Likewise.
* rust-backend.h (function_type_varadic): Rename into ...
(function_type_variadic): ... this.
* rust-gcc.cc (function_type_varadic): Rename into ...
(function_type_variadic): ... this.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise.
* typecheck/rust-tyty.h (is_varadic): Renamed into ...
(is_variadic): ... this.
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* backend/rust-compile-base.cc (HIRCompileBase::compile_function):
Fix typo in substitutions.
(HIRCompileBase::resolve_method_address): Likewise.
* backend/rust-compile-extern.h (CompileExternItem::visit):
Likewise.
* backend/rust-compile-implitem.cc (CompileTraitItem::visit):
Likewise.
* backend/rust-compile-intrinsic.cc (maybe_override_ctx):
Likewise.
* backend/rust-compile-item.cc (CompileItem::visit): Likewise.
* backend/rust-compile-resolve-path.cc
(HIRCompileBase::query_compile): Likewise.
* typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion):
Likewise.
* typecheck/rust-hir-type-check-item.cc
(TypeCheckItem::ResolveImplBlockSelfWithInference): Likewise.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit):
Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit):
Likewise.
* typecheck/rust-tyty.cc (BaseType::has_subsititions_defined):
Renamed into ...
(BaseType::has_substitutions_defined): ... this.
(ADTType::is_equal): Fix typo in substitutions.
(handle_substitions): Likewise.
(FnType::is_equal): Likewise.
(FnType::handle_substitions): Likewise.
* typecheck/rust-tyty.h (has_subsititions_defined): Renamed into
...
(has_substitutions_defined): ... this.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-intrinsic.cc
(get_identifier): Add declaration.
(assume_handler): New.
(generic_intrinsics): Add assume_handler entry.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-gcc.cc
(Backend::wchar_type): Store static wchar tree.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-backend.h
(complex_type): Remove.
(complex_constant_expression): Remove.
(real_part_expression): Remove.
(imag_part_expression): Remove.
(complex_expression): Remove.
* rust-gcc.cc
(complex_type): Remove.
(complex_constant_expression): Remove.
(real_part_expression): Remove.
(imag_part_expression): Remove.
(complex_expression): Remove.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-gcc.cc
(namespace Backend):
Use namespace definition instead of qualified names.
2024-01-16 liushuyu <liushuyu011@gmail.com>
* backend/rust-compile-intrinsic.cc: add `copy`
intrinsics and make `copy_nonoverlapping` handler more generic
2024-01-16 liushuyu <liushuyu011@gmail.com>
* backend/rust-builtins.cc: add `expect` builtin definition.
* backend/rust-compile-intrinsic.cc: add `likely` and `unlikely`
intrinsics handler.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust_error_codes.def: Moved to...
* rust-error-codes.def: ...here...
* rust-diagnostics.h: ...and update references.
2024-01-16 Guillaume Gomez <guillaume1.gomez@gmail.com>
* backend/rust-compile-intrinsic.cc: Simplify `make_unsigned_long_tree`
* rust-backend.h: Remove `integer_constant_expression`
* rust-gcc.cc: Remove `integer_constant_expression`
2024-01-16 Dave Evans <dave@dmetwo.org>
* backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit):
Add AltPattern visitor function
* backend/rust-compile-pattern.h:
Update CompilePatternCaseLabelExpr::visit(AltPattern&).
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
Update AltPattern visitor
2024-01-16 Guillaume Gomez <guillaume1.gomez@gmail.com>
* backend/rust-compile-intrinsic.cc: Remove unused argument
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Added new error message, rich location and error code.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-backend.h
(class Backend): Convert to ...
(namespace Backend): ... namespace.
* rust-gcc.cc
(Backend::Backend): Rename to ...
(Backend::init): ... here.
(rust_get_backend): Remove.
* rust-session-manager.cc
(rust_get_backend): Remove.
(Session::init): Use Backend::init instead of rust_get_backend.
(Session::compile_crate):
Initialize Context without pointer to Backend.
* rust-session-manager.h
(Session::backend): Remove.
* backend/rust-compile-context.cc
(Context::Context): Remove pointer to Backend.
* backend/rust-compile-context.h
(class Context): Remove pointer to Backend, update function calls.
* backend/rust-compile-base.cc: Update function calls.
* backend/rust-compile-block.cc: Likewise.
* backend/rust-compile-expr.cc: Likewise.
* backend/rust-compile-extern.h: Likewise.
* backend/rust-compile-fnparam.cc: Likewise.
* backend/rust-compile-intrinsic.cc: Likewise.
* backend/rust-compile-item.cc: Likewise.
* backend/rust-compile-pattern.cc: Likewise.
* backend/rust-compile-resolve-path.cc: Likewise.
* backend/rust-compile-type.cc: Likewise.
* backend/rust-compile-var-decl.h: Likewise.
* backend/rust-compile.cc: Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.cc (Attribute::check_cfg_predicate): Change raw
string to constexpr call.
(Attribute::separate_cfg_attrs): Likewise.
* backend/rust-compile-base.cc (should_mangle_item): Likewise.
(HIRCompileBase::setup_fndecl): Likewise.
(HIRCompileBase::handle_cold_attribute_on_fndecl): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (find_proc_macro_attribute):
Likewise.
* checks/errors/rust-unsafe-checker.cc (check_target_attr):
Likewise.
* expand/rust-cfg-strip.cc (fails_cfg): Likewise.
(fails_cfg_with_expand): Likewise.
(expand_cfg_attrs): Likewise.
* expand/rust-macro-builtins.cc: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_outer_attributes): Likewise.
(ASTLoweringBase::lower_macro_definition): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* parse/rust-parse-impl.h (Parser::parse_doc_comment): Likewise.
* parse/rust-parse.cc (extract_module_path): Likewise.
* resolve/rust-early-name-resolver.cc (is_macro_use_module):
Likewise.
(EarlyNameResolver::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (is_macro_export):
Likwise.
* rust-session-manager.cc (Session::injection): Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::parse_repr_options): Likewise.
* util/rust-attributes.cc (is_proc_macro_type): Likewise.
(AttributeChecker::check_attribute): Likewise.
(AttributeChecker::visit): Likewise.
* util/rust-hir-map.cc (Mappings::insert_macro_def): Likewise.
* util/rust-attribute-values.h: New file.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-backend.h
(Backend::Backend): New.
(Backend::~Backend): Remove.
(class Gcc_backend): Remove.
* rust-gcc.cc
(Gcc_backend::Gcc_backend): Rename to ...
(Backend::Backend): ... here.
(rust_get_backend): Construct Backend instead of Gcc_backend.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-proc-macro.cc (tokenstream_from_string): Change
linemap null pointer to the current linemap.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Add proc macro definition insertion.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-hir-map.cc (Mappings::insert_derive_proc_macro_def):
Change the function body to fetch the node id from the macro
parameter.
(Mappings::insert_bang_proc_macro_def): Likewise.
(Mappings::insert_attribute_proc_macro_def): Likewise.
* util/rust-hir-map.h: Update the function's prototype by
removing the node id from the list of arguments.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes):
Add proc macro handle retrieval for attribute and derive proc macros.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-hir-map.cc (Mappings::lookup_derive_proc_macro_def):
Update function to accomodate new signature.
(Mappings::lookup_bang_proc_macro_def): Likewise.
(Mappings::lookup_attribute_proc_macro_def): Likewise.
* util/rust-hir-map.h: Update function signatures.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-macro-expand.h (struct MacroExpander): Update
lookup function prototypes.
* util/rust-hir-map.cc (Mappings::lookup_derive_proc_macro_invocation):
Update lookup function according to new signature.
(Mappings::lookup_bang_proc_macro_invocation): Likewise.
(Mappings::lookup_attribute_proc_macro_invocation): Likewise.
* util/rust-hir-map.h: Update function prototypes.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-backend.h
(Backend::write_export_data): Remove.
* rust-gcc.cc
(Backend::write_export_data): Remove.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-backend.h
(Backend::real_part_expression): Make non-virtual.
(Backend::imag_part_expression): Likewise.
(Backend::complex_expression): Likewise.
(Backend::convert_expression): Likewise.
(Backend::struct_field_expression): Likewise.
(Backend::compound_expression): Likewise.
(Backend::conditional_expression): Likewise.
(Backend::negation_expression): Likewise.
(Backend::arithmetic_or_logical_expression): Likewise.
(Backend::arithmetic_or_logical_expression_checked): Likewise.
(Backend::comparison_expression): Likewise.
(Backend::lazy_boolean_expression): Likewise.
(Backend::constructor_expression): Likewise.
(Backend::array_constructor_expression): Likewise.
(Backend::array_initializer): Likewise.
(Backend::array_index_expression): Likewise.
(Backend::call_expression): Likewise.
(Gcc_backend::real_part_expression): Remove.
(Gcc_backend::imag_part_expression): Remove.
(Gcc_backend::complex_expression): Remove.
(Gcc_backend::convert_expression): Remove.
(Gcc_backend::struct_field_expression): Remove.
(Gcc_backend::compound_expression): Remove.
(Gcc_backend::conditional_expression): Remove.
(Gcc_backend::negation_expression): Remove.
(Gcc_backend::arithmetic_or_logical_expression): Remove.
(Gcc_backend::arithmetic_or_logical_expression_checked): Remove.
(Gcc_backend::comparison_expression): Remove.
(Gcc_backend::lazy_boolean_expression): Remove.
(Gcc_backend::constructor_expression): Remove.
(Gcc_backend::array_constructor_expression): Remove.
(Gcc_backend::array_initializer): Remove.
(Gcc_backend::array_index_expression): Remove.
(Gcc_backend::call_expression): Remove.
* rust-gcc.cc
(Gcc_backend::real_part_expression): Rename to ...
(Backend::real_part_expression): ... here.
(Gcc_backend::imag_part_expression): Rename to ...
(Backend::imag_part_expression): ... here.
(Gcc_backend::complex_expression): Rename to ...
(Backend::complex_expression): ... here.
(Gcc_backend::convert_expression): Rename to ...
(Backend::convert_expression): ... here.
(Gcc_backend::struct_field_expression): Rename to ...
(Backend::struct_field_expression): ... here.
(Gcc_backend::compound_expression): Rename to ...
(Backend::compound_expression): ... here.
(Gcc_backend::conditional_expression): Rename to ...
(Backend::conditional_expression): ... here.
(Gcc_backend::negation_expression): Rename to ...
(Backend::negation_expression): ... here.
(Gcc_backend::arithmetic_or_logical_expression): Rename to ...
(Backend::arithmetic_or_logical_expression): ... here.
(Gcc_backend::arithmetic_or_logical_expression_checked): Rename to ...
(Backend::arithmetic_or_logical_expression_checked): ... here.
(Gcc_backend::comparison_expression): Rename to ...
(Backend::comparison_expression): ... here.
(Gcc_backend::lazy_boolean_expression): Rename to ...
(Backend::lazy_boolean_expression): ... here.
(Gcc_backend::constructor_expression): Rename to ...
(Backend::constructor_expression): ... here.
(Gcc_backend::array_constructor_expression): Rename to ...
(Backend::array_constructor_expression): ... here.
(Gcc_backend::array_initializer): Rename to ...
(Backend::array_initializer): ... here.
(Gcc_backend::array_index_expression): Rename to ...
(Backend::array_index_expression): ... here.
(Gcc_backend::call_expression): Rename to ...
(Backend::call_expression): ... here.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* rust-session-manager.cc (Session::load_extern_crate): Change
variable name, add temporaries and comments.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-proc-macro.h: Change get_trait_name to get_name in
order to be coherent with the others proc macro type name
convention.
* resolve/rust-toplevel-name-resolver-2.0.cc (insert_macros):
Add a templated funtion that inserts a proc macro into the
context and emit an error on failure.
(TopLevel::visit): Change from manual insertion to a function
call.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Change to assertion.
* util/rust-hir-map.cc (Mappings::lookup_derive_proc_macros):
Add empty line.
(Mappings::lookup_bang_proc_macros): Likewise.
(Mappings::lookup_attribute_proc_macros): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* metadata/rust-extern-crate.cc (ExternCrate::ExternCrate):
Update definition to allow Extern crate with no content (pure
proc macros).
(ExternCrate::ok): Panic on no content.
(ExternCrate::load): Likewise.
* metadata/rust-extern-crate.h: Update prototypes.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::go):
Remove macro resolution.
(TopLevel::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.h: Add visit prototype
for extern crate.
* rust-session-manager.cc (Session::load_extern_crate): Adapt
content depending on the loaded crate's content.
* util/rust-hir-map.cc (Mappings::lookup_derive_proc_macros):
Change return type to optional because it is way more
convenient.
(Mappings::lookup_bang_proc_macros): Likewise.
(Mappings::lookup_attribute_proc_macros): Likewise.
* util/rust-hir-map.h: Update function prototypes.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* metadata/rust-imports.cc (Import::try_package_in_directory):
Remove error when some macro are found even if no import data is
available.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h (class BangProcMacro): Move class from here to
rust-proc-macro.h. Also remove related functions.
(class AttributeProcMacro): Likewise.
(class CustomDeriveProcMacro): Likewise.
(struct Crate): Remove proc macro vector members.
* expand/rust-macro-expand.h (struct MacroExpander): Change the
type to the newly created classes.
* expand/rust-proc-macro.cc (BangProcMacro::BangProcMacro): Add
constructor implementation.
(AttributeProcMacro::AttributeProcMacro): Likewise.
(CustomDeriveProcMacro::CustomDeriveProcMacro): Likewise.
* expand/rust-proc-macro.h (class BangProcMacro): Move class to
here.
(class AttributeProcMacro): Likewise.
(class CustomDeriveProcMacro): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::go):
Change top level visitor to check mappings instead
* rust-session-manager.cc (Session::load_extern_crate):
Add back macro collection to mappings.
* util/rust-hir-map.cc (Mappings::insert_derive_proc_macros):
Update getter signature with new types.
(Mappings::insert_bang_proc_macros): Likewise.
(Mappings::insert_attribute_proc_macros): Likewise.
(Mappings::lookup_derive_proc_macros): Likewise.
(Mappings::lookup_bang_proc_macros): Likewise.
(Mappings::lookup_attribute_proc_macros): Likewise.
(Mappings::insert_derive_proc_macro_def): Likewise.
(Mappings::insert_bang_proc_macro_def): Likewise.
(Mappings::insert_attribute_proc_macro_def): Likewise.
(Mappings::lookup_derive_proc_macro_def): Likewise.
(Mappings::lookup_bang_proc_macro_def): Likewise.
(Mappings::lookup_attribute_proc_macro_def): Likewise.
(Mappings::insert_derive_proc_macro_invocation): Likewise.
(Mappings::lookup_derive_proc_macro_invocation): Likewise.
(Mappings::insert_bang_proc_macro_invocation): Likewise.
(Mappings::lookup_bang_proc_macro_invocation): Likewise.
(Mappings::insert_attribute_proc_macro_invocation): Likewise.
(Mappings::lookup_attribute_proc_macro_invocation): Likewise.
* util/rust-hir-map.h: Update function prototypes as well as map
types.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::go):
Visit crate's newly stored proc macros.
* rust-session-manager.cc (Session::load_extern_crate):
Store proc macros in the parsed crate instead of a local
variable to achieve mappings.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes):
Change argument to reference.
* resolve/rust-early-name-resolver-2.0.h: Update function
prototype.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h: Add getters.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h (struct Crate): Add proc macro members.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h (class BangProcMacro): Add new proc macro
abstraction.
(class AttributeProcMacro): Likewise.
(class CustomDeriveProcMacro): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes):
Add function to handle attributes.
(Early::visit): Override visitor functions.
* resolve/rust-early-name-resolver-2.0.h: Add prototype.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.cc (Attribute::get_traits_to_derive): Convert
tokenstream to path list.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.cc (Attribute::is_derive): Remove tokenstream
condition.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.cc (Attribute::get_traits_to_derive): Change
return type to a vector of references.
* ast/rust-ast.h: Update constructor.
* expand/rust-expand-visitor.cc (ExpandVisitor::expand_inner_stmts):
Update function call.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.cc (Attribute::get_traits_to_derive): Add
function as member function.
* ast/rust-ast.h: Add prototype.
* expand/rust-expand-visitor.cc (get_traits_to_derive): Remove
function.
(ExpandVisitor::expand_inner_stmts): Update function call.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.cc (Attribute::is_derive): Add member function.
* ast/rust-ast.h: Likewise.
* expand/rust-expand-visitor.cc (is_derive): Remove old
function.
(ExpandVisitor::expand_inner_stmts): Update function call.
(ExpandVisitor::visit_inner_using_attrs): Likewise.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): use a temp for the value
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-backend.h
(Backend::block): Make non-virtual.
(Backend::block_add_statements): Likewise.
(Gcc_backend::block): Remove.
(Gcc_backend::block_add_statements): Remove.
* rust-gcc.cc
(Gcc_backend::block): Rename to ...
(Backend::block): ... here.
(Gcc_backend::block_add_statements): Rename to ...
(Backend::block_add_statements): ... here.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-macro-expand.h: Change include directive with the
new name.
* expand/rust-proc-macro.h (RUST_PROC_MACRO_H): Likewise.
* util/rust-hir-map.h: Likewise.
* util/rust-token-converter.h: Likewise.
* util/rust-token-converter.cc: Remove useless include
directive.
* Make-lang.in: Rename library.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-backend.h
(Backend::init_statement): Make non-virtual.
(Backend::assignment_statement): Likewise.
(Backend::return_statement): Likewise.
(Backend::if_statement): Likewise.
(Backend::loop_expression): Likewise.
(Backend::exit_expression): Likewise.
(Backend::compound_statement): Likewise.
(Backend::statement_list): Likewise.
(Backend::exception_handler_statement): Likewise.
(Gcc_backend::init_statement): Remove.
(Gcc_backend::assignment_statement): Remove.
(Gcc_backend::return_statement): Remove.
(Gcc_backend::if_statement): Remove.
(Gcc_backend::compound_statement): Remove.
(Gcc_backend::statement_list): Remove.
(Gcc_backend::exception_handler_statement): Remove.
(Gcc_backend::loop_expression): Remove.
(Gcc_backend::exit_expression): Remove.
* rust-gcc.cc
(Gcc_backend::init_statement): Rename to ...
(Backend::init_statement): ... here.
(Gcc_backend::assignment_statement): Rename to ...
(Backend::assignment_statement): ... here.
(Gcc_backend::return_statement): Rename to ...
(Backend::return_statement): ... here.
(Gcc_backend::exception_handler_statement): Rename to ...
(Backend::exception_handler_statement): ... here.
(Gcc_backend::if_statement): Rename to ...
(Backend::if_statement): ... here.
(Gcc_backend::loop_expression): Rename to ...
(Backend::loop_expression): ... here.
(Gcc_backend::exit_expression): Rename to ...
(Backend::exit_expression): ... here.
(Gcc_backend::compound_statement): Rename to ...
(Backend::compound_statement): ... here.
(Gcc_backend::statement_list): Rename to ...
(Backend::statement_list): ... here.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-backend.h
(Backend::function): Make non-virtual.
(Backend::function_defer_statement): Likewise.
(Backend::function_set_parameters): Likewise.
(Backend::write_global_definitions): Likewise.
(Backend::write_export_data): Likewise.
(Gcc_backend::function): Remove.
(Gcc_backend::function_defer_statement): Remove.
(Gcc_backend::function_set_parameters): Remove.
(Gcc_backend::write_global_definitions): Remove.
(Gcc_backend::write_export_data): Remove.
* rust-gcc.cc
(Gcc_backend::function): Rename to ...
(Backend::function): ... here.
(Gcc_backend::function_defer_statement):
Fix a qualified lookup of Backend::label and rename to ...
(Backend::function_defer_statement): ... here.
(Gcc_backend::function_set_parameters) Rename to ...
(Backend::function_set_parameters): ... here.
(Gcc_backend::write_global_definitions): Rename to ...
(Backend::write_global_definitions): ... here.
(Gcc_backend::write_export_data): Rename to ...
(Backend::write_export_data): ... here.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-inherent-impl-overlap.h:
Added rich location and errorcode.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
likewise.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
Added error code.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-backend.h
(Backend::zero_expression): Make non-virtual.
(Backend::var_expression): Likewise.
(Backend::integer_constant_expression): Likewise.
(Backend::float_constant_expression): Likewise.
(Backend::complex_constant_expression): Likewise.
(Backend::string_constant_expression): Likewise.
(Backend::char_constant_literal): Likewise.
(Backend::wchar_constant_literal): Likewise.
(Backend::boolean_constant_expression): Likewise.
(Gcc_backend::zero_expression): Remove.
(Gcc_backend::var_expression): Remove.
(Gcc_backend::integer_constant_expression): Remove.
(Gcc_backend::float_constant_expression): Remove.
(Gcc_backend::complex_constant_expression): Remove.
(Gcc_backend::string_constant_expression): Remove.
(Gcc_backend::wchar_constant_expression): Remove.
(Gcc_backend::char_constant_expression): Remove.
(Gcc_backend::boolean_constant_expression): Remove.
* rust-gcc.cc
(Gcc_backend::zero_expression): Rename to ...
(Backend::zero_expression): ... here.
(Gcc_backend::var_expression): Rename to ...
(Backend::var_expression): ... here.
(Gcc_backend::integer_constant_expression): Rename to ...
(Backend::integer_constant_expression): ... here.
(Gcc_backend::float_constant_expression): Rename to ...
(Backend::float_constant_expression): ... here.
(Gcc_backend::complex_constant_expression): Rename to ...
(Backend::complex_constant_expression): ... here.
(Gcc_backend::string_constant_expression): Rename to ...
(Backend::string_constant_expression): ... here.
(Gcc_backend::wchar_constant_expression): Rename to ...
(Backend::wchar_constant_expression): ... here.
(Gcc_backend::char_constant_expression): Rename to ...
(Backend::char_constant_expression): ... here.
(Gcc_backend::boolean_constant_expression): Rename to ...
(Backend::boolean_constant_expression): ... here.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-backend.h
(Backend::global_variable): Make non-virtual.
(Backend::global_variable_set_init): Likewise.
(Backend::local_variable): Likewise.
(Backend::parameter_variable): Likewise.
(Backend::static_chain_variable): Likewise.
(Backend::temporary_variable): Likewise.
(Gcc_backend::global_variable): Remove.
(Gcc_backend::global_variable_set_init): Remove.
(Gcc_backend::local_variable): Remove.
(Gcc_backend::parameter_variable): Remove.
(Gcc_backend::static_chain_variable): Remove.
(Gcc_backend::temporary_variable): Remove.
(Gcc_backend::non_zero_size_type): Move to ...
(Backend::non_zero_size_type): ... here.
(Gcc_backend::convert_tree): Move to ...
(Backend::convert_tree): ... here.
* rust-gcc.cc
(Gcc_backend::non_zero_size_type): Rename to ...
(Backend::non_zero_size_type): ... here.
(Gcc_backend::convert_tree): Rename to ...
(Backend::convert_tree): ... here.
(Gcc_backend::global_variable): Rename to ...
(Backend::global_variable): ... here.
(Gcc_backend::global_variable_set_init): Rename to ...
(Backend::global_variable_set_init): ... here.
(Gcc_backend::local_variable): Rename to ...
(Backend::local_variable): ... here.
(Gcc_backend::parameter_variable): Rename to ...
(Backend::parameter_variable): ... here.
(Gcc_backend::static_chain_variable): Rename to ...
(Backend::static_chain_variable): ... here.
(Gcc_backend::temporary_variable): Rename to ...
(Backend::temporary_variable): ... here.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::check_for_privacy_violation):
Added errorcode & richlocation.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-backend.h
(Backend::debug): Make non-virtual.
(Backend::get_identifier_node): Likewise.
(Gcc_backend::debug): Remove.
(Gcc_backend::get_identifier_node): Remove.
* rust-gcc.cc
(Gcc_backend::debug): Rename to ...
(Backend::debug): ... here.
(Gcc_backend::get_identifier_node): Rename to ...
(Backend::get_identifier_node): ... here.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-hir-type-check-expr.cc
(TypeCheckExpr::visit): Expect if conditions to have type bool.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-backend.h
(Backend::label): Make non-virtual.
(Backend::label_definition_statement): Likewise.
(Backend::goto_statement): Likewise.
(Backend::label_address): Likewise.
(Gcc_backend::label): Remove.
(Gcc_backend::label_definition_statement): Remove.
(Gcc_backend::goto_statement): Remove.
(Gcc_backend::label_address): Remove.
* rust-gcc.cc
(Gcc_backend::label): Rename to ...
(Backend::label): ... here.
(Gcc_backend::label_definition_statement): Rename to ...
(Backend::label_definition_statement): ... here.
(Gcc_backend::goto_statement): Rename to ...
(Backend::goto_statement): ... here.
(Gcc_backend::label_address): Rename to ...
(Backend::label_address): ... here.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-constexpr.cc
(struct constexpr_fundef): Rename to ...
(struct rust_constexpr_fundef): ... here.
(struct constexpr_call): Rename to ...
(struct rust_constexpr_call): ... here.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* lex/rust-input-source.h: Move constants from here...
* util/rust-codepoint.h (struct Codepoint): ... to here
* util/rust-attributes.cc (check_no_mangle_function): New function.
(AttributeChecker::visit): Use it.
* util/rust-unicode.cc (is_ascii_only): New function.
* util/rust-unicode.h (is_ascii_only): Likewise.
* backend/rust-mangle.cc (legacy_mangle_name): Use it.
* util/rust-punycode.cc (extract_basic_string): Likewise.
* lex/rust-lex.cc (Lexer::parse_byte_char): Likewise.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit):
Added richlocation & error code.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-hir-type-check-expr.cc
(TypeCheckExpr::resolve_fn_trait_call): Add TODO comment.
* typecheck/rust-tyty-bounds.cc
(TypeBoundPredicate::TypeBoundPredicate):
Add assertions, new error constructor.
(TypeBoundPredicate::error): Use new error constructor.
* typecheck/rust-tyty.h
(struct TypeBoundPredicate::mark_is_error): New.
(TypeBoundPredicate::TypeBoundPredicate):
Add new error constructor.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-backend.h:
(Backend::wchar_type): Make non-virtual.
(Backend::get_pointer_size): Likewise.
(Backend::raw_str_type): Likewise.
(Backend::integer_type): Likewise.
(Backend::float_type): Likewise.
(Backend::complex_type): Likewise.
(Backend::pointer_type): Likewise.
(Backend::reference_type): Likewise.
(Backend::immutable_type): Likewise.
(Backend::function_type): Likewise.
(Backend::function_type_varadic): Likewise.
(Backend::function_ptr_type): Likewise.
(Backend::struct_type): Likewise.
(Backend::union_type): Likewise.
(Backend::array_type): Likewise.
(Backend::named_type): Likewise.
(Backend::type_size): Likewise.
(Backend::type_alignment): Likewise.
(Backend::type_field_alignment): Likewise.
(Backend::type_field_offset): Likewise.
(Gcc_backend::wchar_type): Remove.
(Gcc_backend::get_pointer_size): Remove.
(Gcc_backend::raw_str_type): Remove.
(Gcc_backend::integer_type): Remove.
(Gcc_backend::float_type): Remove.
(Gcc_backend::complex_type): Remove.
(Gcc_backend::pointer_type): Remove.
(Gcc_backend::reference_type): Remove.
(Gcc_backend::immutable_type): Remove.
(Gcc_backend::function_type): Remove.
(Gcc_backend::function_type_varadic): Remove.
(Gcc_backend::function_ptr_type): Remove.
(Gcc_backend::struct_type): Remove.
(Gcc_backend::union_type): Remove.
(Gcc_backend::array_type): Remove.
(Gcc_backend::named_type): Remove.
(Gcc_backend::type_size): Remove.
(Gcc_backend::type_alignment): Remove.
(Gcc_backend::type_field_alignment): Remove.
(Gcc_backend::type_field_offset): Remove.
(Gcc_backend::fill_in_fields): Move to ...
(Backend::fill_in_fields): ... here.
(Gcc_backend::fill_in_array): Move to ...
(Backend::fill_in_array): ... here.
* rust-gcc.cc
(Gcc_backend::wchar_type): Rename to ...
(Backend::wchar_type): ... here.
(Gcc_backend::get_pointer_size): Rename to ...
(Backend::get_pointer_size): ... here.
(Gcc_backend::raw_str_type): Rename to ...
(Backend::raw_str_type): ... here.
(Gcc_backend::integer_type): Rename to ...
(Backend::integer_type): ... here.
(Gcc_backend::float_type): Rename to ...
(Backend::float_type): ... here.
(Gcc_backend::complex_type): Rename to ...
(Backend::complex_type): ... here.
(Gcc_backend::pointer_type): Rename to ...
(Backend::pointer_type): ... here.
(Gcc_backend::reference_type): Rename to ...
(Backend::reference_type): ... here.
(Gcc_backend::immutable_type): Rename to ...
(Backend::immutable_type): ... here.
(Gcc_backend::function_type): Rename to ...
(Backend::function_type): ... here.
(Gcc_backend::function_type_varadic): Rename to ...
(Backend::function_type_varadic): ... here.
(Gcc_backend::function_ptr_type): Rename to ...
(Backend::function_ptr_type): ... here.
(Gcc_backend::struct_type): Rename to ...
(Backend::struct_type): ... here.
(Gcc_backend::union_type): Rename to ...
(Backend::union_type): ... here.
(Gcc_backend::fill_in_fields): Rename to ...
(Backend::fill_in_fields): ... here.
(Gcc_backend::array_type): Rename to ...
(Backend::array_type): ... here.
(Gcc_backend::fill_in_array): Rename to ...
(Backend::fill_in_array): ... here.
(Gcc_backend::named_type): Rename to ...
(Backend::named_type): ... here.
(Gcc_backend::type_size): Rename to ...
(Backend::type_size): ... here.
(Gcc_backend::type_alignment): Rename to ...
(Backend::type_alignment): ... here.
(Gcc_backend::type_field_alignment): Rename to ...
(Backend::type_field_alignment): ... here.
(Gcc_backend::type_field_offset): Rename to ...
(Backend::type_field_offset): ... here.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-intrinsic.cc (move_val_init_handler): mark as side-effects
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-intrinsic.cc (uninit_handler): Update fndecl attributes
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-intrinsic.cc (op_with_overflow_inner): fix use before init
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-intrinsic.cc (enter_intrinsic_block): take the locals vector
(uninit_handler): make a temp variable and use the address of it
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc (Early::visit):
Collect error instead of lambda.
* resolve/rust-early-name-resolver-2.0.h (std::function<void):
Remove type alias.
* rust-diagnostics.h: Change collection type.
* rust-session-manager.cc (Session::expansion): Change
collection container.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* resolve/rust-early-name-resolver-2.0.cc (Early::visit):
Collect error instead of emitting it. Also add invocation
registration.
* resolve/rust-early-name-resolver-2.0.h (std::function<void):
Add type definition for collection.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Register macro rule definition in mappings.
* rust-session-manager.cc (Session::expansion): Add macro
resolve error collection.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* config-lang.in:
Add "backend/rust-tree.h" and "backend/rust-tree.h" to gtfiles.
* backend/rust-tree.cc: Include new header generated by gengtype.
* backend/rust-tree.h
(struct language_function): Add TODO.
* rust-lang.cc:
Include "rust-tree.h".
(struct lang_type): Remove duplicate definition.
(struct lang_decl): Likewise.
(struct lang_identifier): Likewise.
(struct language_function): Likewise.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
Added error code and rich location.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-tree.h
(struct rust_cp_class_binding): Fork from gcc/cp/name_lookup.h.
(struct rust_cp_binding_level): Likewise.
(struct named_label_entry): Remove declaration...
(struct rust_named_label_entry): ... and fork definition from gcc/cp/decl.cc.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* rust-diagnostics.cc (rust_be_error_at): Added overload function.
(rust_error_at): non-const `rich_location *` function.
* rust-diagnostics.h (rust_error_at): Implementation of overloaded
function.
(rust_be_error_at): likewise.
* rust_error_codes.def: Added GNU license.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-tyty.cc (BaseType::satisfies_bound):
Added errorcode and user-friendly error message.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-tree.cc
(resort_data): Fork from c++ frontend.
(resort_member_name_cmp): Likewise.
(resort_type_member_vec): Likewise.
* backend/rust-tree.h
(resort_type_member_vec): Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-tree.cc
(struct conv_type_hasher): Rename to ...
(struct rust_conv_type_hasher): ... here.
(struct cplus_array_hasher): Rename to ...
(struct rust_cplus_array_hasher): ... here.
(struct source_location_table_entry_hash): Rename to ...
(struct rust_source_location_table_entry_hash): ... here.
* backend/rust-tree.h
(struct named_decl_hash): Rename to ...
(struct rust_named_decl_hash): ... here.
(struct cxx_saved_binding): Rename to ...
(struct rust_cxx_saved_binding): ... here.
(struct named_label_hash): Rename to ...
(struct rust_named_label_hash): ... here.
(struct tree_pair_s): Rename to ...
(struct rust_tree_pair_s): ... here.
(struct tree_pair_p): Rename to ...
(struct rust_tree_pair_p): ... here.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-tree.cc
(Rust::gt_pch_nx): Move external function declaration ...
(gt_pch_nx): ... out of Rust namespace.
* backend/rust-tree.h
(OVL_FIRST): Qualify function name.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): do a final lookup
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* parse/rust-parse-impl.h (Parser::parse_generic_params):
Added more user friendly message.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-builtins.cc
(MacroBuiltin::include_str_handler): Use vector::data.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-type.cc:
Added last variant name, errorcode & rich location. for enum candidates.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-tree.h
(struct stmt_tree_s): Remove.
(typedef stmt_tree): Remove.
(c_language_function::x_stmt_tree): Remove.
(saved_scope::x_stmt_tree): Remove.
(lang_decl_fn::pending_inline_p): Remove.
(lang_decl_fn::spare): Adjust size.
(lang_decl_fn::pending_inline_info): Remove.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-constexpr.cc:
Include gt-rust-rust-constexpr.h.
(struct constexpr_call_hasher): Rename to ...
(struct rust_constexpr_call_hasher): ... here.
(struct constexpr_fundef_hasher): Rename to ...
(struct rust_constexpr_fundef_hasher): ... here.
* config-lang.in: Add rust-constexpr.cc to gtfiles.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* backend/rust-mangle.cc (v0_add_identifier): Added punycode encoding
(v0_mangle_item): Likewise.
* lex/rust-lex.cc (assert_source_content): Change type
(test_buffer_input_source): Change type
(test_file_input_source): Change type
* resolve/rust-ast-resolve-toplevel.h: fix typo
* rust-session-manager.cc (Session::load_extern_crate): fix typo
* util/rust-canonical-path.h: fix typo
* util/rust-hir-map.cc (NodeMapping::get_error): fix typo
(Mappings::Mappings): fix typo
* util/rust-mapping-common.h (UNKNOWN_CREATENUM): fix typo
(UNKNOWN_CRATENUM): Change 0 to UINT32_MAX
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait):
Updated errorcode & more userfriendly message.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit):
Added more helpful error message.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-path-probe.h:
Fixes issue & added rich location message.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Added rich location and error code.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-lex.cc (Lexer::parse_decimal_int_or_float): Only
accept digits after a dot instead of accepting any float
member.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* ast/rust-pattern.h: No need of assertion, we are handling it.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
Added check which emits error instead of using assertion.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
Added rich location and error code.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* backend/rust-compile-base.cc (HIRCompileBase::handle_inline_attribute_on_fndecl):
Added rich_location & error code.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* parse/rust-parse-impl.h (Parser::parse_trait):
added errorcode & updated error message.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* parse/rust-parse-impl.h (Parser::parse_outer_attribute):
Added errorcode & updated error function.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* rust-diagnostics.cc (va_constructor):
Added constructor for all possible cases.
(Error::Error): Updated error struct
for all possible cases.
* rust-diagnostics.h (struct Error):
Updated error struct to support error
code & rich location support.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* backend/rust-compile-base.cc (HIRCompileBase::handle_inline_attribute_on_fndecl):
Added rich_location & error code.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-diagnostics.cc: Switch from new[] to xcalloc
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* util/make-rust-unicode.py: Add type annotation
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-intrinsic.cc (check_for_cached_intrinsic):
simplify this cached intrinsic check
* backend/rust-mangle.cc (legacy_mangle_item): use new interface
* typecheck/rust-tyty.h: new managle helper
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address):
use the single candidate
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* hir/rust-hir-dump.cc (Dump::visit): Remove useless if/else
already handled by visit_field.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* util/rust-punycode.cc: Add CHECKING_P guard.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* backend/rust-mangle.cc (legacy_mangle_name): Use Unicode escape
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): remove hack
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-proc-macro-invoc-lexer.cc
(ProcMacroInvocLexer::skip_token): Remove.
* expand/rust-proc-macro-invoc-lexer.h:
Include "rust-macro-invoc-lexer.h".
(class ProcMacroInvocLexer):
Extend MacroInvocLexerBase.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* lex/rust-codepoint.h: Moved to...
* util/rust-codepoint.h: ...here.
* lex/rust-input-source.h: Add missing license
* util/rust-unicode.cc: Add missing license
* util/rust-punycode.cc (extract_basic_string): Remove constant
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-expand.h: Keep optional references for last_def
and last_invoc.
* expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Store
optional references.
* rust-session-manager.cc (Session::expansion): Use tl::optional's APIs
for better checking.
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* hir/rust-hir-dump.h (do_ifexpr): New.
* hir/rust-hir-dump.cc (Dump::do_ifexpr): New.
(Dump::visit): Use do_ifexpr and visit_field
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-casts.cc (TypeCastRules::emit_cast_error):
Refactored ErrorCodes & error messages.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* backend/rust-compile-base.cc:
Added ErrorCode.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_qualifiers):
called error function.
(ASTLoweringBase::lower_extern_block): likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-collector.cc: Adjust formatting.
* checks/errors/rust-feature-gate.cc: Add trailing newline.
* rust-diagnostics.h: Remove old comment.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-gcc.cc
(Gcc_backend::struct_type): Remove references to "this".
(Gcc_backend::union_type): Likewise.
(Gcc_backend::array_type): Likewise.
(Gcc_backend::wchar_constant_expression): Likewise.
(Gcc_backend::convert_expression): Likewise.
(Gcc_backend::constructor_expression): Likewise.
(Gcc_backend::array_initializer): Likewise.
(Gcc_backend::assignment_statement): Likewise.
(Gcc_backend::global_variable): Likewise.
(Gcc_backend::temporary_variable): Likewise.
(Gcc_backend::function_defer_statement): Likewise.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* Make-lang.in: Add rust-punycode.o.
* rust-lang.cc (run_rust_tests): Add selftest.
* util/rust-punycode.cc: New file.
* util/rust-punycode.h: New file.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* backend/rust-compile.cc (HIRCompileBase::verify_array_capacities):
Added ErrorCode.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check.cc (TypeResolution::Resolve):
added errorcode.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-backend.h
(Backend::error_variable): Remove.
(Gcc_backend::error_variable): Move to ...
* rust-gcc.cc
(Bvariable::error_variable): ... here ...
* rust-gcc.h
(Bvariable::error_variable): ... and declare here.
(Gcc_backend::global_variable): Update error_variable call.
(Gcc_backend::local_variable): Likewise.
(Gcc_backend::parameter_variable): Likewise.
(Gcc_backend::static_chain_variable): Likewise.
(Gcc_backend::temporary_variable): Likewise.
* backend/rust-compile-extern.h
(CompileExternItem::visit): Likewise.
* backend/rust-compile-fnparam.cc
(CompileFnParam::CompileFnParam): Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-type.cc
(TyTyResolveCompile::visit): Inline Backend::bool_type call.
* rust-backend.h
(Backend::bool_type): Remove.
(Backend::char_type): Remove.
(Gcc_backend::bool_type): Remove.
(Gcc_backend::char_type): Remove.
* rust-gcc.cc
(Gcc_backend::char_constant_expression): Inline Backend::char_type call.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* lex/rust-lex.cc (assert_source_content): Fix namespace specifier
(test_buffer_input_source): Likewise.
(test_file_input_source): Likewise.
* lex/rust-lex.h: Move InputSource ...
* lex/rust-input-source.h: ... to here. (New file)
* lex/rust-token.cc (nfc_normalize_token_string): New function
* lex/rust-token.h (nfc_normalize_token_string): New function
* rust-lang.cc (run_rust_tests): Modify order of selftests.
* rust-session-manager.cc (validate_crate_name): Modify interface of Utf8String.
* util/rust-unicode.cc (lookup_cc): Modify codepoint_t typedef.
(lookup_recomp): Likewise.
(recursive_decomp_cano): Likewise.
(decomp_cano): Likewise.
(sort_cano): Likewise.
(compose_hangul): Likewise.
(assert_normalize): Likewise.
(Utf8String::nfc_normalize): New function.
* util/rust-unicode.h: Modify interface of Utf8String.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go):
Added ErrorCode.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-common.h (enum_to_str): Remove extra semicolon after
the function.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* checks/errors/rust-const-checker.cc (ConstChecker::visit):
Use of mutable reference in constant functions.
* checks/errors/rust-feature-gate.cc (FeatureGate::gate):
ErrorCode for intrinsics are subject to change.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* checks/errors/rust-const-checker.cc (ConstChecker::check_function_call):
Added errorcode.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args):
Added errorcode.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Declare
macros in the current rib if they are macros 2.0.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-macro.h: Add new method to `MacroRulesDefinition` to allow
getting the `MacroKind` contained.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-session-manager.cc
(Session::expansion): Use new `Early` name resolution 2.0 pass
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Add new object file.
* resolve/rust-early-name-resolver-2.0.cc: New file.
* resolve/rust-early-name-resolver-2.0.h: New file.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-default-resolver.cc
(DefaultResolver::visit): Visit CallExpr and MethodCallExpr properly.
* resolve/rust-default-resolver.h: Switch "node" to plural in documentation.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::insert_or_error_out): Fix format string.
(is_macro_export): New method.
(TopLevel::visit): Handle macro definitions.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-name-resolution-context.cc
(Resolver::insert): Do not call into `rust_unreachable` when resolving
macros anymore.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-forever-stack.h
(insert_at_root): New method.
(resolve_path): New method.
(reverse_iter): Iterate on `Node`s instead of `Rib`s
* resolve/rust-forever-stack.hxx: Add path resolution.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-rib.h: Add shadowing parameter. Make kind field public.
* resolve/rust-rib.cc (Rib::insert): Likewise.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit):
refactored message and called error function.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* checks/errors/rust-feature-gate.cc (FeatureGate::check):
errorcode support for unknown feature.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-unify.cc (UnifyRules::emit_type_mismatch):
refactored & called error function.
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* expand/rust-macro-builtins.cc
(load_file_bytes): Return a tl::optional.
(MacroBuiltin::include_byte_handler): Adjust and check file was
correctly opened.
(MacroBuiltin::include_str_handler): Likewise.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-toplevel-name-resolver-2.0.h
(class TopLevel): Inherit from DefaultResolver
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::TopLevel): Remove unecessary methods
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Add new object file.
* resolve/rust-default-resolver.cc: New file.
* resolve/rust-default-resolver.h: New file.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* util/rust-unicode.cc (decomp_cano): Decompose Hangul.
(sort_cano): Fix bounds check.
(recomp): use `compose_hangul`.
(compose_hangul): Compose Hangul.
(rust_utf8_normalize_test): Add tests.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-forever-stack.hxx: assert() -> rust_assert()
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Add new object file.
* resolve/rust-toplevel-name-resolver-2.0.cc: New file.
* resolve/rust-toplevel-name-resolver-2.0.h: New file.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Add new object file.
* resolve/rust-name-resolution-context.cc: New file.
* resolve/rust-name-resolution-context.h: New file.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
called error function.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-invoc-lexer.cc
(MacroInvocLexer::skip_token): Remove.
* expand/rust-macro-invoc-lexer.h
(class MacroInvocLexer): Extend MacroInvocLexerBase.
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* ast/rust-ast-fragment.cc (Fragment::create_empty): New.
* ast/rust-ast-fragment.h (MacroTranscriberFunc): New.
* ast/rust-macro.h (MacroRulesDefinition): Use MacroTranscriberFunc.
* expand/rust-macro-builtins.cc
(MacroBuiltin::builtin_transcribers): likewise.
(MacroBuiltin::assert_handler): Return optional.
(MacroBuiltin::file_handler): Likewise.
(MacroBuiltin::column_handler): Likewise.
(MacroBuiltin::include_bytes_handler): Likewise.
(MacroBuiltin::include_str_handler): Likewise.
(MacroBuiltin::compile_error_handler): Likewise.
(MacroBuiltin::concat_handler): Likewise.
(MacroBuiltin::env_handler): Likewise.
(MacroBuiltin::cfg_handler): Likewise.
(MacroBuiltin::include_handler): Likewise.
(MacroBuiltin::line_handler): Likewise.
(MacroBuiltin::stringify_handler): Likewise.
(MacroBuiltin::sorry): Likewise.
* expand/rust-macro-builtins.h (builtin_transcribers): Use
MacroTranscriberFunc.
(assert_handler): Return optional.
(file_handler): Likewise.
(column_handler): Likewise.
(include_bytes_handler): Likewise.
(include_str_handler): Likewise.
(compile_error_handler): Likewise.
(concat_handler): Likewise.
(env_handler): Likewise.
(cfg_handler): Likewise.
(include_handler): Likewise.
(line_handler): Likewise.
(stringify_handler): Likewise.
(sorry): Likewise.
* expand/rust-macro-expand.cc (MacroExpander::expand_invoc):
Adjust to transcribers returning optional.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
always resolve the type even when its an a mandatory trait item
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
Add check for enum candidates otherwise you get undefined behaviour
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* lex/rust-codepoint.h: Add comment
* lex/rust-lex.h: New method to get decoded characters
* rust-session-manager.cc (validate_crate_name): Modify unicode check
(rust_crate_name_validation_test): Add testcases
* util/rust-unicode.h (RUST_UNICODE_H): New class Utf8String.
(class Utf8String): New class.
* util/rust-unicode.cc (binary_search_sorted_array): Add comment.
(recursive_decomp_cano): Add comment.
(recomp): Remove dead code.
(dump_string): Removed.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* util/rust-unicode.cc: Add CHECKING_P guard.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
We need to check if a function context exists
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor
(tokenstream_from_string): likewise
* lex/rust-lex.cc (Lexer::Lexer): likewise
* lex/rust-lex.h: pass through Linemap
* parse/rust-cfg-parser.cc (parse_cfg_option): likewise
* rust-session-manager.cc (Session::load_extern_crate): likewise
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait):
dont apply Sized on self
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new
* typecheck/rust-hir-type-check-base.h: add prototype
* typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized
(TypeResolveGenericParam::visit): likewise
* typecheck/rust-hir-type-check-type.h: update prototypes
* typecheck/rust-typecheck-context.cc: remove bad assertions
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup
(TypeCheckBase::get_predicate_from_bound): apply sized rules properly
* util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers
(Mappings::get_lang_item): likewise
* util/rust-hir-map.h: likewise
* util/rust-token-converter.cc (from_ident): update lexer ctor
(from_punct): likewise
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-path-probe.cc: track regular polarity
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): likewise
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): likewise
* typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound): likewise
(TypeBoundPredicate::TypeBoundPredicate): update ctor
(TypeBoundPredicate::operator=): update copy assignment ctor
(TypeBoundPredicate::error): update error node
* typecheck/rust-tyty.h: add polarity field to predicate
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): use new BoundPolarity enum
* hir/rust-ast-lower-type.cc (ASTLoweringTypeBounds::visit): likewise
* hir/rust-hir-dump.cc (BoundPolarityString): new helper
(Dump::visit): update hir dump
* hir/tree/rust-hir-item.h (class ImplBlock): likewise
* hir/tree/rust-hir-type.h (class TraitBound): likewise
* hir/tree/rust-hir.cc (TraitBound::as_string): fix as string
* util/rust-common.h (enum Polarity): add new anti bound
(enum BoundPolarity): likewise
* util/rust-hir-map.cc (Mappings::Mappings): update naming
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-backend.h: Include "rust-gcc.h".
(class Gcc_backend): Move to ...
* rust-gcc.cc (class Gcc_backend): ... here.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-item.cc: add is_error check
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* Make-lang.in: Add rust-unicode.o
* rust-lang.cc (run_rust_tests): Add test.
* rust-system.h: Include <array>
* util/make-rust-unicode.py: Generater of rust-unicode-data.h.
* util/rust-unicode-data.h: Auto-generated file.
* util/rust-unicode.cc: New file.
* util/rust-unicode.h: New file.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-diagnostics.cc: Rework `make_description` and `make_url` functions.
* rust-diagnostics.h: Specify ErrorCode's underlying type,
remove error_codes_strings table.
* rust_error_codes.def: New file.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-location.h (typedef Location): Remove.
* expand/rust-proc-macro.cc
(register_callback): Replace Location constructor with UNDEF_LOCATION.
* ast/rust-ast-collector.h: Replace Location with location_t.
* checks/errors/privacy/rust-privacy-reporter.cc: Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* checks/errors/privacy/rust-pub-restricted-visitor.cc: Likewise.
* checks/errors/privacy/rust-pub-restricted-visitor.h: Likewise.
* checks/errors/rust-feature-gate.cc: Likewise.
* checks/errors/rust-feature-gate.h: Likewise.
* metadata/rust-imports.h: Likewise.
* resolve/rust-ast-resolve-path.h: Likewise.
* resolve/rust-name-resolver.h: Likewise.
* rust-backend.h: Likewise.
* rust-diagnostics.h: Likewise.
* rust-gcc.cc: Likewise.
* rust-linemap.h: Likewise.
* util/rust-attributes.cc: Likewise.
* util/rust-hir-map.cc: Likewise.
* util/rust-hir-map.h: Likewise.
* util/rust-token-converter.cc: Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-autoderef.cc: Replace Location with location_t.
* typecheck/rust-coercion.cc: Likewise.
* typecheck/rust-coercion.h: Likewise.
* typecheck/rust-hir-path-probe.h: Likewise.
* typecheck/rust-hir-trait-reference.cc: Likewise.
* typecheck/rust-hir-trait-resolve.cc: Likewise.
* typecheck/rust-hir-type-check-base.cc: Likewise.
* typecheck/rust-hir-type-check-expr.cc: Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* typecheck/rust-hir-type-check-implitem.cc: Likewise.
* typecheck/rust-hir-type-check-item.cc: Likewise.
* typecheck/rust-hir-type-check-path.cc: Likewise.
* typecheck/rust-hir-type-check-pattern.cc: Likewise.
* typecheck/rust-hir-type-check-stmt.cc: Likewise.
* typecheck/rust-hir-type-check-struct.cc: Likewise.
* typecheck/rust-hir-type-check-type.cc: Likewise.
* typecheck/rust-hir-type-check-type.h: Likewise.
* typecheck/rust-type-util.cc: Likewise.
* typecheck/rust-type-util.h: Likewise.
* typecheck/rust-tyty-bounds.cc: Likewise.
* typecheck/rust-tyty-call.cc: Likewise.
* typecheck/rust-tyty-call.h: Likewise.
* typecheck/rust-tyty-cmp.h: Likewise.
* typecheck/rust-tyty-subst.cc: Likewise.
* typecheck/rust-tyty-subst.h: Likewise.
* typecheck/rust-tyty.cc: Likewise.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
refactored error message & called error function.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-proc-macro.cc (literal_from_string): Add callback
function.
(load_macros_array): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (handle_suffix): Rework function
to make it work with the new literal conversion function.
(convert_literal): Add a new function to convert to a proc macro
literal from a literal tokenptr. The function will abort if the
pointer does not point to a literal.
(convert): Add call to convert literal for every literal case.
* util/rust-token-converter.h (convert_literal): Add public
prototype.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-proc-macro.cc: Remove static modifier and move to
an anonymous namespace.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* backend/rust-compile-intrinsic.cc (Intrinsics::compile):
Formatted according to enum class.
* checks/errors/rust-feature-gate.cc (FeatureGate::gate): likewise.
* checks/errors/rust-unsafe-checker.cc (check_unsafe_call): likewise.
* hir/rust-ast-lower-base.cc (struct_field_name_exists): likewise.
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path):
likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::go): likewise.
(PatternDeclaration::add_new_binding): likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): likewise.
* resolve/rust-ast-verify-assignee.h: likewise.
* rust-diagnostics.cc: updated make_desc & url function for enum class.
* rust-diagnostics.h (struct ErrorCode): removed struct to switch to enum.
(enum class): Switched from errorcode struct to enum class.
(XSTR): Macro for converting enum to string.
(STR): macro Used by XSTR for converting to string.
(ERROR_CODE): macro used by map for check.
(TABLE_TO_MAP): macro used by map for check
* typecheck/rust-casts.cc (TypeCastRules::emit_cast_error):
Formatted according to enum class.
* typecheck/rust-hir-path-probe.h: likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit):
likewise.
(TypeCheckImplItemWithTrait::visit): likewise.
* typecheck/rust-hir-type-check-item.cc: likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): likewise.
(emit_invalid_field_error): likewise.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve): likewise.
* typecheck/rust-tyty-call.cc (emit_unexpected_argument_error): likewise.
(TypeCheckCallExpr::visit): likewise.
* typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args):
likewise.
* typecheck/rust-tyty.cc (BaseType::bounds_compatible): likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-attributes.cc (check_proc_macro_non_root): Add
function to emit this specific error.
(AttributeChecker::visit): Modify visitor to propagate to some
containers that were not handled correctly.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-base.h: Replace Location with location_t.
* metadata/rust-imports.h: Likewise.
* resolve/rust-name-resolver.cc: Likewise.
* resolve/rust-name-resolver.h: Likewise.
* rust-backend.h: Likewise.
* rust-gcc.cc: Likewise.
* rust-gcc.h: Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-proc-macro.cc (available): Remove function.
(load_macros_array): There was no need for an indirection here.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-proc-macro.cc (available): Add symbol
registration.
(load_macros_array): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-proc-macro.cc (load_macros_array): Symbol rename.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/privacy/rust-privacy-reporter.cc (find_proc_macro_attribute):
Refactor the function to be safer and more efficient.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/privacy/rust-privacy-reporter.cc (find_proc_macro_attribute):
Add a new function to find a potential proc macro type
attribute on a given item.
(proc_macro_privacy_check): Move all proc macro privacy check in
their own function to avoid cluttering the usual privacy check.
(PrivacyReporter::go): Add call to newly created proc macro
privacy check function.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::go):
Add visibility verification.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-attributes.cc (is_proc_macro_type): Add function to
identify matching proc macro attribute type.
(check_proc_macro_non_function): Add function to check and emit
error.
(AttributeChecker::visit): Add cal to new check function.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h: Remove NodeId from identifiers.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit):
Added check for error code support.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItemWithTrait::visit):
called error function.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-base.cc: Replace Location with location_t.
* backend/rust-compile-base.h: Likewise.
* backend/rust-compile-expr.cc: Likewise.
* lex/rust-token.h: Likewise.
* metadata/rust-import-archive.cc: Likewise.
* metadata/rust-imports.cc: Likewise.
* metadata/rust-imports.h: Likewise.
* rust-backend.h: Likewise.
* rust-diagnostics.cc: Likewise.
* rust-diagnostics.h: Likewise.
* rust-gcc.cc: Likewise.
* rust-linemap.cc: Likewise.
* util/rust-token-converter.cc: Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-builder.h: Replace Location with location_t.
* ast/rust-ast.h: Likewise.
* ast/rust-expr.h: Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.h: Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
* hir/tree/rust-hir-item.h: Likewise.
* hir/tree/rust-hir-path.h: Likewise.
* hir/tree/rust-hir.h: Likewise.
* lex/rust-lex.cc: Likewise.
* lex/rust-lex.h: Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-derive-clone.cc: Replace Location with location_t.
* expand/rust-derive-clone.h: Likewise.
* expand/rust-derive-copy.cc: Likewise.
* expand/rust-derive-copy.h: Likewise.
* expand/rust-derive.cc: Likewise.
* expand/rust-derive.h: Likewise.
* expand/rust-macro-builtins.cc: Likewise.
* expand/rust-macro-builtins.h: Likewise.
* expand/rust-macro-expand.cc: Likewise.
* parse/rust-parse-impl.h: Likewise.
* parse/rust-parse.cc: Likewise.
* parse/rust-parse.h: Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* parse/rust-parse-impl.h
(Parser::parse_macro_match): Use token_id_is_keyword.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h (class Identifier): Remove interface
inheritance.
(class SimplePath): Likewise.
* expand/rust-expand-visitor.cc (get_traits_to_derive): Change
return type.
(derive_item): Update according to get_traits_to_derive return
type.
(expand_item_attribute): Likewise.
(ExpandVisitor::expand_inner_stmts): Likewise.
* expand/rust-macro-expand.h (struct MacroExpander): Likewise.
* util/rust-hir-map.cc (Mappings::insert_derive_proc_macro_invocation):
Change input type to SimplePath.
(Mappings::lookup_derive_proc_macro_invocation): Likewise.
(Mappings::insert_attribute_proc_macro_invocation): Likewise.
(Mappings::lookup_attribute_proc_macro_invocation): Likewise.
* util/rust-hir-map.h: Likewise with function prototypes.
* util/rust-proc-macro-invocation.h: Removed.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h: Add new constructor for SimplePath from an
identifier.
* expand/rust-expand-visitor.cc (get_traits_to_derive): Add
conversion.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-macro-expand.cc (MacroExpander::import_proc_macros):
Remove function.
* expand/rust-macro-expand.h (struct MacroExpander): Remove
import_proc_macro function.
* util/rust-hir-map.cc (Mappings::insert_derive_proc_macro_def):
Add a function to insert a derive proc macro definition.
(Mappings::insert_bang_proc_macro): Remove function.
(Mappings::insert_bang_proc_macro_def): Add function to insert a
bang proc macro definition.
(Mappings::insert_attribute_proc_macro_def): Likewise with
attribute proc macros.
(Mappings::lookup_derive_proc_macro_def): Add a function to
lookup a defined derive proc macro definition.
(Mappings::lookup_bang_proc_macro): Remove function.
(Mappings::lookup_bang_proc_macro_def): Add a function to lookup
a bang proc macro definition.
(Mappings::lookup_attribute_proc_macro_def): Add a function to
lookup an attribute prod macro definition.
(Mappings::insert_derive_proc_macro_invocation): Add a function
to insert a derive proc macro invocation.
(Mappings::lookup_derive_proc_macro_invocation): Add a function
to lookup a derive proc macro invocation.
(Mappings::insert_bang_proc_macro_invocation): Add a function to
insert a bang proc macro invocation.
(Mappings::lookup_bang_proc_macro_invocation): Add a function to
lookup a bang proc macro invocation.
(Mappings::insert_attribute_proc_macro_invocation): Add a
function to insert an attribute proc macro invocation.
(Mappings::lookup_attribute_proc_macro_invocation): Add a
function to lookup an attribute proc macro invocation.
* util/rust-hir-map.h: Add different proc macro mappings
and change function prototypes.
* expand/rust-expand-visitor.cc (get_traits_to_derive): Return a
vector of SimplePath instead.
(derive_item): Accept SimplePath instead of a string.
* ast/rust-ast.h: Add common ProcMacroInvocable interface to
Identifiers and SimplePath nodes.
* ast/rust-ast.cc: Add const modifier.
* ast/rust-macro.h: Change path and identifier getters.
* ast/rust-path.h: Change return type to reference.
* util/rust-proc-macro-invocation.h: New file.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-attributes.h (RUST_ATTRIBUTES_H): Add missing header
guard.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h (class MetaItem): Add MetaItem dispatch values.
* ast/rust-expr.h: Add LitExpr and PathLit dispatch.
* ast/rust-macro.h: Add remaining dispatch getters.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* metadata/rust-extern-crate.h: Add proc macro getter.
* rust-session-manager.cc (Session::load_extern_crate): Collect
mappings and create mappings.
* util/rust-hir-map.cc: Add insertion and lookup functions for
every mapping.
* util/rust-hir-map.h: Add function prototypes.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* metadata/rust-imports.cc (Import::try_package_in_directory):
Add call to load macros before loading metadatas.
* expand/rust-proc-macro.cc: Return empty vector instead of
panicking on error.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* metadata/rust-import-archive.cc (Stream_concatenate::do_peek):
Remove deletion.
(Stream_concatenate::do_advance): Likewise.
(Import::find_archive_export_data): Replace with a smart
pointer.
* metadata/rust-imports.cc (add_search_path): Change return type
to smart pointer.
(Import::open_package): Likewise.
(Import::try_package_in_directory): Likewise.
(Import::find_export_data): Likewise.
(Import::find_object_export_data): Likewise.
(Import::Import): Change constructor to accept unique_ptr.
* metadata/rust-imports.h: Change constructor prototype.
* rust-session-manager.cc (Session::load_extern_crate): Change
pointer to smart pointer.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* metadata/rust-extern-crate.cc (ExternCrate::ExternCrate):
Change constructor to accept procedural macro vector.
* metadata/rust-extern-crate.h: Add vector of procecural macro
in extern crate.
* rust-session-manager.cc (Session::load_extern_crate): Add
argument to new constructor call.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* metadata/rust-imports.cc (add_search_path): Change prototype,
now return a pair of Stream and procedural macro vector.
(Import::open_package): Likewise.
(Import::try_package_in_directory): Likewise.
* metadata/rust-imports.h: Likewise.
* rust-session-manager.cc (Session::load_extern_crate):
Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* metadata/rust-imports.h: Make the function to load a given
file public.
* rust-session-manager.cc (Session::load_extern_crate): Change
path resolution depending on extern crate declaration in cli
arguments.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-collector.h
(TokenCollector::visit):
Replace default argument with UNDEF_LOCATION.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-base.cc: Replace Location with location_t.
* backend/rust-compile-base.h: Likewise.
* backend/rust-compile-block.cc: Likewise.
* backend/rust-compile-expr.cc: Likewise.
* backend/rust-compile-expr.h: Likewise.
* backend/rust-compile-extern.h: Likewise.
* backend/rust-compile-implitem.h: Likewise.
* backend/rust-compile-intrinsic.cc: Likewise.
* backend/rust-compile-item.h: Likewise.
* backend/rust-compile-pattern.h: Likewise.
* backend/rust-compile-resolve-path.cc: Likewise.
* backend/rust-compile-stmt.cc: Likewise.
* backend/rust-compile-type.cc: Likewise.
* backend/rust-compile.cc: Likewise.
* backend/rust-constexpr.cc: Likewise.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
refactored and call error function.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-attributes.cc (AttributeChecker::visit): Add help
message.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-attributes.cc (AttributeChecker::visit): Add
attribute input check.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-attributes.cc (AttributeChecker::visit): Add
attribute check on functions.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (from_ident): Adapt code to new
constructor.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-proc-macro.cc (tokenstream_from_string): Add a
function that creates a tokenstream from a given string.
(load_macros_array): Add call to registration function.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lang.opt: Add option
* rust-session-manager.cc: Add option registration in session
target options.
* rust-session-manager.h (struct CompileOptions): Add new getter
for proc macros instead of a boolean.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-forever-stack.h: New file.
* resolve/rust-forever-stack.hxx: New file.
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* hir/rust-hir-dump.cc (convert_param_kind_to_str): New.
(convert_new_bind_type_to_str): New.
(convert_mut_to_str): New.
(Dump::go): New.
(Dump::put): New.
(Dump::begin): New.
(Dump::end): New.
(Dump::begin_field): New.
(Dump::end_field): New.
(Dump::put_field): New.
(Dump::visit_field): New.
(Dump::visit): Refactor.
(Dump::visit_collection): New.
(Dump::do_traititem): New.
(Dump::do_vis_item): New.
(Dump::do_functionparam): New.
(Dump::do_pathpattern): New.
(Dump::do_structexprstruct): New.
(Dump::do_expr): New.
(Dump::do_pathexpr): New.
(Dump::do_typepathsegment): New.
(Dump::do_typepathfunction): New.
(Dump::do_qualifiedpathtype): New.
(Dump::do_operatorexpr): New.
(Dump::do_mappings): New.
(Dump::do_inner_attrs): New.
(Dump::do_outer_attrs): New.
(Dump::do_baseloopexpr): New.
(Dump::do_ifletexpr): New.
(Dump::do_struct): New.
(Dump::do_enumitem): New.
(Dump::do_traitfunctiondecl): New.
(Dump::do_externalitem): New.
(Dump::do_namefunctionparam): New.
(Dump::do_stmt): New.
(Dump::do_type): New.
(Dump::do_item): New.
(Dump::do_tuplefield): New.
(Dump::do_structfield): New.
(Dump::do_genericargs): New.
(Dump::do_maybenamedparam): New.
* hir/rust-hir-dump.h: Refactor.
* hir/tree/rust-hir-item.h (enum_to_str): New.
* hir/tree/rust-hir-type.h (enum_to_str): New.
* hir/tree/rust-hir.cc (enum_to_str): New.
* util/rust-common.h (enum_to_str): New.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
Matthew Jasper <mjjasper1@gmail.com>
* Make-lang.in: Add `rust-rib.cc` object.
* resolve/rust-rib.cc: New file.
* resolve/rust-rib.h: New file.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast.h: Replace Location with location_t.
* ast/rust-expr.h: Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.h: Likewise.
* ast/rust-pattern.h: Likewise.
* ast/rust-stmt.h: Likewise.
* ast/rust-type.h: Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
* hir/tree/rust-hir-item.h: Likewise.
* hir/tree/rust-hir-path.h: Likewise.
* hir/tree/rust-hir-pattern.h: Likewise.
* hir/tree/rust-hir-stmt.h: Likewise.
* hir/tree/rust-hir-type.h: Likewise.
* hir/tree/rust-hir.h: Likewise.
* lex/rust-token.h: Likewise.
* resolve/rust-ast-resolve-pattern.h: Likewise.
* typecheck/rust-hir-trait-reference.h: Likewise.
* typecheck/rust-tyty-bounds.h: Likewise.
* typecheck/rust-tyty-call.h: Likewise.
* typecheck/rust-tyty-subst.h: Likewise.
* typecheck/rust-tyty-util.h: Likewise.
* typecheck/rust-tyty.h: Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-collector.cc: Replace Location with location_t.
* ast/rust-ast.cc: Likewise.
* ast/rust-ast.h: Likewise.
* ast/rust-expr.h: Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.cc: Likewise.
* ast/rust-path.h: Likewise.
* ast/rust-pattern.h: Likewise.
* ast/rust-stmt.h: Likewise.
* ast/rust-type.h: Likewise.
* backend/rust-compile-base.cc: Likewise.
* backend/rust-compile-base.h: Likewise.
* backend/rust-compile-block.cc: Likewise.
* backend/rust-compile-expr.cc: Likewise.
* backend/rust-compile-expr.h: Likewise.
* backend/rust-compile-fnparam.cc: Likewise.
* backend/rust-compile-fnparam.h: Likewise.
* backend/rust-compile-intrinsic.cc: Likewise.
* backend/rust-compile-pattern.cc: Likewise.
* backend/rust-compile-resolve-path.h: Likewise.
* backend/rust-compile.cc: Likewise.
* checks/errors/rust-const-checker.cc: Likewise.
* checks/errors/rust-const-checker.h: Likewise.
* checks/errors/rust-unsafe-checker.cc: Likewise.
* checks/errors/rust-unsafe-checker.h: Likewise.
* expand/rust-macro-builtins.cc: Likewise.
* expand/rust-macro-expand.h: Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-implitem.h: Likewise.
* hir/rust-ast-lower-item.cc: Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
* hir/tree/rust-hir-item.h: Likewise.
* hir/tree/rust-hir-path.h: Likewise.
* hir/tree/rust-hir-pattern.h: Likewise.
* hir/tree/rust-hir-stmt.h: Likewise.
* hir/tree/rust-hir-type.h: Likewise.
* hir/tree/rust-hir.cc: Likewise.
* hir/tree/rust-hir.h: Likewise.
* lex/rust-token.h: Likewise.
* metadata/rust-extern-crate.cc: Likewise.
* metadata/rust-extern-crate.h: Likewise.
* parse/rust-parse-impl.h: Likewise.
* parse/rust-parse.h: Likewise.
* resolve/rust-ast-resolve-expr.cc: Likewise.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-pattern.h: Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* resolve/rust-ast-resolve-type.h: Likewise.
* resolve/rust-name-resolver.cc: Likewise.
* resolve/rust-name-resolver.h: Likewise.
* rust-diagnostics.cc: Likewise.
* rust-diagnostics.h: Likewise.
* rust-gcc.cc: Likewise.
* rust-session-manager.cc: Likewise.
* rust-session-manager.h: Likewise.
* typecheck/rust-casts.cc: Likewise.
* typecheck/rust-casts.h: Likewise.
* typecheck/rust-coercion.cc: Likewise.
* typecheck/rust-coercion.h: Likewise.
* typecheck/rust-hir-path-probe.cc: Likewise.
* typecheck/rust-hir-path-probe.h: Likewise.
* typecheck/rust-hir-trait-reference.cc: Likewise.
* typecheck/rust-hir-trait-reference.h: Likewise.
* typecheck/rust-hir-trait-resolve.cc: Likewise.
* typecheck/rust-hir-type-check-base.cc: Likewise.
* typecheck/rust-hir-type-check-base.h: Likewise.
* typecheck/rust-hir-type-check-item.cc: Likewise.
* typecheck/rust-hir-type-check-item.h: Likewise.
* typecheck/rust-hir-type-check-path.cc: Likewise.
* typecheck/rust-hir-type-check-pattern.cc: Likewise.
* typecheck/rust-hir-type-check-pattern.h: Likewise.
* typecheck/rust-hir-type-check-type.cc: Likewise.
* typecheck/rust-hir-type-check-type.h: Likewise.
* typecheck/rust-hir-type-check.cc: Likewise.
* typecheck/rust-hir-type-check.h: Likewise.
* typecheck/rust-substitution-mapper.cc: Likewise.
* typecheck/rust-substitution-mapper.h: Likewise.
* typecheck/rust-type-util.cc: Likewise.
* typecheck/rust-typecheck-context.cc: Likewise.
* typecheck/rust-tyty-bounds.cc: Likewise.
* typecheck/rust-tyty-call.h: Likewise.
* typecheck/rust-tyty-subst.cc: Likewise.
* typecheck/rust-tyty-subst.h: Likewise.
* typecheck/rust-tyty-util.cc: Likewise.
* typecheck/rust-tyty-util.h: Likewise.
* typecheck/rust-tyty.cc: Likewise.
* typecheck/rust-tyty.h: Likewise.
* typecheck/rust-unify.cc: Likewise.
* typecheck/rust-unify.h: Likewise.
* util/rust-hir-map.cc: Likewise.
* util/rust-hir-map.h: Likewise.
* util/rust-identifier.h: Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-gcc.cc
(Gcc_backend::debug): Move out of class declaration.
(Gcc_backend::get_identifier_node): Likewise.
(Gcc_backend::wchar_type): Likewise.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit):
called error function.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-linemap.h (Linemap::predeclared_location): Remove.
* backend/rust-compile-type.cc:
Replace Linemap::predeclared_location with BUILTINS_LOCATION.
* resolve/rust-name-resolver.cc: Likewise.
* typecheck/rust-hir-type-check-type.cc: Likewise.
* typecheck/rust-tyty.cc: Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-gcc.h: Add include guard.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-system.h (rust_unreachable): Change definition to fancy_abort
* ast/rust-ast-collector.cc (TokenCollector::visit): Use rust_unreachable
instead of gcc_unreachable.
(get_delimiters): Likewise.
* ast/rust-ast-dump.h: Likewise.
* ast/rust-ast-formatting.cc (get_string_in_delims): Likewise.
(get_mode_dump_desc): Likewise.
* ast/rust-ast.cc (Visibility::as_string): Likewise.
(UseTreeGlob::as_string): Likewise.
* ast/rust-ast.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.h: Likewise.
* backend/rust-compile-expr.cc (sort_tuple_patterns): Likewise.
(CompileExpr::visit): Likewise.
(CompileExpr::generate_closure_fntype): Likewise.
* backend/rust-compile-intrinsic.cc (op_with_overflow_inner): Likewise.
* backend/rust-compile-pattern.cc (CompilePatternBindings::visit): Likewise.
(CompilePatternLet::visit): Likewise.
* backend/rust-constexpr.cc (base_field_constructor_elt): Likewise.
(eval_array_reference): Likewise.
(label_matches): Likewise.
(eval_store_expression): Likewise.
(eval_call_expression): Likewise.
(build_data_member_initialization): Likewise.
(array_index_cmp): Likewise.
(get_array_or_vector_nelts): Likewise.
(eval_bit_field_ref): Likewise.
(eval_loop_expr): Likewise.
(potential_constant_expression_1): Likewise.
* backend/rust-mangle.cc (v0_simple_type_prefix): Likewise.
(v0_type_prefix): Likewise.
(v0_mangle_item): Likewise.
(Mangler::mangle_item): Likewise.
* backend/rust-tree.cc (convert_to_void): Likewise.
(type_memfn_quals): Likewise.
(rs_tree_equal): Likewise.
(fold_offsetof): Likewise.
(fold_builtin_source_location): Likewise.
(lvalue_error): Likewise.
* backend/rust-tree.h (struct named_decl_hash): Likewise.
(struct named_label_hash): Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc
(VisibilityResolver::resolve_visibility): Likewise.
(VisibilityResolver::visit): Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::ctx_to_str): Likewise.
* checks/errors/rust-feature.cc (Feature::create): Likewise.
* expand/rust-expand-visitor.cc (get_traits_to_derive): Likewise.
(derive_item): Likewise.
(expand_item_attribute): Likewise.
(expand_stmt_attribute): Likewise.
* expand/rust-macro-expand.cc (MacroExpander::match_matcher): Likewise.
(MacroExpander::match_repetition): Likewise.
(transcribe_context): Likewise.
(MacroExpander::import_proc_macros): Likewise.
(MacroExpander::parse_proc_macro_output): Likewise.
* expand/rust-macro-expand.h: Likewise.
* expand/rust-macro-invoc-lexer.h: Likewise.
* expand/rust-macro-substitute-ctx.cc (SubstituteCtx::substitute_token): Likewise.
* expand/rust-proc-macro-invoc-lexer.h: Likewise.
* expand/rust-proc-macro.cc (load_macros): Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_generic_args): Likewise.
(ASTLoweringBase::lower_literal): Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Likewise.
* hir/rust-ast-lower-type.cc (ASTLoweringType::visit): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/tree/rust-hir.cc (get_string_in_delims): Likewise.
(Visibility::as_string): Likewise.
(UseTreeGlob::as_string): Likewise.
(CompoundAssignmentExpr::as_string): Likewise.
(ArithmeticOrLogicalExpr::as_string): Likewise.
* lex/rust-lex.cc (Lexer::parse_byte_string): Likewise.
(Lexer::parse_string): Likewise.
* lex/rust-token.cc (RS_TOKEN): Likewise.
* parse/rust-parse-impl.h (Parser::parse_simple_path_segment): Likewise.
(Parser::parse_path_ident_segment): Likewise.
(Parser::parse_attr_input): Likewise.
(Parser::parse_inherent_impl_item): Likewise.
(Parser::parse_trait_impl_item): Likewise.
(Parser::parse_type_path_segment): Likewise.
(Parser::parse_reference_type): Likewise.
(get_lbp_for_comparison_expr): Likewise.
* parse/rust-parse.cc (peculiar_fragment_match_compatible): Likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise.
(ResolveTypeToCanonicalPath::visit): Likewise.
(ResolveGenericArgs::resolve_disambiguated_generic): Likewise.
* rust-gcc.cc (operator_to_tree_code): Likewise.
(fetch_overflow_builtins): Likewise.
(Gcc_backend::non_zero_size_type): Likewise.
(Gcc_backend::convert_tree): Likewise.
* rust-lang.cc (grs_langhook_type_for_mode): Likewise.
(grs_langhook_global_bindings_p): Likewise.
(grs_langhook_pushdecl): Likewise.
(grs_langhook_getdecls): Likewise.
(convert): Likewise.
* typecheck/rust-autoderef.h: Likewise.
* typecheck/rust-hir-path-probe.cc: Likewise.
* typecheck/rust-hir-trait-reference.cc (TraitItemReference::get_tyty): Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): Likewise.
* typecheck/rust-hir-type-check-expr.cc: Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit): Likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.h: Likewise.
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): Likewise.
* typecheck/rust-substitution-mapper.h: Likewise.
* typecheck/rust-typecheck-context.cc (TypeCheckContextItem::get_context_type): Likewise.
* typecheck/rust-tyty-call.h: Likewise.
* typecheck/rust-tyty.cc (TypeKindFormat::to_string): Likewise.
(BaseType::monomorphized_clone): Likewise.
(VariantDef::variant_type_string): Likewise.
(ClosureType::handle_substitions): Likewise.
(IntType::as_string): Likewise.
(UintType::as_string): Likewise.
(FloatType::as_string): Likewise.
* typecheck/rust-unify.cc (UnifyRules::expect_projection): Likewise.
* util/rust-token-converter.cc (convert): Likewise.
(from_literal): Likewise.
(from_group): Likewise.
(from_tokentree): Likewise.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* checks/errors/rust-feature-gate.cc (FeatureGate::gate):
called error function.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* backend/rust-compile-intrinsic.cc (Intrinsics::compile):
called error function.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* checks/errors/rust-unsafe-checker.cc (check_unsafe_call):
called error function.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-location.h
(typedef RichLocation): Remove.
* expand/rust-macro-expand.cc: Replace RichLocation with rich_location.
* hir/rust-ast-lower-base.cc: Likewise.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* rust-diagnostics.cc: Likewise.
* rust-diagnostics.h: Likewise.
* rust-session-manager.cc: Likewise.
* typecheck/rust-casts.cc: Likewise.
* typecheck/rust-coercion.cc: Likewise.
* typecheck/rust-hir-inherent-impl-overlap.h: Likewise.
* typecheck/rust-hir-path-probe.h: Likewise.
* typecheck/rust-hir-trait-reference.cc: Likewise.
* typecheck/rust-hir-type-check-expr.cc: Likewise.
* typecheck/rust-hir-type-check-implitem.cc: Likewise.
* typecheck/rust-hir-type-check-item.cc: Likewise.
* typecheck/rust-hir-type-check-pattern.cc: Likewise.
* typecheck/rust-tyty-cmp.h: Likewise.
* typecheck/rust-tyty-subst.cc: Likewise.
* typecheck/rust-tyty.cc: Likewise.
* typecheck/rust-unify.cc: Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* lex/rust-lex.cc
(Lexer::start_line): Use linemap_line_start.
* rust-linemap.cc
(Linemap::start_line): Remove.
* rust-linemap.h
(Linemap::start_line): Remove.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-linemap.cc
(RichLocation::RichLocation): Remove.
(RichLocation::~RichLocation): Remove.
(RichLocation::add_range): Remove.
(RichLocation::add_fixit_insert_before): Remove.
(RichLocation::add_fixit_insert_after): Remove.
* rust-location.h
(class RichLocation): Remove.
* rust-diagnostics.cc
(rust_be_error_at): Remove RichLocation::get invocation.
* expand/rust-macro-expand.cc: Fix RichLocation constructor.
* hir/rust-ast-lower-base.cc: Likewise.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* rust-session-manager.cc: Likewise.
* typecheck/rust-casts.cc: Likewise.
* typecheck/rust-coercion.cc: Likewise.
* typecheck/rust-hir-inherent-impl-overlap.h: Likewise.
* typecheck/rust-hir-path-probe.h: Likewise.
* typecheck/rust-hir-trait-reference.cc: Likewise.
* typecheck/rust-hir-type-check-expr.cc: Likewise.
* typecheck/rust-hir-type-check-implitem.cc: Likewise.
* typecheck/rust-hir-type-check-item.cc: Likewise.
* typecheck/rust-hir-type-check-pattern.cc: Likewise.
* typecheck/rust-tyty-cmp.h: Likewise.
* typecheck/rust-tyty-subst.cc: Likewise.
* typecheck/rust-tyty.cc: Likewise.
* typecheck/rust-unify.cc: Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* lex/rust-lex.cc
(Lexer::get_current_location): Use linemap_position_for_column.
* rust-session-manager.cc
(Session::handle_crate_name): Likewise.
* rust-linemap.cc
(Linemap::get_location): Remove.
* rust-linemap.h
(Linemap::get_location): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-token.cc (escape_special_chars): Add a function that
escape a given string.
(Token::as_string): Add call to escape function for string/char
representations.
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* hir/tree/rust-hir-type.h (MaybeNamedParam::get_type): Remove
rust_assert.
(BareFunctionType::get_return_type): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* backend/rust-compile-intrinsic.cc (offset_handler): Remove
braces.
(sizeof_handler): Likewise.
(transmute_handler): Likewise.
(rotate_handler): Likewise.
(wrapping_op_handler_inner): Likewise.
(op_with_overflow_inner): Likewise.
(atomic_load_handler_inner): Likewise.
(unchecked_op_inner): Likewise.
(uninit_handler): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h: Add virtual destructor.
* expand/rust-macro-expand.h: Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* hir/tree/rust-hir-full-decls.h (struct Crate): Change to
class.
(class Crate): Likewise.
(struct StructField): Likewise.
(class StructField): Likewise.
(struct TupleField): Likewise.
(class TupleField): Likewise.
(struct TraitFunctionDecl): Likewise.
(class TraitFunctionDecl): Likewise.
* rust-session-manager.h (struct Crate): Likewise.
(class Crate): Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-expr.h
(MetaItemPathLit::get_locus): Remove copy construction.
* backend/rust-constexpr.cc
(eval_constant_expression): Likewise.
(is_valid_constexpr_fn): Likewise.
* util/rust-token-converter.cc
(convert): Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* lex/rust-lex.cc
(Lexer::dump_and_skip): Use location_to_string.
* rust-linemap.cc
(Linemap::to_string): Move to...
(Linemap::location_to_string): ... here.
* rust-linemap.h
(Linemap::to_string): Remove.
(Linemap::location_to_string): Remove definition.
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* hir/tree/rust-hir-expr.h (TypeCastExpr::get_casted_expr): Remove
assert in accessor.
(TypeCastExpr::get_type_to_convert_to): Likewise.
(CompoundAssignmentExpr::get_left_expr): Likewise.
(CompoundAssignmentExpr::get_right_expr): Likewise.
(GroupedExpr::get_expr_in_parens): Likewise.
(TupleIndexExpr::get_tuple_expr): Likewise.
(FieldAccessExpr::get_receiver_expr): Likewise.
(ClosureParam::get_pattern): Likewise.
(ClosureParam::get_type): Likewise.
(ExprType::get_return_type): Likewise.
(IfLetExpr::get_scrutinee_expr): Likewise.
(MatchArm::get_guard_expr): Likewise.
(MatchExpr::get_scrutinee_expr): Likewise.
* hir/tree/rust-hir-item.h (TypeParam::get_type): Likewise.
(SelfParam::get_type): Likewise.
(Function::get_return_type): Likewise.
(TypeAlias::get_type_aliased): Likewise.
(StructField::get_field_type): Likewise.
(TraitFunctionDecl::get_block_expr): Likewise.
(ImplBlock::get_trait_ref): Likewise.
* hir/tree/rust-hir-path.h (ConstGenericArg::get_expression): New.
(TypePathFunction::get_return_type): Remove assert in accessor.
(QualifiedPathType::get_trait): Likewise.
* hir/tree/rust-hir-pattern.h (PatternType::get_lower_bound): Likewise.
(PatternType::get_upper_bound): Likewise.
(ReferencePattern::get_referenced_pattern): Likewise.
* hir/tree/rust-hir.h (ConstGenericParam::get_default_expression): Likewise.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* hir/rust-ast-lower-base.cc (struct_field_name_exists):
called error function.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-diagnostics.cc
(rust_be_error_at): Add function accepting location_t and ErrorCode.
(rust_error_at): Likewise.
* rust-diagnostics.h
(rust_error_at): Likewise.
(rust_be_error_at): Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-linemap.cc
(class Gcc_linemap): Remove.
(Gcc_linemap::start_file): Move to...
(Linemap::start_file): ... here.
(Gcc_linemap::to_string): Move to...
(Linemap::to_string): ... here.
(Gcc_linemap::stop): Move to...
(Linemap::stop): ... here.
(Gcc_linemap::start_line): Move to...
(Linemap::start_line): ... here.
(Gcc_linemap::get_location): Move to...
(Linemap::get_location): ... here.
(rust_get_linemap): Use Linemap.
* rust-linemap.h
(Linemap::in_file_): New field from Gcc_linemap.
(Linemap::Linemap): Initialize in_file_.
(Linemap::~Linemap): Make non-virtual.
(Linemap::start_file): Likewise.
(Linemap::start_line): Likewise.
(Linemap::get_location): Likewise.
(Linemap::stop): Likewise.
(Linemap::to_string): Likewise.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Remove rust-optional-test.cc's object file
* ast/rust-macro.h: Remove use of Rust::Optional
* backend/rust-compile-base.cc
(HIRCompileBase::resolve_method_address): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::check_for_privacy_violation): Likewise.
(PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* checks/errors/rust-feature-gate.cc (FeatureGate::check): Likewise.
* checks/errors/rust-feature.cc (Feature::create): Likewise.
(Feature::as_name): Likewise.
* checks/errors/rust-feature.h: Likewise.
* expand/rust-macro-builtins.cc: Likewise.
* lex/rust-lex.cc (Lexer::Lexer): Likewise.
(Lexer::skip_token): Likewise.
(Lexer::dump_and_skip): Likewise.
* lex/rust-lex.h: Likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise.
* rust-lang.cc (run_rust_tests): Likewise.
* rust-session-manager.cc (Session::compile_crate): Likewise.
(TargetOptions::dump_target_options): Likewise.
* rust-session-manager.h (struct TargetOptions): Likewise.
* util/rust-hir-map.cc (Mappings::lookup_module_children): Likewise.
(Mappings::lookup_module_chidren_items): Likewise.
(Mappings::lookup_module_child): Likewise.
(Mappings::lookup_parent_module): Likewise.
* util/rust-hir-map.h (RUST_HIR_MAP_H): Likewise.
* util/rust-optional-test.cc: Removed.
* util/rust-optional.h: Removed.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-linemap.h (Linemap::unknown_location): Remove.
* ast/rust-ast.cc:
Replace Linemap::unknown_location with UNKNOWN_LOCATION.
* ast/rust-path.cc: Likewise.
* hir/tree/rust-hir.cc: Likewise.
* metadata/rust-imports.cc: Likewise.
* parse/rust-parse-impl.h: Likewise.
* parse/rust-parse.h: Likewise.
* rust-backend.h: Likewise.
* rust-diagnostics.cc: Likewise.
* rust-session-manager.cc: Likewise.
* typecheck/rust-tyty.cc: Likewise.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* resolve/rust-ast-verify-assignee.h: called error function.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-tyty-call.cc (emit_unexpected_argument_error):
Refactored invalid number of argument into one function.
(TypeCheckCallExpr::visit): called refactored function.
(TypeCheckMethodCallExpr::check): likewise.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* util/expected.h: Adapt class to GCC requirements.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* util/expected.h: New file.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* util/optional.h: Adapt for GCC.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* util/optional.h: New file.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-location.h (UNDEF_LOCATION): New.
* ast/rust-ast-collector.cc: Replace Location () with UNDEF_LOCATION.
* ast/rust-ast-fragment.cc: Likewise.
* ast/rust-ast.h: Likewise.
* ast/rust-expr.h: Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.h: Likewise.
* ast/rust-type.h: Likewise.
* backend/rust-compile-expr.cc: Likewise.
* backend/rust-compile-extern.h: Likewise.
* backend/rust-compile-implitem.h: Likewise.
* backend/rust-compile-intrinsic.cc: Likewise.
* backend/rust-compile-item.h: Likewise.
* backend/rust-compile.cc: Likewise.
* backend/rust-constexpr.cc: Likewise.
* expand/rust-expand-visitor.cc: Likewise.
* expand/rust-macro-expand.cc: Likewise.
* expand/rust-macro-expand.h: Likewise.
* expand/rust-macro-invoc-lexer.cc: Likewise.
* expand/rust-proc-macro-invoc-lexer.cc: Likewise.
* expand/rust-proc-macro.cc: Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
* hir/tree/rust-hir-item.h: Likewise.
* hir/tree/rust-hir-path.h: Likewise.
* hir/tree/rust-hir-type.h: Likewise.
* hir/tree/rust-hir.h: Likewise.
* lex/rust-lex.cc: Likewise.
* metadata/rust-export-metadata.cc: Likewise.
* parse/rust-parse-impl.h: Likewise.
* resolve/rust-ast-resolve-item.cc: Likewise.
* resolve/rust-ast-resolve.cc: Likewise.
* rust-diagnostics.h: Likewise.
* rust-session-manager.cc: Likewise.
* typecheck/rust-autoderef.cc: Likewise.
* typecheck/rust-coercion.cc: Likewise.
* typecheck/rust-hir-dot-operator.cc: Likewise.
* typecheck/rust-hir-path-probe.cc: Likewise.
* typecheck/rust-hir-trait-reference.cc: Likewise.
* typecheck/rust-hir-trait-reference.h: Likewise.
* typecheck/rust-hir-type-check-expr.cc: Likewise.
* typecheck/rust-hir-type-check-implitem.cc: Likewise.
* typecheck/rust-hir-type-check-type.cc: Likewise.
* typecheck/rust-hir-type-check.cc: Likewise.
* typecheck/rust-tyty-bounds.cc: Likewise.
* typecheck/rust-tyty-subst.cc: Likewise.
* typecheck/rust-tyty.cc: Likewise.
* util/rust-hir-map.cc: Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Fix abit
output format.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Fix
external item trailing semicolon and outer attributes.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Output
outer attributes on external functions.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Fix method
qualifier output.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Add where
clause.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Add outer
attributes to collector output.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Add
variadics in collector output.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Add
generics.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Fix generic
output.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Reformat
trait impl block.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Output
generic in inherent impl.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-dump.cc (Dump::require_spacing): Change dollar
spacing rule.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Change
formatting.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Fix trait
impl block output.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Fix binding
args.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Output
function qualifiers after visibility.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Fix self
param output.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-dump.cc (Dump::require_spacing): Add a rule to
remove spaces around dots and after references.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Fix several
token collection rules.
* ast/rust-ast-dump.cc (Dump::require_spacing): Add spacing rule
for comma.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-invoc-lexer.h
(class MacroInvocLexerBase): New.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-builtins.cc
(source_relative_path): Use LOCATION_FILE.
(MacroBuiltin::file_handler): Likewise.
(MacroBuiltin::column_handler): Use LOCATION_COLUMN.
(MacroBuiltin::line_handler): Use LOCATION_LINE.
* rust-linemap.cc
(Gcc_linemap::location_file): Remove.
(Gcc_linemap::location_line): Remove.
(Gcc_linemap::location_column): Remove.
* rust-linemap.h
(Linemap::location_file): Remove.
(Linemap::location_line): Remove.
(Linemap::location_column): Remove.
(Linemap::location_to_file): Remove.
(Linemap::location_to_line): Remove.
(Linemap::location_to_column): Remove.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit):
called error function and changed error message
similiar to rustc.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-linemap.cc
(Gcc_linemap::get_unknown_location): Remove.
(Gcc_linemap::get_predeclared_location): Remove.
(Gcc_linemap::is_predeclared): Remove.
(Gcc_linemap::is_unknown): Remove.
* rust-linemap.h
(Linemap::get_predeclared_location): Remove.
(Linemap::get_unknown_location): Remove.
(Linemap::is_predeclared): Remove.
(Linemap::is_unknown): Remove.
(Linemap::predeclared_location): Use BUILTINS_LOCATION.
(Linemap::unknown_location): Use UNKNOWN_LOCATION.
(Linemap::is_predeclared_location): Remove.
(Linemap::is_unknown_location): Remove.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItemWithTrait::visit):
called error function
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve):
called error function.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* lex/rust-lex.cc (Lexer::input_source_is_valid_utf8): New method of `Lexer`.
* lex/rust-lex.h: Likewise.
* rust-session-manager.cc (Session::compile_crate): Add error.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-expand.cc
(transcribe_expression): Skip trailing semicolon.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-item.cc: called error function.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* ast/rust-ast.h: Modify constructors of `Rust::Identifier`
* ast/rust-pattern.h: Likewise.
* hir/tree/rust-hir-item.h: Likewise.
* parse/rust-parse-impl.h (Parser::parse_macro_rules_def): Likewise.
(Parser::parse_decl_macro_def): Likewise.
(Parser::parse_macro_match_fragment): Likewise.
(Parser::parse_module): Likewise.
(Parser::parse_use_tree): Likewise.
(Parser::parse_function): Likewise.
(Parser::parse_type_param): Likewise.
(Parser::parse_type_alias): Likewise.
(Parser::parse_struct): Likewise.
(Parser::parse_struct_field): Likewise.
(Parser::parse_enum): Likewise.
(Parser::parse_enum_item): Likewise.
(Parser::parse_union): Likewise.
(Parser::parse_static_item): Likewise.
(Parser::parse_trait): Likewise.
(Parser::parse_trait_item): Likewise.
(Parser::parse_trait_type): Likewise.
(Parser::parse_trait_const): Likewise.
(Parser::parse_external_item): Likewise.
(Parser::parse_generic_args_binding): Likewise.
(Parser::parse_method): Likewise.
(Parser::parse_maybe_named_param): Likewise.
(Parser::parse_identifier_pattern): Likewise.
(Parser::parse_struct_expr_field): Likewise.
(ResolveItem::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit):Add comments
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): Likewise.
* checks/lints/rust-lint-scan-deadcode.h: Fix error location
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-base.cc
(HIRCompileBase::address_expression): Remove gcc_location method call.
(HIRCompileBase::indirect_expression): Likewise.
(HIRCompileBase::compile_constant_item): Likewise.
(HIRCompileBase::named_constant_expression): Likewise.
* backend/rust-compile-expr.cc
(CompileExpr::visit): Remove gcc_location method call, use UNKNOWN_LOCATION to initialize.
(CompileExpr::get_fn_addr_from_dyn): Remove gcc_location method call.
(CompileExpr::type_cast_expression): Likewise.
* backend/rust-compile-intrinsic.cc
(transmute_handler): Replace "Location ().gcc_location ()" with UNKNOWN_LOCATION.
(copy_nonoverlapping_handler): Likewise.
(prefetch_data_handler): Likewise.
(atomic_store_handler_inner): Likewise.
(atomic_load_handler_inner): Likewise.
* resolve/rust-ast-resolve-expr.cc
(ResolveExpr::visit): Remove gcc_location method call.
* rust-diagnostics.cc
(rust_be_error_at): Likewise.
(rust_be_warning_at): Likewise.
(rust_be_fatal_error): Likewise.
(rust_be_inform): Likewise.
* rust-diagnostics.h
(rust_sorry_at): Likewise.
* rust-gcc.cc
(Bvariable::get_tree): Likewise.
(Gcc_backend::fill_in_fields): Likewise.
(Gcc_backend::named_type): Likewise.
(Gcc_backend::real_part_expression): Likewise.
(Gcc_backend::imag_part_expression): Likewise.
(Gcc_backend::complex_expression): Likewise.
(Gcc_backend::convert_expression): Likewise.
(Gcc_backend::struct_field_expression): Likewise.
(Gcc_backend::compound_expression): Likewise.
(Gcc_backend::conditional_expression): Likewise.
(Gcc_backend::negation_expression): Likewise.
(Gcc_backend::arithmetic_or_logical_expression): Likewise.
(Gcc_backend::arithmetic_or_logical_expression_checked): Likewise.
(Gcc_backend::comparison_expression): Likewise.
(Gcc_backend::lazy_boolean_expression): Likewise.
(Gcc_backend::constructor_expression): Likewise.
(Gcc_backend::array_constructor_expression): Likewise.
(Gcc_backend::array_initializer): Likewise.
(Gcc_backend::array_index_expression): Likewise.
(Gcc_backend::call_expression): Likewise.
(Gcc_backend::assignment_statement): Likewise.
(Gcc_backend::return_statement): Likewise.
(Gcc_backend::exception_handler_statement): Likewise.
(Gcc_backend::if_statement): Likewise.
(Gcc_backend::loop_expression): Likewise.
(Gcc_backend::exit_expression): Likewise.
(Gcc_backend::block): Likewise.
(Gcc_backend::convert_tree): Likewise.
(Gcc_backend::global_variable): Likewise.
(Gcc_backend::local_variable): Likewise.
(Gcc_backend::parameter_variable): Likewise.
(Gcc_backend::static_chain_variable): Likewise.
(Gcc_backend::temporary_variable): Likewise.
(Gcc_backend::label): Likewise.
(Gcc_backend::goto_statement): Likewise.
(Gcc_backend::label_address): Likewise.
(Gcc_backend::function): Likewise.
* rust-linemap.cc
(Gcc_linemap::to_string): Likewise.
(Gcc_linemap::location_file): Likewise.
(Gcc_linemap::location_line): Likewise.
(Gcc_linemap::location_column): Likewise.
(Gcc_linemap::is_predeclared): Likewise.
(Gcc_linemap::is_unknown): Likewise.
(RichLocation::RichLocation): Likewise.
(RichLocation::add_range): Likewise.
(RichLocation::add_fixit_insert_before): Likewise.
(RichLocation::add_fixit_insert_after): Likewise.
* rust-location.h
(class Location): Replace with typedef.
(operator<): Remove.
(operator==): Remove.
(operator+): Remove.
(operator-): Remove.
* typecheck/rust-hir-trait-resolve.cc
(AssociatedImplTrait::setup_associated_types): Initialize Location with UNKNOWN_LOCATION.
* typecheck/rust-hir-type-check-stmt.cc
(TypeCheckStmt::visit): Likewise.
* util/rust-token-converter.cc
(convert): Remove gcc_location method call.
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* hir/tree/rust-hir-expr.h (BorrowExpr::is_double_borrow): New.
(ArrayElemsCopied::get_elem_to_copy)
(ArrayElemsCopied::get_num_copies_expr): Return unique_ptr.
(CallExpr::get_fnexpr): Likewise.
(ReturnExpr::get_expr): Likewise.
(StructExprStructFields::get_struct_base): New.
(MethodCallExpr::has_params): New.
(ClosureExpr::has_params): New.
(BlockExpr::get_inner_attrs): New.
(WhileLoopExpr::get_patterns): New.
(ForLoopExpr::get_pattern): New.
(IfLetExpr::get_if_block): Return ref to unique_ptr.
(IfLetExprConseqElse::get_else_block): Likewise.
(MatchExpr::get_inner_attrs): New.
* hir/tree/rust-hir-item.h (Module::get_module_name): New.
(ExternCrate::get_referenced_crate)
(ExternCrate::get_as_clause_name): New.
(UseTreeGlob::get_glob_type, UseTreeGlob::get_path): New.
(UseTreeList::get_path_type, UseTreeList::get_path)
(UseTreeList::get_trees): New.
(TraitItemKind::get_expr): Remove assert. unique_ptr can
be "empty". Must be checked in caller.
* hir/tree/rust-hir-pattern.h (IdentifierPattern::get_is_ref)
(IdentifierPattern::get_to_bind): New.
(RangePatternBoundType::get_has_minus): New.
(RangePattern::get_has_ellipsis_syntax): New.
(StructPatternField::get_outer_attrs): New.
(StructPatternFieldTuplePat::get_index)
(StructPatternFieldTuplePat::get_tuple_pattern): New.
(StructPatternFieldIdent::get_has_ref): New.
* hir/tree/rust-hir-stmt.h (LetStmt::get_outer_attrs): New.
(LetStmt::get_type)
(LetStmt::get_init_expr, LetStmt::get_pattern): Return unique_ptr.
(ExprStmt::get_expr): Likewise.
* hir/tree/rust-hir-type.h (TraitBound::get_for_lifetimes): New.
(TraitBound::get_in_params): New.
(TraitBound::get_opening_question_mark): New.
(ImplTraitType::get_type_param_bounds): New.
(TraitObjectType::get_has_dyn): New.
(TraitBound::get_type_in_parens): New.
(ImplTraitTypeOneBound::get_trait_bound): New.
(BareFunctionType::get_for_lifetimes)
(BareFunctionType::get_is_variadic)
(BareFunctionType::get_function_qualifiers): New.
* hir/tree/rust-hir.h (class Expr): Virtual inherit from FullVisitable.
(class Pattern): Likewise.
(ConstGenericParam::get_name): New.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Adjust call.
(TypeCheckExpr::resolve_fn_trait_call): Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Adjust call.
(CompileExpr::array_copied_expr): Likewise.
(CompileExpr::generate_possible_fn_trait_call): Likewise.
* backend/rust-compile-stmt.cc (CompileStmt::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-path-probe.h: called error function
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args):
called error function
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* hir/tree/rust-hir-expr.h (class ArrayElems): Inherit from FullVisitable.
(class StructExprField): Likewise.
* hir/tree/rust-hir-item.h (class WhereClauseItem): Likewise.
(class UseTree): Likewise.
(UseTreeRebind::get_path, UseTreeRebind::get_identifier)
(UseTreeRebind::get_bind_type): New.
(UseDeclaration::get_use_tree): New.
(struct TraitFunctionDecl): Change struct to ...
(class TraitFunctionDecl): ... class.
(TraitFunctionDecl::get_where_clause): New.
(StructField::get_outer_attrs): New.
(struct TupleField): Change struct to ...
(class TupleField): ... class.
(TupleField::get_visibility, TupleField::get_outer_attrs): New.
* hir/tree/rust-hir-pattern.h (class TupleStructItems): Inherit
from FullVisitable.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* lex/rust-lex.cc (Lexer::build_token): Replace function call.
(Lexer::parse_string): Likewise.
(Lexer::parse_identifier_or_keyword): Likewise.
(Lexer::parse_raw_string): Likewise.
(Lexer::parse_char_or_lifetime): Likewise.
(Lexer::get_input_codepoint_length): Deleted.
(Lexer::peek_codepoint_input): Deleted.
(Lexer::skip_codepoint_input): Deleted.
* lex/rust-lex.h: Remove some methods and fields
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound): track output
* util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): new helper
* util/rust-hir-map.h: add prototype for helper
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (CompileExpr::generate_possible_fn_trait_call): use fnexpr
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::resolve_fn_trait_call): likewise
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): called rust_error_at
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* hir/tree/rust-hir.h (struct Crate): Rename struct into ...
(class Crate): ... class, and add get_items.
* backend/rust-compile.cc (CompileCrate::go): Adapt to visibility change of items.
* checks/errors/privacy/rust-privacy-check.cc (Resolver::resolve): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::go): Likewise.
* checks/errors/privacy/rust-pub-restricted-visitor.cc (PubRestrictedVisitor::go): Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::go): Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::go): Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::go): Likewise.
* checks/lints/rust-lint-marklive.cc (FindEntryPoint::find): Likewise.
* checks/lints/rust-lint-scan-deadcode.h (ScanDeadCode::Scan): Likewise.
* metadata/rust-export-metadata.cc (PublicInterface::gather_export_data): Likewise.
* typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): Likewise.
* hir/rust-hir-dump.cc (CompileCrate::go): Likewise.
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* hir/tree/rust-hir-expr.h (AwaitExpr::get_awaited_expr): New.
(AsyncBlockExpr::get_has_move, AsyncBlockExpr::get_block_expr): New.
* hir/tree/rust-hir-item.h (Enum::get_where_clause): New.
(Trait::get_where_clause, Trait::is_unsafe): New.
(ExternalItem::get_visibility): New.
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* hir/tree/rust-hir.h (class FullVisitable): New.
(class Stmt): Adjust with new class.
(class Expr): Likewise.
(class Pattern): Likewise.
(class Type): Likewise.
(class TypeParamBound): Likewise.
(class GenericParam): Likewise.
(class TraitItem): Likewise.
(class ImplItem): Likewise.
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* hir/tree/rust-hir.h (class WithInnerAttrs): New.
(class Item): Adjust to new WithInnerAttrs class.
(struct Crate): Likewise.
* hir/rust-hir-dump.cc (Dump::go): Likewise.
(Dump::visit): Likewise.
* hir/tree/rust-hir-expr.h (class GroupedExpr): Likewise.
(class ArrayExpr): Likewise.
(class TupleExpr): Likewise.
(class StructExprStruct): Likewise.
(class BlockExpr): Likewise.
(class MatchExpr): Likewise.
* hir/tree/rust-hir-item.h (TypeParam::get_outer_attribute): New.
(class Module): Adjust to new WithInnerAttrs class.
(struct StructField): change struct to...
(class StructField): ... a class.
(class ImplBlock): Adjust to new WithInnerAttrs class.
(class ExternBlock): Likewise.
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* hir/tree/rust-hir-type.h (ArrayType::get_element_type): Returns
unique_ptr.
* hir/tree/rust-hir-expr.h (ArithmeticOrLogicalExpr::get_lhs)
(ArithmeticOrLogicalExpr::get_rhs): Likewise.
(ComparisonExpr::get_lhs, ComparisonExpr::get_rhs): Likewise.
(LazyBooleanExpr::get_lhs, LazyBooleanExpr::get_rhs): Likewise.
(AssignmentExpr::get_lhs, AssignmentExpr::get_rhs): Likewise.
(ArrayExpr::get_internal_elements): Likewise.
(ArrayIndexExpr::get_index_expr, ArrayIndexExpr::get_array_expr):
Likewise.
(StructExprFieldWithVal::get_value): Likewise.
(IfExpr::get_if_condition, IfExpr::get_if_block): Likewise.
(ExprWithBlock::get_else_block): Likewise.
* hir/tree/rust-hir-item.h (FunctionParam::get_param_name)
(FunctionParam::get_type): Likewise.
(ConstantItem::get_type, ConstantItem::get_expr): Likewise.
(StaticItem::get_expr, StaticItem::get_type): Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit):
Adjust for previous change.
* backend/rust-compile-block.cc (CompileConditionalBlocks::visit):
Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* backend/rust-compile-item.cc (CompileItem::visit): Likewise.
* backend/rust-compile-struct-field-expr.cc
(CompileStructExprField::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::visit): Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise.
* typecheck/rust-hir-type-check-implitem.cc
(TypeCheckImplItem::visit): Likewise.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit):
Likewise.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit):
Likewise.
* typecheck/rust-hir-type-check-struct.cc
(TypeCheckStructExpr::visit): Likewise.
* typecheck/rust-hir-type-check.cc
(TraitItemReference::get_type_from_fn): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-pattern.h: Change constructor to accept new parameter
instead of defaulting on string type.
* parse/rust-parse-impl.h (Parser::parse_literal_or_range_pattern):
Propagate type hint.
(Parser::parse_pattern_no_alt): Likewise.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* lex/rust-lex.cc (Lexer::parse_byte_char):add check for range of codepoint
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-pattern.cc (emit_invalid_field_error): Refactored Field
Error Function
(TypeCheckPattern::visit): called emit_invalid_field_error function
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-expand.cc
(MacroExpander::match_matcher): Remove append_fragment inside repetitions.
(MacroExpander::match_n_matches): Use sub_stack push/pop to handle repetitions.
(MatchedFragmentContainer::add_fragment): Add MatchedFragmentContainer accepting version.
* expand/rust-macro-expand.h
(MatchedFragmentContainer::add_fragment): Likewise.
(MatchedFragmentContainerRepetition::add_fragment): Likewise.
(SubstititionScope::append_fragment): Likewise.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-casts.cc (TypeCastRules::check): apply new argument
* typecheck/rust-coercion.cc (TypeCoercionRules::Coerce): track if this is a cast site
(TypeCoercionRules::TryCoerce): update ctor
(TypeCoercionRules::TypeCoercionRules): cleanup error handling
(TypeCoercionRules::do_coercion): likewise
(TypeCoercionRules::coerce_unsafe_ptr): only infer in try mode
(TypeCoercionRules::coerce_borrowed_pointer): cleanup
* typecheck/rust-coercion.h: update header
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-reference.h: update prototype
* typecheck/rust-hir-trait-resolve.cc: add generic args as an out param
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): use the generics
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Add comment
after tail expressions.
* ast/rust-ast-dump.cc (Dump::require_spacing): Check for
missing previous token.
* ast/rust-ast-dump.h: Output formatting characters.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::collect): Collect
CollectItems once done.
(TokenCollector::newline): Add newline formatting
implementation.
(TokenCollector::indentation): Add indentation implementation.
(TokenCollector::increment_indentation): Add indentation
increment.
(TokenCollector::comment): Add new comment formatting option.
* ast/rust-ast-collector.h: Update prototypes.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::collect_tokens):
Filter tokens.
(TokenCollector::visit_items_joined_by_separator): Change store
call.
(TokenCollector::visit_as_line): Likewise.
(TokenCollector::visit_items_as_block): Likewise.
(TokenCollector::trailing_comma): Likewise.
(TokenCollector::visit): Likewise.
(TokenCollector::visit_closure_common): Likewise.
(TokenCollector::visit_function_common): Likewise.
* ast/rust-ast-collector.h (class CollectItem): Add class to
differentiate between formatting and raw data (tokens).
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::TokenCollector):
Remove constructor, changing it to an implicit default
constructor.
* ast/rust-ast-collector.h: Change from container reference to
direct container.
* ast/rust-ast-dump.h: Change call to constructor.
* expand/rust-macro-expand.h (struct MacroExpander): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-dump.cc (Dump::require_spacing): Add a function
to determine wether a space shall output.
* ast/rust-ast-dump.h: Add function prototype as well as
condition.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Add a visit
function for visitable abstract class so we can call a dump on
any visitable item.
* ast/rust-ast-collector.h: Add new visit function prototype.
* ast/rust-ast-dump.cc (Dump::go): Add call to process function.
(Dump::visit): Remove functions.
(Dump::visit_items_joined_by_separator): Likewise.
(Dump::visit_as_line): Likewise.
(Dump::visit_items_as_lines): Likewise.
(Dump::visit_items_as_block): Likewise.
(Dump::visit_function_common): Likewise.
(get_delimiters): Likewise.
(Dump::debug): Update with call to tokencollector.
* ast/rust-ast-dump.h (RUST_AST_DUMP_H): Move include
directives.
(class Dump): Remove multiple prototypes and add generic process
function.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Add
semicolon in extern blocks.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* rust-session-manager.cc (Session::enable_dump): Remove
tokenstream dump.
(Session::compile_crate): Likewise.
(Session::dump_tokenstream): Likewise.
* rust-session-manager.h (struct CompileOptions): Likewise.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* lex/rust-lex.cc (Lexer::build_token):add check for all kinds of whitespaces
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h: Add default constructors.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Change with
call to getter.
* ast/rust-ast.cc (Module::as_string): Likewise.
(StaticItem::as_string): Likewise.
(TupleStruct::as_string): Likewise.
(Method::as_string): Likewise.
(StructStruct::as_string): Likewise.
(UseTreeRebind::as_string): Likewise.
(Enum::as_string): Likewise.
(Trait::as_string): Likewise.
(Union::as_string): Likewise.
(Function::as_string): Likewise.
(TypeAlias::as_string): Likewise.
(MacroRulesDefinition::as_string): Likewise.
(FieldAccessExpr::as_string): Likewise.
(MacroMatchFragment::as_string): Likewise.
(TypeParam::as_string): Likewise.
(StructExprFieldIdentifierValue::as_string): Likewise.
(EnumItem::as_string): Likewise.
(StructField::as_string): Likewise.
(ExternalTypeItem::as_string): Likewise.
(ExternalStaticItem::as_string): Likewise.
(ExternalFunctionItem::as_string): Likewise.
(TraitFunctionDecl::as_string): Likewise.
(TraitMethodDecl::as_string): Likewise.
(TraitItemConst::as_string): Likewise.
(TraitItemType::as_string): Likewise.
(MaybeNamedParam::as_string): Likewise.
(MetaListPaths::as_string): Likewise.
(MetaListNameValueStr::as_string): Likewise.
(Module::process_file_path): Likewise.
(MetaListNameValueStr::check_cfg_predicate): Likewise.
(MetaListPaths::check_cfg_predicate): Likewise.
(MetaWord::check_cfg_predicate): Likewise.
(MetaNameValueStr::check_cfg_predicate): Likewise.
(MetaNameValueStr::to_attribute): Likewise.
(MetaWord::to_attribute): Likewise.
(MetaListPaths::to_attribute): Likewise.
(MetaListNameValueStr::to_attribute): Likewise.
(operator<<): Change Identifier class <<
operator overload for standard output stream.
* ast/rust-ast.h (class Identifier): Change typedef to proper
class definition.
(operator<<): Add prototype for operator overload.
(class Token): Change getter identifier.
(class MetaListNameValueStr): Likewise.
(class PathExpr): Likewise.
* ast/rust-expr.h: Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.cc (GenericArg::disambiguate_to_type): Likewise.
(GenericArgsBinding::as_string): Likewise.
(ConstGenericParam::as_string): Likewise.
* ast/rust-path.h: Likewise.
* ast/rust-pattern.cc (IdentifierPattern::as_string): Likewise.
(StructPatternFieldIdentPat::as_string): Likewise.
(StructPatternFieldIdent::as_string): Likewise.
* ast/rust-type.h: Likewise.
* backend/rust-compile-base.cc: Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* backend/rust-compile-extern.h: Likewise.
* backend/rust-compile-fnparam.cc (CompileFnParam::visit):
Likewise.
* backend/rust-compile-implitem.cc (CompileTraitItem::visit):
Likewise.
* backend/rust-compile-item.cc (CompileItem::visit): Likewise.
* backend/rust-compile-pattern.cc (CompilePatternBindings::visit): Likewise.
* backend/rust-compile-struct-field-expr.cc (CompileStructExprField::visit):
Likewise.
* backend/rust-compile-var-decl.h: Likewise.
* backend/rust-compile.cc: Likewise.
* checks/errors/rust-unsafe-checker.cc (check_extern_call):
Likewise.
* checks/lints/rust-lint-marklive.cc (MarkLive::visit):
Likewise.
* checks/lints/rust-lint-scan-deadcode.h: Likewise.
* expand/rust-derive-clone.cc (DeriveClone::clone_fn): Likewise.
(DeriveClone::visit_tuple): Likewise.
(DeriveClone::visit_struct): Likewise.
(DeriveClone::visit_union): Likewise.
* expand/rust-derive-copy.cc (DeriveCopy::visit_struct):
Likewise.
(DeriveCopy::visit_tuple): Likewise.
(DeriveCopy::visit_enum): Likewise.
(DeriveCopy::visit_union): Likewise.
* expand/rust-macro-expand.cc (MacroExpander::match_matcher):
Likewise.
(MacroExpander::match_n_matches): Likewise.
(MacroExpander::match_repetition): Likewise.
(MacroExpander::match_repetition_skipped_metavars): Likewise.
* hir/rust-ast-lower-base.cc (struct_field_name_exists):
Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit):
Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
* hir/tree/rust-hir-item.h: Likewise.
* hir/tree/rust-hir-path.h: Likewise.
* hir/tree/rust-hir-type.h: Likewise.
* hir/tree/rust-hir.cc (Module::as_string): Likewise.
(StaticItem::as_string): Likewise.
(TupleStruct::as_string): Likewise.
(ConstantItem::as_string): Likewise.
(StructStruct::as_string): Likewise.
(UseTreeRebind::as_string): Likewise.
(Enum::as_string): Likewise.
(Trait::as_string): Likewise.
(Union::as_string): Likewise.
(Function::as_string): Likewise.
(TypeAlias::as_string): Likewise.
(FieldAccessExpr::as_string): Likewise.
(TypeParam::as_string): Likewise.
(GenericArgsBinding::as_string): Likewise.
(StructPatternFieldIdent::as_string): Likewise.
(StructPatternFieldIdentPat::as_string): Likewise.
(IdentifierPattern::as_string): Likewise.
(StructExprFieldIdentifierValue::as_string): Likewise.
(EnumItem::as_string): Likewise.
(StructField::as_string): Likewise.
(ExternalStaticItem::as_string): Likewise.
(ExternalFunctionItem::as_string): Likewise.
(NamedFunctionParam::as_string): Likewise.
(TraitFunctionDecl::as_string): Likewise.
(TraitItemConst::as_string): Likewise.
(TraitItemType::as_string): Likewise.
(MaybeNamedParam::as_string): Likewise.
* hir/tree/rust-hir.h: Likewise.
* parse/rust-parse-impl.h (Parser::parse_macro_match_fragment):
Likewise.
(Parser::parse_module): Likewise.
(Parser::parse_use_tree): Likewise.
(Parser::parse_maybe_named_param): Likewise.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit):
Likewise.
(ResolveItem::visit): Likewise.
(flatten_rebind): Likewise.
(ResolveExternItem::visit): Likewise.
(rust_flatten_rebind): Likewise.
(rust_flatten_rebind_nested): Likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::go):
Likewise.
(PatternDeclaration::visit): Likewise.
(PatternDeclaration::add_new_binding): Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* resolve/rust-ast-resolve-type.h: Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise.
* typecheck/rust-autoderef.cc: Likewise.
* typecheck/rust-hir-dot-operator.cc (MethodResolver::select):
Likewise.
* typecheck/rust-hir-path-probe.cc (PathProbeType::visit):
Likewise.
* typecheck/rust-hir-trait-reference.cc (TraitReference::get_name): Likewise.
* typecheck/rust-hir-trait-resolve.cc (ResolveTraitItemToRef::visit): Likewise.
(TraitResolver::resolve_trait): Likewise.
(TraitItemReference::resolve_item): Likewise.
(AssociatedImplTrait::setup_raw_associated_types): Likewise.
* typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit): Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Likewise.
(TypeCheckImplItem::visit): Likewise.
(TypeCheckImplItemWithTrait::visit): Likewise.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit):
Likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::visit): Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::visit): Likewise.
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): Likewise.
* typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args): Likewise.
* util/rust-attributes.cc (check_doc_attribute): Likewise.
* util/rust-hir-map.cc (Mappings::insert_macro_def): Likewise.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* lex/rust-lex.cc (is_float_digit):Change types of param to `uint32_t`
(is_x_digit):Likewise
(is_octal_digit):Likewise
(is_bin_digit):Likewise
(check_valid_float_dot_end):Likewise
(is_whitespace):Likewise
(is_non_decimal_int_literal_separator):Likewise
(is_identifier_start):Likewise
(is_identifier_continue):Likewise
(Lexer::skip_broken_string_input):Likewise
(Lexer::build_token):Remove handling BOM
(Lexer::parse_in_type_suffix):Modify use of `current_char`
(Lexer::parse_in_decimal):Likewise
(Lexer::parse_escape):Likewise
(Lexer::parse_utf8_escape):Likewise
(Lexer::parse_partial_string_continue):Likewise
(Lexer::parse_partial_hex_escape):Likewise
(Lexer::parse_partial_unicode_escape):Likewise
(Lexer::parse_byte_char):Likewise
(Lexer::parse_byte_string):Likewise
(Lexer::parse_raw_byte_string):Likewise
(Lexer::parse_raw_identifier):Likewise
(Lexer::parse_non_decimal_int_literal):Likewise
(Lexer::parse_decimal_int_or_float):Likewise
(Lexer::peek_input):Change return type to `Codepoint`
(Lexer::get_input_codepoint_length):Change to return 1
(Lexer::peek_codepoint_input):Change to be wrapper of `peek_input`
(Lexer::skip_codepoint_input):Change to be wrapper of `skip_input`
(Lexer::test_get_input_codepoint_n_length):Deleted
(Lexer::split_current_token):Deleted
(Lexer::test_peek_codepoint_input):Deleted
(Lexer::start_line):Move backwards
(assert_source_content):New helper function for selftest
(test_buffer_input_source):New helper function for selftest
(test_file_input_source):Likewise
(rust_input_source_test):New test
* lex/rust-lex.h (rust_input_source_test):New test
* rust-lang.cc (run_rust_tests):Add selftest
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-expand.cc
(MacroExpander::match_repetition_skipped_metavars): New.
(MacroExpander::match_repetition): Use new method.
* expand/rust-macro-expand.h
(MacroExpander::match_repetition_skipped_metavars): New.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): called rust_error_at
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): called rust_error_at
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-expand.cc
(MacroExpander::match_token): Match token instead of token id.
* parse/rust-parse-impl.h
(Parser::skip_token): Add token-skipping variant.
(Parser::expect_token): Likewise.
* parse/rust-parse.h
(Parser::skip_token): Likewise.
(Parser::expect_token): Likewise.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* lang.opt: Add -frust-name-resolution-2.0 option
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-autoderef.cc (AutoderefCycle::cycle): add check for pointers
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-autoderef.cc: use new selection filter
* typecheck/rust-hir-dot-operator.cc (MethodResolver::Select): new slection Filter
* typecheck/rust-hir-dot-operator.h: New select prototype
* typecheck/rust-hir-type-check-expr.cc: call select
* typecheck/rust-type-util.cc (try_coercion): new helper
* typecheck/rust-type-util.h (try_coercion): helper prototype
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): passed "E0277"
* typecheck/rust-tyty.cc (BaseType::bounds_compatible): passed "E0277"
2024-01-16 Matthew Jasper <mjjasper1@gmail.com>
* expand/rust-expand-visitor.cc (ExpandVisitor::visit):
Expand expressions in more contexts.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
Visit enum variants.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.cc (BlockExpr::normalize_tail_expr): Refactor
code and warn about dangling reference.
* expand/rust-expand-visitor.cc (expand_stmt_attribute):
Document function and change argument names to make those
clearer.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-expand-visitor.cc (ExpandVisitor::expand_inner_stmts):
Remove second argument.
(ExpandVisitor::visit): Remove argument from function call.
* expand/rust-expand-visitor.h: Update function prototype.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-expand-visitor.cc (ExpandVisitor::visit): Change
call to expand_inner_stmts.
(expand_tail_expr): Change argument name and try to expand the
last statement as a tail expression once all statements have
been expanded.
* expand/rust-expand-visitor.h: Change prototype to accept
parent class.
* ast/rust-expr.h: Add try_convert_last_stmt function prototype.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-expr.h: Add a function to take tail expr as well
as a function to set a tail expression.
* expand/rust-expand-visitor.cc (expand_tail_expr): Add tail
expression expansion function.
(ExpandVisitor::visit): Add call to tail expr expansion in for
BlockExpr.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-expand-visitor.cc : Change type from pointer to
reference and expand statements from statements.
* ast/rust-macro.h: Return macro kind.
* ast/rust-ast.h: Add Statement kind.
* ast/rust-item.h: Change module.
* ast/rust-stmt.h: Return kind.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-expand.cc
(MacroExpander::expand_decl_macro):
Use pointers/smart pointers to refer to MatchedFragmentContainer instances.
(MacroExpander::transcribe_rule): Likewise.
(MatchedFragmentContainer::get_single_fragment): New implementation.
(MatchedFragmentContainer::get_fragments): Likewise.
(MatchedFragmentContainer::add_fragment): Likewise.
(MatchedFragmentContainer::zero): Likewise.
(MatchedFragmentContainer::metavar): Likewise.
* expand/rust-macro-expand.h
(class MatchedFragmentContainer): Make abstract.
(class MatchedFragmentContainerMetaVar): New.
(class MatchedFragmentContainerRepetition): New.
(class SubstitutionScope):
Use pointers/smart pointers to refer to MatchedFragmentContainer instances.
(MacroExpander::transcribe_rule): Likewise.
* expand/rust-macro-substitute-ctx.cc
(SubstituteCtx::substitute_metavar): Likewise.
(SubstituteCtx::check_repetition_amount): Likewise.
(SubstituteCtx::substitute_repetition): Likewise.
* expand/rust-macro-substitute-ctx.h
(class SubstituteCtx): Likewise.
2024-01-16 Muhammad Mahad <mahadtxt@gmail.com>
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): called rust_error_at
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): called rust_error_at
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::ResolveImplBlockSelfWithInference):
arguments mappings as an out parameter and apply them to the bounds
* typecheck/rust-hir-type-check-item.h: update the prototype
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments):
apply the arguments to the segment type
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments):
simplify lookup of the respective predicate
* typecheck/rust-tyty-subst.cc (SubstitutionArg::SubstitutionArg): track original parameter
(SubstitutionArg::operator=): update copy ctor
(SubstitutionArg::get_param_ty): use original param
(SubstitutionArg::as_string): update as_string
* typecheck/rust-tyty-subst.h: add new private field
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::ResolveImplBlockSelfWithInference):
New helper utility to infer non concrete types and handle the case where its not a
binding generic type (which inherits SubstitutionRef)
* typecheck/rust-hir-type-check-item.h: new helper prototype
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): use this helper
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-resolve.cc: use lookup_predicate (DefID)
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): fix formatting
2024-01-16 Matthew Jasper <mjjasper1@gmail.com>
* ast/rust-ast.h (MacroInvocation::add_semicolon): New method.
(Expr::to_stmt): Remove method.
* ast/rust-macro.h (MacroInvocation::add_semicolon): Add override.
(MacroInvocation::to_stmt): Remove override.
* ast/rust-stmt.h: Remove use of Expr::to_stmt.
(ExprStmt::add_semicolon): Add override.
* expand/rust-macro-expand.h (struct MacroExpander):
Add EXPR/STMT and remove BLOCK from ContextType.
* expand/rust-expand-visitor.cc (ExpandVisitor::maybe_expand_expr): Use EXPR context.
(ExpandVisitor::expand_inner_stmts): Use STMT context.
(ExpandVisitor::visitor): Remove use of BLOCK context.
* expand/rust-macro-expand.cc (parse_many): Pass enum by value.
(transcribe_on_delimiter): Remove function.
(transcribe_context): Use EXPR/STMT contexts.
(MacroExpander::parse_proc_macro_output): Use EXPR/STMT contexts.
(transcribe_many_stmts): Parse statements with semicolons.
* parse/rust-parse-impl.h (Parser::parse_stmt):
Delegate macro parsing to parse_expr_stmt, check for ! after macro_rules.
(Parser::parse_let_stmt): Work around lack of NT tokens.
(Parser::parse_expr_stmt): Handle statements at end of macro expansions.
(Parser::parse_expr_stmt): Parse macro statements/expression statements
starting with a macro.
(Parser::parse_match_expr): Don't modify flag unnecessarily.
(Parser::parse_stmt_or_expr):
Parse macro statements/expression statements starting with a macro.
(Parser::parse_path_based_stmt_or_expr): Remove method.
(Parser::parse_macro_invocation_maybe_semi): Remove method.
(Parser::parse_expr): Move code into left_denotations.
(Parser::left_denotations): New method.
(Parser::null_denotation): Split out methods for cases with and without paths.
(Parser::null_denotation_path): New method.
(Parser::null_denotation_not_path): New method.
(Parser::parse_macro_invocation_partial): Don't check for semicolon here.
* parse/rust-parse.h: Update declarations.
(struct ParseRestrictions): Additional flag.
2024-01-16 Matthew Jasper <mjjasper1@gmail.com>
* ast/rust-ast.cc (BlockExpr::strip_tail_expr):
Don't normalize tail expression in this method.
(BlockExpr::normalize_tail_expr): New method that only does the normalization.
* ast/rust-expr.h: Declare new method.
* hir/rust-ast-lower-block.h: Normalize tail expressions on blocks before lowering.
2024-01-16 Matthew Jasper <mjjasper1@gmail.com>
* ast/rust-ast-dump.cc (Dump::visit): Print macro invocations.
2024-01-16 Raiki Tamura <tamaron1203@gmail.com>
* lex/rust-lex.cc (is_whitespace):add all lacked codepoints valid as whitespaces
(is_identifier_start):new function to check XID_Start and underscore
(is_identifier_continue):new function to check XID_Continue
(Lexer::build_token):tokenize Unicode identifiers
(Lexer::parse_partial_string_continue):add comments
(Lexer::parse_partial_unicode_escape):add comments
(Lexer::parse_raw_identifier):change to use `is_identifier_scontinue`
(Lexer::parse_identifier_or_keyword):change to use `is_identifier_continue`
(Lexer::parse_char_or_lifetime):change to use `is_identifier_start/continue`
(Lexer::skip_codepoint_input):do not attempt to skip input when bumping EOF
* lex/rust-lex.h:add `current_char32` field
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* lex/rust-lex.cc
(Lexer::classify_keyword): Check if iterator is valid before dereferencing.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-expand.cc
(MacroExpander::match_repetition): Remove redundant rust_error_at call.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-unify.cc (UnifyRules::go): dont check bounds on placeholders
2024-01-16 tieway59 <tieway59@foxmail.com>
* typecheck/rust-tycheck-dump.h: Delete this file
* rust-session-manager.cc: Remove `Session::dump_type_resolution`
and `TYPE_RESOLUTION_DUMP`
* rust-session-manager.h: Likewise
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address):
match the fntype to the candidate
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive.h: Store AstBuilder and location.
* expand/rust-derive.cc (DeriveVisitor::DeriveVisitor): Update constructor.
* expand/rust-derive-clone.h: Remove members now stored in `DeriveVisitor`.
* expand/rust-derive-copy.h: Likewise.
* expand/rust-derive-clone.cc (DeriveClone::DeriveClone): Update constructor.
* expand/rust-derive-copy.cc (DeriveCopy::DeriveCopy): Likewise.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-item.cc (CompileItem::visit): ensure assoicated types are setup
* typecheck/rust-hir-trait-reference.h: new interface for concrete impl block
* typecheck/rust-hir-trait-resolve.cc (AssociatedImplTrait::setup_raw_associated_types):
ensure we setup assoicated types for this impl block
2024-01-16 Dave Evans <dave@dmetwo.org>
* backend/rust-compile-expr.cc (check_match_scrutinee): Add REF type to rust_assert.
(CompileExpr::visit): Add REF type for scrutinee_kind in MatchExpr visitor.
2024-01-16 TieWay59 <tieway59@foxmail.com>
* typecheck/rust-hir-type-check-expr.cc: Remove obsolete error diagnostic
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItemWithTrait::visit):
use new interface
* typecheck/rust-type-util.cc (types_compatable): implementation of new interface
* typecheck/rust-type-util.h (types_compatable): prototype
* typecheck/rust-unify.cc (UnifyRules::expect_placeholder):
It is allow for unification against placeholders
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-expand-visitor.cc (derive_item): Add const
attribute to the trait name argument.
* expand/rust-macro-expand.h (struct MacroExpander): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-expand-visitor.cc (get_traits_to_derive): Change
assertion to allow empty derive directives.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-expand-visitor.cc (expand_attribute): Add function
to expand a given attribute on a given item.
* expand/rust-macro-expand.h (struct MacroExpander): Change
return type to ast fragment.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-expand-visitor.cc (get_traits_to_derive): Change
the function to get traits in a given attribute instead of an
attribute vector.
(ExpandVisitor::expand_struct_fields): Remove call in visitor.
(ExpandVisitor::expand_function_params): Likewise.
(ExpandVisitor::expand_closure_params): Likewise.
(ExpandVisitor::visit): Likewise.
(ExpandVisitor::expand_outer_attribute): Remove function.
(ExpandVisitor::visit_outer_attrs): Remove function.
* expand/rust-expand-visitor.h: Remove function prototypes.
(ExpandVisitor::visit_outer_attrs): Remove function.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-expand-visitor.h: Remove fragment collection fro
procedural macros.
* expand/rust-macro-expand.h (struct MacroExpander): Remove
procedural macro fragment from expander.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-fragment.cc (Fragment::Fragment): Remove
overwrite member in constructor.
(Fragment::operator=): Removal of overwrite member in copy.
(Fragment::should_overwrite): Remove overwrite getter.
* ast/rust-ast-fragment.h: Remove overwrite boolean member.
* expand/rust-expand-visitor.cc (derive_item): Add a function to
derive items using the expander for now.
(builtin_derive_item): Rename from derive_item to
builtin_derive_item.
(ExpandVisitor::visit): Remove visit to derive attributes.
(ExpandVisitor::expand_derive): Remove derive attribute visitor.
(ExpandVisitor::visit_attrs_with_derive): Likewise.
* expand/rust-expand-visitor.h: Update insertion of other kind
of proc macros. We no longer have an overwrite attribute in the
fragment.
* expand/rust-macro-expand.cc (MacroExpander::parse_procmacro_output):
Return the fragment instead of inserting it.
* expand/rust-macro-expand.h (struct MacroExpander): Return
fragment.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.h: Update enum name to match
definition.
* expand/rust-expand-visitor.cc (ExpandVisitor::expand_derive):
Add call to expander.
(ExpandVisitor::expand_outer_attribute):
Change call to macro expander.
(ExpandVisitor::expand_inner_attribute): Likewise.
* expand/rust-expand-visitor.h: Remove const attribute to match
visitor declaration. Attach result to the AST. Add condition for
item erasure.
* expand/rust-proc-macro.h: Add token collector and expansion
call. Add lexers and parsers for each proc macro type and uses
them to parse macro output.
* expand/rust-macro-expand.h (struct MacroExpander): Add
functions.
* expand/rust-proc-macro.cc (ProcMacroExpander::import_proc_macros):
Moved from here...
* expand/rust-macro-expand.cc (MacroExpander::import_proc_macros):
... to here. Unify procedural macro parsing under one function.
Add a flag to determine whether it originate from a derive
macro.
(MacroExpander::parse_procmacro_output):
Parse macro output to statements. Store an error on parsing
failure.
* Make-lang.in: Add const_TokenPtr specific lexer.
* expand/rust-proc-macro-invoc-lexer.cc: New file.
* expand/rust-proc-macro-invoc-lexer.h: New file.
* rust-session-manager.cc (Session::expansion): Remove
ProcMacroExpander declaration.
* ast/rust-ast-fragment.cc (Fragment::Fragment): Add overwrite
flag.
(Fragment::should_overwrite): Add a getter to determine whether
the fragment shall overwrite it's parent or be appended after.
* ast/rust-ast-fragment.h: Add flag to declaration.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-hir-map.cc (Mappings::insert_bang_proc_macro):
Add a function to insert a new bang proc macro.
(Mappings::lookup_bang_proc_macro): Add a function to lookup a
bang procedural macro.
(Mappings::insert_derive_proc_macro): Add a function to insert a
derive procedural macro.
(Mappings::lookup_derive_proc_macro): Add a function to lookup a
derive procedural macro.
(Mappings::insert_attribute_proc_macro): Add a function to
insert an attribute procedural macro.
(Mappings::lookup_attribute_proc_macro): Add a function to
lookup an attribute procedural macro.
* util/rust-hir-map.h: Add function prototypes.
* expand/rust-expand-visitor.cc (ExpandVisitor::expand_outer_attribute):
Implement expansion of outer attributes.
(ExpandVisitor::expand_inner_attribute):
Add call for inner attribute expansion.
* expand/rust-expand-visitor.h:
Add new procedural macro expander attribute.
* expand/rust-proc-macro.cc (load_macros_array): Add a function
to load the proc macro array from a given shared object.
(load_macros): Add a function to retrieve procedural macro
vector from a given shared object.
(ProcMacroExpander::import_proc_macros): Add a function to load
procedural macros from a given extern crate name.
* expand/rust-proc-macro.h (RUST_PROC_MACRO_H): Add new
proc-macro file.
(class ProcMacroExpander): Add new ProcMacroExpander class.
* rust-session-manager.cc (Session::expansion): Create new macro
expander and feed it to the expand visitor.
* util/rust-attributes.cc: Add macro_export builtin attribute.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Fix
attribute collection.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.h: Make trivial visitors public.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* Make-lang.in: Add rust-proc-macro object to list.
* expand/rust-proc-macro.cc: New file.
* expand/rust-proc-macro.h: New file.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-attributes.cc: Add attribute to the table.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Move
implementation from here...
* ast/rust-ast-collector.h: ... to here.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* Make-lang.in: Add "rust-dir-owner.o".
* ast/rust-ast.cc: Include "rust-dir-owner.h".
(Module::process_file_path):
Handle non-mod-rs external file modules properly.
* parse/rust-parse-impl.h: Include "rust-dir-owner.h".
(Parser::parse_module):
Handle non-mod-rs external file modules properly.
* util/rust-dir-owner.cc: New file.
* util/rust-dir-owner.h: New file.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-builtins.cc: Fix comments.
(MacroBuiltin::proc_macro_builtin): Add error message.
* expand/rust-macro-builtins.h: Fix comments.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-resolve.cc: when the bound is concrete keep the mapping
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): add missing call
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): make this the same as paths
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* util/rust-optional.h
(class Optional): Add volatile field to union.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-substitute-ctx.cc
(SubstituteCtx::substitute_metavar): Substitute crate metavar.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* parse/rust-parse-impl.h
(Parser::null_denotation): Allow struct expression referencing.
2024-01-16 Charalampos Mitrodimas <charmitro@gmail.com>
* ast/rust-ast-dump.cc (Dump::visit):
print literals based on their type.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-builtins.cc (MacroBuiltin::dummy): New function.
* expand/rust-macro-builtins.h: Declare it.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.cc (AstBuilder::struct_expr_struct): New function.
(AstBuilder::let): Likewise.
(AstBuilder::struct_expr): Likewise.
(AstBuilder::struct_expr_field): Likewise.
(AstBuilder::field_access): Likewise.
(AstBuilder::wildcard): Likewise.
* ast/rust-ast-builder.h: Likewise.
* expand/rust-derive-clone.cc (DeriveClone::visit_union): Implement
properly.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Add new files.
* expand/rust-derive.cc (DeriveVisitor::derive): Call into DeriveCopy.
* expand/rust-derive-copy.cc: New file.
* expand/rust-derive-copy.h: New file.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-derive-clone.cc (DeriveClone::visit_struct): Implement proper
cloning for structs with fields.
* ast/rust-ast-builder.cc (AstBuilder::struct_expr): New function.
(AstBuilder::struct_expr_field): Likewise.
(AstBuilder::field_access): Likewise.
(AstBuilder::let): Likewise.
* ast/rust-ast-builder.h: Declare new functions.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (convert): Use a variable instead
of multiple nested calls.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-lex.h: Make build_token method public.
* lex/rust-token.h: Add a setter for a token location.
* util/rust-token-converter.cc (convert): Add the function to
convert from a Span to a Location.
(from_ident): Convert Ident span to a Location.
(from_literal): Convert Literal span to a Location.
(from_punct): Convert Punct span to a Location.
(from_group): Convert Group span to a Location.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (convert): Add implementation.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (convert): Update call to
constructors with location information.
(handle_suffix): Convert token locus to a Span and use it in the
literal.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-expand.cc
(MacroExpander::try_match_rule): Don't match delimiters for root matcher.
(MacroExpander::match_matcher): Add option to match delimiters.
* expand/rust-macro-expand.h
(MacroExpander::match_matcher): Likewise.
* parse/rust-parse-impl.h
(Parser::skip_token): Add zero argument method.
* parse/rust-parse.h:
(Parser::skip_token): Likewise.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* Make-lang.in: remove files
* backend/rust-compile-block.h: fix headers
* backend/rust-compile-expr.h: likewise
* backend/rust-compile-fnparam.h: likewise
* backend/rust-compile-item.h: likewise
* backend/rust-compile-pattern.h: likewise
* backend/rust-compile-resolve-path.h: likewise
* backend/rust-compile-stmt.h: likewise
* typecheck/rust-autoderef.cc: likewise
* typecheck/rust-hir-path-probe.cc: likewise
* typecheck/rust-hir-path-probe.h: likewise
* typecheck/rust-hir-trait-reference.h: likewise
* typecheck/rust-hir-trait-resolve.cc: use a for loop instead
* typecheck/rust-hir-trait-resolve.h: fix headers
* typecheck/rust-hir-type-check-expr.h: likewise
* typecheck/rust-hir-type-check-implitem.h: likewise
* typecheck/rust-hir-type-check-item.h: likewise
* typecheck/rust-hir-type-check-path.cc: likewise
* typecheck/rust-hir-type-check-pattern.h: likewise
* typecheck/rust-hir-type-check-stmt.h: likewise
* typecheck/rust-hir-type-check-type.h: likewise
* typecheck/rust-hir-type-check-util.cc: Removed.
* typecheck/rust-hir-type-check-util.h: Removed.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Add new object files to Makefile.
* expand/rust-expand-visitor.cc (is_derive): Move function.
(is_builtin): Likewise.
(get_traits_to_derive): New function.
(derive_item): Likewise.
(ExpandVisitor::visit): Visit item/statements containers.
(ExpandVisitor::visit_outer_attrs): Take a reference on the attribute
instead of a copy.
(ExpandVisitor::is_derive): Deleted function.
(ExpandVisitor::is_builtin): Likewise.
* expand/rust-expand-visitor.h (RUST_EXPAND_VISITOR_H): Add missing #ifdef
guards.
(is_derive): Declare function.
(is_builtin): Likewise.
* expand/rust-macro-builtins.cc (builtin_macro_from_string): Use new
MacroBuiltin::builtins map.
(make_macro_path_str): Likewise.
* expand/rust-macro-builtins.h (enum class): Add builtin derive macros.
* expand/rust-derive-clone.cc: New file.
* expand/rust-derive-clone.h: New file.
* expand/rust-derive.cc: New file.
* expand/rust-derive.h: New file.
* util/rust-hir-map.cc (Mappings::insert_macro_def): Fix logic for
setting builtin macro transcribers.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-builder.cc: New file.
* ast/rust-ast-builder.h: New file.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-invoc-lexer.cc: Add missing copyright header.
* expand/rust-macro-substitute-ctx.cc: Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-session-manager.h:
Include "rust-optional.h".
(struct TargetOptions):
Store values in config key/value pairs as Optional<std::string> rather than std::string.
* rust-session-manager.cc
(TargetOptions::dump_target_options):
Handle Optional<std::string> values.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-casts.cc (TypeCastRules::check): do coercion
(TypeCastRules::emit_cast_error): clang-format
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* resolve/rust-ast-resolve-stmt.cc (ResolveStmt::visit): add name resolution
* resolve/rust-ast-resolve-stmt.h: likewise
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): insert resolved node
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* resolve/rust-ast-resolve-pattern.cc: remove unused
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): fix missing pop
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): remove unused
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::translate): hir lowering
(ASTLoweringStmt::visit): likewise
* hir/rust-ast-lower-stmt.h: likewise
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-substitute-ctx.cc
(SubstituteCtx::substitute_metavar): Allow substitution failure.
(SubstituteCtx::substitute_token):
Handle substitution failure, include dollar sign in count of tokens to substitute.
(SubstituteCtx::substitute_tokens):
Include dollar sign in count of tokens to substitute.
* expand/rust-macro-substitute-ctx.h
(SubstituteCtx::substitute_metavar):
Adjust signature and document new substitution failure handling.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-substitute-ctx.cc
(SubstituteCtx::check_repetition_amount):
Ignore single fragments while checking repetition amount.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): stop if error
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): fix sized options
* typecheck/rust-tyty.cc (BaseType::satisfies_bound): its ok if its an ?T
(BaseType::bounds_compatible): likewise
* typecheck/rust-tyty.h: update prototype
* typecheck/rust-unify.cc (UnifyRules::go): check both sides bounds
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (HIRCompileBase::resolve_deref_adjustment):
reuse op overload code
* typecheck/rust-autoderef.cc (Adjuster::try_deref_type): update
(Adjuster::try_raw_deref_type): likewise
* typecheck/rust-autoderef.h: likewise
* typecheck/rust-hir-dot-operator.cc (MethodResolver::select):
improve debug loging
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): refactor
* backend/rust-compile-base.h: likewise
* backend/rust-compile-expr.cc (CompileExpr::visit): likewise
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): likewise
2024-01-16 David Malcolm <dmalcolm@redhat.com>
* typecheck/rust-hir-trait-reference.cc (TraitItemReference::is_optional): Remove
stray semicolon.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::go): Cleanup
order of calls when accumulating #[macro_use] macros.
(EarlyNameResolver::visit): Likewise.
2024-01-16 Matthew Jasper <mjjasper1@gmail.com>
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::accumulate_escaped_macros):
Remove unnecessary visit.
2024-01-16 Matthew Jasper <mjjasper1@gmail.com>
* ast/rust-ast.cc (Attribute::check_cfg_predicate):
Only check first item as a predicate.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* util/rust-optional.h
(operator==): New for Optional<T> == Optional<U>.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* parse/rust-parse-impl.h
(Parser::parse_attr_input): Parse AttrInputMacro.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.cc (TokenCollector::visit): Propagate
coretype hint.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* util/rust-optional.h
(class Optional<T>): Improve inner state.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-substitute-ctx.cc
(SubstituteCtx::check_repetition_amount): Handle keywords.
(SubstituteCtx::substitute_token): Likewise.
* lex/rust-token.cc
(Token::get_str): Likewise.
* parse/rust-parse-impl.h
(Parser::parse_macro_match_fragment): Likewise.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.h: Add `outer_attrs` to Item.
* ast/rust-expr.h: Make use of new inheritance methods.
* ast/rust-item.h: Likewise.
* ast/rust-macro.h: Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (dispatch_float_literals): Remove
function.
(handle_suffix): Rename old dispatch and add one LitKind
argument.
(dispatch_integer_literals): Remove function.
(convert): Change call from dispatch to suffix handler.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-token.h: Implement hash for token id enumeration.
* util/rust-token-converter.cc (dispatch_float_literals): Update
to new internals.
(dispatch_integer_literals): Likewise.
(convert): Likewise.
(string_literal): Remove function.
(byte_string_literal): Likewise.
(unsigned_literal): Likewise.
(signed_literal): Likewise.
(from_literal): Update with new internals.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-dump.cc
(Dump::visit): Add AttrInputMacro visitor.
* ast/rust-ast-dump.h:
(Dump::visit): Likewise.
* ast/rust-ast-full-decls.h
(class AttrInputMacro): New.
* ast/rust-ast-collector.cc
(TokenCollector::visit):
Add and call out to AttrInputMacro visitor.
* ast/rust-ast-collector.h:
(TokenCollector::visit): Add AttrInputMacro visitor.
* ast/rust-ast-visitor.h:
(ASTVisitor::visit): Likewise.
* ast/rust-ast.cc
(AttrInputMacro::accept_vis): New.
(AttrInputMacro::as_string): New.
(AttrInputMacro::AttrInputMacro): New.
(AttrInputMacro::operator=): New.
* ast/rust-ast.h:
(AttrInput::AttrInputType::MACRO): New.
* ast/rust-expr.h
(class AttrInputMacro): New.
* checks/errors/rust-feature-gate.h:
(FeatureGate::visit): Add AttrInputMacro visitor.
* expand/rust-cfg-strip.cc
(CfgStrip::visit): Likewise.
* expand/rust-cfg-strip.h:
(CfgStrip::visit): Likewise.
* expand/rust-expand-visitor.cc
(ExpandVisitor::visit): Likewise.
* expand/rust-expand-visitor.h:
(ExpandVisitor::visit): Likewise.
* hir/rust-ast-lower-base.cc
(ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h:
(ASTLoweringBase::visit): Likewise.
* resolve/rust-ast-resolve-base.cc
(ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-base.h:
(ResolverBase::visit): Likewise.
* resolve/rust-early-name-resolver.cc
(EarlyNameResolver::visit): Likewise.
* resolve/rust-early-name-resolver.h:
(EarlyNameResolver::visit): Likewise.
* util/rust-attributes.cc
(AttributeChecker::visit): Likewise.
(check_doc_attribute): Handle AttrInputType::MACRO.
* util/rust-attributes.h:
(AttributeChecker::visit): Add AttrInputMacro visitor.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-macro.h
(MacroInvocation::clone_macro_invocation_impl): Make public.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* util/rust-optional.h
(struct std::hash<Optional<T>>): New.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* util/rust-optional.h
(class Optional<T&>): Use pointers internally.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-dump.cc (Dump::visit): Implement dump for
`TupleIndexExpr`.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* lex/rust-token.cc
(token_id_keyword_string): Return std::string reference.
* lex/rust-token.h
(token_id_keyword_string): Return std::string reference.
2024-01-16 Matthew Jasper <mjjasper1@gmail.com>
* ast/rust-ast.h (Expr::as_expr_without_block): Remove.
(Expr::set_outer_attrs): Make public in base class.
* expand/rust-macro-expand.cc:
Add fixme comment for pre-existing bug.
* hir/tree/rust-hir.h: Remove Expr::as_expr_without_block.
* parse/rust-parse-impl.h (Parser::parse_lifetime): Use lifetime_from_token.
(Parser::lifetime_from_token): New method.
(Parser::null_denotation): Handle labelled loop expressions and for loop expressions.
(Parser::parse_loop_label): Make initial token a parameter.
(Parser::parse_labelled_loop_expr): Likewise.
(Parser::parse_for_loop_expr): Allow FOR token to already be skipped.
(Parser::parse_expr): Handle expr_can_be_stmt.
(Parser::parse_expr_with_block): Remove.
(Parser::parse_expr_stmt_with_block): Remove.
(Parser::parse_expr_stmt_without_block): Remove.
(Parser::parse_expr_without_block): Remove.
(Parser::parse_stmt_or_expr_with_block): Remove.
(Parser::parse_expr_stmt): Use parse_expr directly.
(Parser::parse_match_expr): Likewise.
(Parser::parse_stmt): Use parse_expr_stmt in more cases.
(Parser::parse_stmt_or_expr):
Rename from parse_stmt_or_expr_without_block, use parse_expr directly.
(Parser::parse_block_expr): Update error message.
* parse/rust-parse.h: Update declarations.
2024-01-16 Matthew Jasper <mjjasper1@gmail.com>
* ast/rust-ast-full-decls.h (class ExprStmtWithoutBlock): Remove.
(class ExprStmtWithBlock): Remove.
* ast/rust-stmt.h (class ExprStmtWithoutBlock): Remove.
(class ExprStmtWithBlock): Remove.
(class ExprStmt):
Make non-abstract, add common functionality from removed base classes.
* ast/rust-ast.h: Move to_stmt to base class.
* ast/rust-ast.cc (ExprStmtWithBlock::as_string): Remove.
* ast/rust-macro.h: Use new signature for to_stmt.
(ExprStmt::as_string): New method.
(ExprStmtWithoutBlock::as_string): Remove.
(BlockExpr::strip_tail_expr): Update for removed classes.
(ExprStmtWithoutBlock::accept_vis): Remove.
(ExprStmtWithBlock::accept_vis): Remove.
(ExprStmt::accept_vis): New method.
* ast/rust-ast-dump.cc (Dump::visit): Update for removed classes.
* ast/rust-ast-dump.h: Likewise.
* ast/rust-ast-collector.h: Likewise.
* ast/rust-ast-collector.cc (TokenStream::visit): Likewise.
* ast/rust-ast-visitor.h: Likewise.
* checks/errors/rust-feature-gate.h: Likewise.
* expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise.
* expand/rust-expand-visitor.h: Likewise.
* expand/rust-cfg-strip.cc (CfgStrip::visit): Likewise.
* expand/rust-cfg-strip.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Likewise.
* hir/rust-ast-lower-stmt.h: Likewise.
* util/rust-attributes.cc (AttributeChecker::visit): Likewise.
* util/rust-attributes.h: Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
Likewise.
* resolve/rust-early-name-resolver.h: Likewise.
* parse/rust-parse-impl.h (Parser::parse_match_expr): Likewise.
(Parser::parse_stmt_or_expr_without_block): Likewise.
* parse/rust-parse.h: Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* lex/rust-token.cc
(token_id_is_keyword): New.
(token_id_keyword_string): New.
* lex/rust-token.h
(token_id_is_keyword): New.
(token_id_keyword_string): New.
* expand/rust-macro-expand.cc
(MacroExpander::match_fragment): Match keywords for ident fragment.
* parse/rust-parse-impl.h
(Parser::parse_identifier_or_keyword_token): Add.
* parse/rust-parse.h
(Parser::parse_identifier_or_keyword_token): Add.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (dispatch_float_literals): Invert
suffix condition.
(dispatch_integer_literals): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (convert): Fix style.
(from_ident): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (dispatch_float_literals): Make
input immutable.
(dispatch_integer_literals): Likewise.
(convert): Likewise.
* util/rust-token-converter.h (convert): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (from_tokenstream): Add
conversion of Ident structures.
(from_ident): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (from_literal): Add function
implementation.
(string_literal): String literal specific handler.
(byte_string_literal): Byte string specific handler.
(unsigned_literal): Unsigned literal specific handler.
(signed_literal): Signed literal specific handler.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (from_punct): Add conversion
implementation.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (dispatch_float_literals): Accept
const_TokenPtr instead of TokenPtr.
(dispatch_integer_literals): Likewise.
(convert): Accept vector of const_TokenPtr instead of a vector
of TokenPtr.
* util/rust-token-converter.h (convert): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (from_tokenstream): Add vector
for joined punct accumulation.
(from_ident): Accept const pointer vector.
(from_literal): Likewise.
(from_punct): Likewise.
(from_group): Likewise.
(from_tokentree): Likewise.
(convert): Likewise.
* util/rust-token-converter.h (convert): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (from_tokenstream): Add call to
from_tokentree.
(from_tokentree): Add implementation, from the from_tokenstream
function.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (from_punct): Add group
conversion.
(from_group): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (to_tokenstream): Change function
name from to_tokenstream to convert.
(convert): Likewise.
(from_tokenstream): Add tokenstream handler.
(from_ident): Add empty function.
(from_literal): Likewise.
(from_punct): Likewise.
(from_group): Likewise.
* util/rust-token-converter.h (to_tokenstream): Change function
name from to_tokenstream to convert.
(convert): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* util/rust-token-converter.cc (dispatch_float_literals): Remove
suffixed temporary variable.
(dispatch_integer_literals): Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* Make-lang.in: Add new rust-token-converter file.
* ast/rust-ast-collector.cc (pop_group): Function moved from
TokenCollector.
(dispatch_float_literals): Likewise.
(dispatch_integer_literals): Likewise.
(TokenCollector::collect): Removed function.
* ast/rust-ast-collector.h: Removed function prototype.
* util/rust-token-converter.cc: New file.
* util/rust-token-converter.h: New file.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-collector.h (RUST_AST_TOKENSTREAM_H): Rename
headerguard from RUST_AST_TOKENSTREAM_H ...
(RUST_AST_COLLECTOR_H): ... to RUST_AST_COLLECTOR_H.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* Make-lang.in: Change file name.
* ast/rust-ast-tokenstream.cc: Moved to...
* ast/rust-ast-collector.cc: ...here.
* ast/rust-ast-tokenstream.h: Moved to...
* ast/rust-ast-collector.h: ...here.
* rust-session-manager.cc: Change header name.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::TokenStream): Rename
TokenStream to TokenCollector.
(TokenCollector::TokenCollector): Likewise.
(TokenStream::collect_tokens): Likewise.
(TokenCollector::collect_tokens): Likewise.
(TokenStream::collect): Likewise.
(TokenCollector::collect): Likewise.
(TokenStream::visit): Likewise.
(TokenCollector::visit): Likewise.
(TokenStream::visit_items_joined_by_separator): Likewise.
(TokenCollector::visit_items_joined_by_separator): Likewise.
(TokenStream::visit_as_line): Likewise.
(TokenCollector::visit_as_line): Likewise.
(TokenStream::visit_items_as_lines): Likewise.
(TokenCollector::visit_items_as_lines): Likewise.
(TokenStream::visit_items_as_block): Likewise.
(TokenCollector::visit_items_as_block): Likewise.
(TokenStream::trailing_comma): Likewise.
(TokenCollector::trailing_comma): Likewise.
(TokenStream::newline): Likewise.
(TokenCollector::newline): Likewise.
(TokenStream::indentation): Likewise.
(TokenCollector::indentation): Likewise.
(TokenStream::increment_indentation): Likewise.
(TokenCollector::increment_indentation): Likewise.
(TokenStream::decrement_indentation): Likewise.
(TokenCollector::decrement_indentation): Likewise.
(TokenStream::visit_closure_common): Likewise.
(TokenCollector::visit_closure_common): Likewise.
(TokenStream::visit_loop_common): Likewise.
(TokenCollector::visit_loop_common): Likewise.
(TokenStream::visit_function_common): Likewise.
(TokenCollector::visit_function_common): Likewise.
* ast/rust-ast-tokenstream.h (class TokenStream): Likewise.
(class TokenCollector): Likewise.
* rust-session-manager.cc (Session::dump_tokenstream): Rename
token vector for clearer intent.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (dispatch_float_literals): Add
dispatch function for floating point literals.
(TokenStream::collect): Add call to dispatcher.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (dispatch_integer_literals):
Add a static function to dispatch depending on the core type.
(TokenStream::collect): Add call to dispatch function.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::collect): Add
conversion for byte string and string.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::collect): Add Ident
conversion.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::collect): Add joint
punct token conversion.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::collect): Add
conversion for single punctuation tokens.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (pop_group): Add a function to
easily collect a group from a given stack at the end of it.
(TokenStream::collect): Collect tokens as a rust compatible
Tokenstream type.
* ast/rust-ast-tokenstream.h (RUST_AST_TOKENSTREAM_H): Move
includes to stay constrained by guards.
2024-01-16 M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
* ast/rust-ast-full-decls.h (enum class): Added declaration.
(struct AnonConst): Added declaration.
(struct InlineAsmRegOrRegClass): Added declaration.
(struct InlineAsmOperand): Added declaration.
(struct InlineAsmPlaceHolder): Added declaration.
(struct InlineAsmTemplatePiece): Added declaration.
(struct TupleClobber): Added declaration.
(struct TupleTemplateStr): Added declaration.
* ast/rust-expr.h (class InlineAsm): Defined all it's data members outside.
(enum class InlineAsmOptions): Converted this to a enum class so we could use it in the HIR.
(struct AnonConst): Defined it independent of the AST::InlineAsm node.
(struct InlineAsmRegOrRegClass): Defined it independent of the AST::InlineAsm node.
(struct InlineAsmOperand): Defined it independent of the AST::InlineAsm node.
(struct InlineAsmPlaceHolder): Defined it independent of the AST::InlineAsm node.
(struct InlineAsmTemplatePiece): Defined it independent of the AST::InlineAsm node.
(struct TupleClobber): Defined it independent of the AST::InlineAsm node.
(struct TupleTemplateStr): Defined it independent of the AST::InlineAsm node.
* hir/tree/rust-hir-expr.h (class InlineAsmReg): Added defination.
(class InlineAsmRegClass): Added defination.
(struct InlineAsmRegOrRegClass): Added defination.
(class InlineAsm): Added defination.
* hir/tree/rust-hir-full-decls.h (class InlineAsmReg): Added declaration.
(class InlineAsmRegClass): Added declaration.
(struct InlineAsmRegOrRegClass): Added declaration.
(class InlineAsm): Added declaration.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.cc: track return type in fncontext
* backend/rust-compile-context.h (struct fncontext): likewise
* backend/rust-compile-expr.cc (CompileExpr::visit): apply coercion site
(CompileExpr::generate_closure_function): update push_context
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.cc (HIRCompileBase::compile_function_body):
add missing coercion_site codegen
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): refactr
(CompileExpr::get_fn_addr_from_dyn): likewise
(CompileExpr::get_receiver_from_dyn): likewise
(CompileExpr::type_cast_expression): likewise
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): likewise
(TyTyResolveCompile::create_dyn_obj_record): likewise
(TyTyResolveCompile::create_slice_type_record): likewise
(TyTyResolveCompile::create_str_type_record): likewise
* backend/rust-compile-type.h: likewise
* backend/rust-compile.cc (HIRCompileBase::coercion_site1): likewise
(HIRCompileBase::coerce_to_dyn_object): refactor
* backend/rust-tree.h (SLICE_FLAG): removed
(SLICE_TYPE_P): removed
(RS_DST_FLAG): new flag
(RS_DST_FLAG_P): new predicate
* typecheck/rust-tyty.cc (ReferenceType::is_dyn_object): new helper
(ReferenceType::is_dyn_obj_type): likewise
(PointerType::is_dyn_object): likewise
(PointerType::is_dyn_obj_type): likewise
* typecheck/rust-tyty.h (class DynamicObjectType): moved up
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): add filter
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.cc (HIRCompileBase::compile_function_body): use unit_expression
(HIRCompileBase::unit_expression): new helper
* backend/rust-compile-base.h: update prototype
* backend/rust-compile-block.cc (CompileBlock::visit): use unit_expression
* backend/rust-compile-expr.cc (CompileExpr::visit): likewise
(CompileExpr::generate_closure_function): likewise
* backend/rust-compile-implitem.cc (CompileTraitItem::visit): cleanup
* backend/rust-compile-item.cc (CompileItem::visit): likewise
* backend/rust-compile-pattern.cc (CompilePatternLet::visit): likewise
* backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve): likewise
* backend/rust-compile-type.cc (TyTyResolveCompile::get_unit_type): new helper
(TyTyResolveCompile::visit): use new unit_type helper
* backend/rust-compile-type.h: likewise
* rust-backend.h: simplify the return_expression
* rust-gcc.cc (Gcc_backend::function_type): likewise
(Gcc_backend::return_statement): likewise
* backend/rust-constexpr.cc (eval_constant_expression): remove bad assertion
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* checks/lints/rust-lint-unused-var.cc (UnusedVariables::Lint): use the decl not the expr
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* parse/rust-parse-impl.h
(Parser::parse_trait_impl_function_or_method):
Parse function/method qualifiers after "default".
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.cc: add missing compile_locals call
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.h (class AttrInputMetaItemContainer): Run clang-format.
(class DelimTokenTree): Likewise.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-early-name-resolver.cc (is_macro_use_module): New function.
(EarlyNameResolver::accumulate_escaped_macros): New function.
(EarlyNameResolver::go): Use `accumulate_escaped_macros`.
(EarlyNameResolver::visit): Likewise.
* resolve/rust-early-name-resolver.h: Declare `accumulate_escaped_macros`.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.h: Add take_items() and set_items() method to Crate.
* ast/rust-item.h: Add take_items() and set_items() method to Module.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.h (enum Kind): Add MODULE variant.
* ast/rust-item.h: Return Kind::MODULE in AST::Module::get_kind().
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-macro.cc (builtin_macro_from_string): Move function.
* ast/rust-macro.h (enum class): Move enum.
(builtin_macro_from_string): Move function.
* expand/rust-macro-builtins.cc (builtin_macro_from_string): New function.
(make_macro_path_str): Use new bi-map.
(parse_single_string_literal): Use new `BuiltinMacro` enum.
(MacroBuiltin::include_bytes_handler): Likewise.
(MacroBuiltin::include_str_handler): Likewise.
(MacroBuiltin::compile_error_handler): Likewise.
(MacroBuiltin::concat_handler): Likewise.
(MacroBuiltin::env_handler): Likewise.
(MacroBuiltin::include_handler): Likewise.
(MacroBuiltin::sorry): New function.
* expand/rust-macro-builtins.h (enum class): Move enum here.
(builtin_macro_from_string): New function declaration.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Use
new function.
* util/rust-hir-map.cc (Mappings::insert_macro_def): Remove old
builtin macro map.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-builtins.cc: Include bidirectional map.
* util/bi-map.h: New file.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast.cc
(BlockExpr::strip_tail_expr):
Try to take new tail expression from statements list.
* ast/rust-expr.h
(BlockExpr::strip_tail_expr):
Replace definition with only declaration.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast.h
(Stmt::is_expr): New.
* ast/rust-stmt.h
(ExprStmt::is_expr): New.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-substitute-ctx.cc
(SubstituteCtx::substitute_repetition): Fix out-of-bounds.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* Make-lang.in: Link against the static libproc_macro.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lang.opt: Add frust-extern option.
* rust-session-manager.cc (Session::handle_extern_option): Add
frust-extern option handler.
* rust-session-manager.h (struct Session): Add an unordered map
to store library name and locations.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* parse/rust-parse-impl.h
(Parser::parse_generic_params):
Handle parameter parsing error.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-expr.cc: update for op overload
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): use the predicate
(TypeCheckExpr::resolve_segments): cleanup
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-reference.cc (AssociatedImplTrait::AssociatedImplTrait):
bind the predicate
(AssociatedImplTrait::get_trait): remove
(AssociatedImplTrait::get_predicate): new getter
* typecheck/rust-hir-trait-reference.h: bind predicate
* typecheck/rust-hir-type-check-item.cc: update ctor
* typecheck/rust-type-util.cc (lookup_associated_impl_block): new function
* typecheck/rust-type-util.h (class BaseType): remove unused forward decl
(lookup_associated_impl_block): new helper
* typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::is_equal): new
* typecheck/rust-tyty-subst.cc (SubstitutionRef::lookup_associated_impl): use new helper
(SubstitutionRef::monomorphize): update usage/error handling
* typecheck/rust-tyty-subst.h: remove old prototype
* typecheck/rust-tyty.h: add is_equal decl
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-hir-type-check-pattern.cc
(TypeCheckPattern::visit): Type check StructPatternFieldIdentPat.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* hir/rust-ast-lower-pattern.cc
(ASTLoweringPattern::visit): Lower StructPatternFieldIdentPat.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::resolve_fn_trait_call):
return the assoicated predicate
* typecheck/rust-hir-type-check-expr.h: update prototype
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* hir/rust-ast-lower-implitem.h: add missing where clause lowering
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* hir/tree/rust-hir-item.h: add get_locus() const
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* hir/tree/rust-hir-pattern.h
(StructPatternFieldIdentPat::get_identifier): New.
(StructPatternFieldIdentPat::get_pattern): New.
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* ast/rust-ast-dump.cc (Dump::visit): print parentheses around
unique expression operand.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* rust-session-manager.cc
(Session::enable_dump): Fix error messages.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch): new error method
(UnifyRules::expect_fndef): add ABI check
* typecheck/rust-unify.h: prototype for new error method
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* util/rust-abi.cc (get_abi_from_string): add ABI mapping
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* hir/tree/rust-hir-pattern.h: add missing get_mutability
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
use new ClosureParamInfer on untyped parameters
* typecheck/rust-hir-type-check-pattern.cc (ClosureParamInfer::Resolve): interface
(ClosureParamInfer::ClosureParamInfer): constructor
(ClosureParamInfer::visit): visitors for each pattern
* typecheck/rust-hir-type-check-pattern.h (class ClosureParamInfer): new visitor
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-pattern.h: cleanup
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
return so we dont hit undefined behaviour
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-implitem.h: remove includes
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-item.cc (CompileItem::visit): remove bad checks
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* lang.opt: add lang option flag
* rust-lang.cc (grs_langhook_init_options_struct): enable by default
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::operator=):
we are done if other is in an error state
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-dot-operator.cc (MethodResolver::select): verify it is a method
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): use new interface
* typecheck/rust-hir-type-check-base.h: update prototype to include Self
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): lifewise
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::resolve_impl_block_substitutions):
likewise
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): likewise
(TypeCheckExpr::resolve_segments): likewise
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise
(TypeResolveGenericParam::visit): likewise
(ResolveWhereClauseItem::visit): likewise
* typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound): likewise
(TypeBoundPredicate::apply_generic_arguments): likewise
(TypeBoundsMappings::lookup_predicate): likewise
* typecheck/rust-tyty-bounds.h: likewise
* typecheck/rust-tyty.h:likewise
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check.h: New error state and missing copy implementations
* typecheck/rust-typecheck-context.cc (TypeCheckContextItem::TypeCheckContextItem):
missing copy ctor
(TypeCheckContextItem::operator=): missing copy implementation
(TypeCheckContextItem::get_error): new static function
(TypeCheckContextItem::is_error): new method
(TypeCheckContextItem::get_context_type): handle error state
(TypeCheckContextItem::get_defid): handle error state
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check.h: new helper
* typecheck/rust-typecheck-context.cc (TypeCheckContext::have_function_context):
implementation
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check.h: Add prototype
* typecheck/rust-typecheck-context.cc (TypeCheckContextItem::get_defid): implementation
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-expr.cc: refactor
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-autoderef.cc: don't take a reference
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise
* typecheck/rust-hir-type-check.h: remove reference
* typecheck/rust-typecheck-context.cc (TypeCheckContext::pop_return_type): likewise
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-ast-resolve-pattern.cc
(PatternDeclaration::visit): Handle StructPatternFieldIdentPat.
2024-01-16 TieWay59 <tieway59@foxmail.com>
PR translation/108890
* lang.opt: Fix translation mistakes 2023 in
GCC/Rust [PR108890]
(line 67): change the inconsistent tab to spaces
(line 75): wrap bare placeholder `integer`
(line 79): remove redundant text of `Choose which`
(line 96): remove redundant text of `Choose which`
(line 112): remove redundant `Flag to`
(line 124): correct the exclusive term `When to stop`
(line 124): correct typo of `copimlation`
2024-01-16 M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
* parse/rust-parse-impl.h (Parser::debug_dump_ast_output): Removed this funtion.
* rust-session-manager.cc (Session::enable_dump): Removed else if (arg == "parse").
(Session::compile_crate): Removed calls of dump_ast and dump_ast_expanded.
(Session::dump_ast): Removed this function.
(Session::dump_ast_expanded): Removed this function.
* rust-session-manager.h (struct CompileOptions): Removed the PARSER_AST_DUMP option.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_reference_pattern): Do not
call into `parse_pattern` anymore.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* hir/rust-ast-lower-pattern.cc
(ASTLoweringPattern::translate): Add is_let_top_level parameter.
(ASTLoweringPattern::visit): Handle is_let_top_level.
* hir/rust-ast-lower-pattern.h
(class ASTLoweringPattern): Add is_let_top_level.
* hir/rust-ast-lower-stmt.cc
(ASTLoweringStmt::visit): Set is_let_top_level.
2024-01-16 Zheyuan Chen <sephirotheca17@gmail.com>
* ast/rust-ast-dump.cc: fix bad formatting for associated type.
2024-01-16 Sergey Bugaev <bugaevc@gmail.com>
* hir/rust-ast-lower-expr.h, hir/rust-ast-lower-expr.cc:
Lower AST::ErrorPropagationExpr to HIR::ErrorPropagationExpr
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Fix scope
resolution token output.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Keep
associated type.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit_function_common):
Fix function body output.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_outer_attribute): Fix
attribute status.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-token.cc (Token::as_string): Fix lifetime string
representation.
2024-01-16 Sergey Bugaev <bugaevc@gmail.com>
* resolve/rust-ast-resolve-expr.cc: Add "break rust" Easter egg
2024-01-16 Sergey Bugaev <bugaevc@gmail.com>
* resolve/rust-ast-resolve-expr.h,
resolve/rust-ast-resolve-expr.cc: Add ResolveExpr::funny_error
2024-01-16 Sergey Bugaev <bugaevc@gmail.com>
* ast/rust-ast.h: Add AST::Kind::IDENTIFIER
2024-01-16 Sergey Bugaev <bugaevc@gmail.com>
* ast/rust-ast.h (Kind): Convert into a C++ enum class
* expand/rust-macro-builtins.cc: Adapt to the change
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-hir-type-check-expr.cc
(TypeCheckExpr::visit): Add implementation for IfLetExprConseqElse.
* typecheck/rust-hir-type-check-expr.h:
(TypeCheckExpr::visit): Remove stub implementation for IfLetExprConseqElse.
* hir/rust-ast-lower-expr.cc
(ASTLoweringExpr::visit): Lower IfLetExpr{,ConseqElse}.
* hir/rust-ast-lower-expr.h:
(ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-block.h
(ASTLoweringIfLetBlock::visit): Lower IfLetExprConseqElse.
(ASTLoweringExprWithBlock::visit): Likewise.
* hir/rust-ast-lower.cc
(ASTLoweringIfLetBlock::visit): Lower IfLetExprConseqElse.
* hir/tree/rust-hir-expr.h
(IfLetExprConseqElse::IfLetExprConseqElse): Make constructor more general.
(IfLetExprConseqElse::vis_else_block): Add.
(IfLetExprConseqElse::get_else_block): Add.
* resolve/rust-ast-resolve-expr.cc
(ResolveExpr::visit): Add IfLetExprConseqElse visitor.
* resolve/rust-ast-resolve-expr.h
(ResolveExpr::visit): Add IfLetExprConseqElse visitor.
2024-01-16 Sebastian Kirmayer <gnu@kirmayer.eu>
* parse/rust-parse-impl.h
(Parser<ManagedTokenSource>::parse_macro_match_repetition):
reject separator in `?` repetition
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-expr.h
(class IfLetExprConseqElse): Make else_block ExprWithBlock.
(class IfLetExprConseqIf): Remove.
(class IfLetExprConseqIfLet): Remove.
* ast/rust-ast-full-decls.h
(class IfLetExprConseqIf): Remove.
(class IfLetExprConseqIfLet): Remove.
* ast/rust-ast.cc
(IfLetExprConseqElse::as_string): Adjust output.
(IfLetExprConseqIf::as_string): Remove.
(IfLetExprConseqIfLet::as_string): Remove.
(IfLetExprConseqIf::accept_vis): Remove.
(IfLetExprConseqIfLet::accept_vis): Remove.
* ast/rust-ast-visitor.h
(ASTVisitor::visit): Remove IfLetExprConseqIf{,Let} visitors.
* ast/rust-ast-dump.cc
(Dump::visit): Likewise.
* ast/rust-ast-dump.h:
(Dump::visit): Likewise.
* ast/rust-ast-tokenstream.cc
(TokenStream::visit): Likewise.
* ast/rust-ast-tokenstream.h
(TokenStream::visit): Likewise.
* util/rust-attributes.cc
(AttributeChecker::visit): Likewise.
* util/rust-attributes.h:
(AttributeChecker::visit): Likewise.
* resolve/rust-early-name-resolver.cc
(EarlyNameResolver::visit): Likewise.
* resolve/rust-early-name-resolver.h
(EarlyNameResolver::visit): Likewise.
* resolve/rust-ast-resolve-base.h
(ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-base.cc
(ResolverBase::visit): Likewise.
* checks/errors/rust-feature-gate.h
(FeatureGate::visit): Likewise.
* expand/rust-cfg-strip.cc
(CfgStrip::visit): Likewise.
* expand/rust-cfg-strip.h:
(CfgStrip::visit): Likewise.
* expand/rust-expand-visitor.cc
(ExpandVisitor::visit): Likewise.
* expand/rust-expand-visitor.h
(ExpandVisitor::visit): Likewise.
* hir/rust-ast-lower-base.cc
(ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h:
(ASTLoweringBase::visit): Likewise.
* parse/rust-parse-impl.h
(Parser::parse_if_let_expr): Replace IfLetExprConseqIf{,Let} with IfLetExprConseqElse.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Add struct
name and curly braces to output tokenstream.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* parse/rust-parse-impl.h
(Parser::parse_macro_match): Handle underscore.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* hir/tree/rust-hir-full-decls.h
(class ExprStmtWithoutBlock): Remove.
(class ExprStmtWithBlock): Remove.
* hir/tree/rust-hir-stmt.h
(class ExprStmt):
Add remaining ExprStmtWith{,out}Block functionality.
(class ExprStmtWithoutBlock): Remove.
(class ExprStmtWithBlock): Remove.
* hir/rust-ast-lower-stmt.cc
(ASTLoweringStmt::visit):
Lower to HIR::ExprStmt instead of deriving class.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-stmt.cc
(CompileStmt::visit): Unify ExprStmtWith{,out}Block visitors.
* backend/rust-compile-stmt.h
(CompileStmt::visit): Likewise.
* backend/rust-compile-item.h
(CompileItem::visit): Likewise.
* hir/rust-hir-dump.cc
(Dump::visit): Likewise.
* hir/rust-hir-dump.h
(Dump::visit): Likewise.
* hir/tree/rust-hir-stmt.h
(ExprStmt::accept_vis): Add.
(ExprStmtWithoutBlock::accept_vis): Remove.
(ExprStmtWithBlock::accept_vis): Remove.
* hir/tree/rust-hir.cc
(ExprStmt::accept_vis): Add.
(ExprStmtWithoutBlock::accept_vis): Remove.
(ExprStmtWithBlock::accept_vis): Remove.
* hir/tree/rust-hir-visitor.h
(HIRFullVisitor::visit): Likewise.
(HIRFullVisitorBase::visit): Likewise.
(HIRStmtVisitor::visit): Likewise.
* checks/errors/rust-const-checker.cc
(ConstChecker::visit): Likewise.
* checks/errors/rust-const-checker.h
(ConstChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.cc
(UnsafeChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.h
(UnsafeChecker::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h
(PrivacyReporter::visit): Likewise.
* checks/lints/rust-lint-marklive.h
(MarkLive::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.cc
(TypeCheckStmt::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.h
(TypeCheckStmt::visit): Likewise.
* typecheck/rust-tycheck-dump.h
(TypeResolverDump::visit): Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* hir/tree/rust-hir-stmt.h
(ExprStmt::expr): Add field.
(ExprStmt::get_expr): Add method.
(ExprStmt::ExprStmt): Add copy/move constructors, modify existing constructor.
(ExprStmt::operator=): Add assignment operator.
(ExprStmtWithoutBlock::expr): Remove field.
(ExprStmtWithoutBlock::get_expr): Remove method.
(ExprStmtWithoutBlock::ExprStmt):
Remove copy/move constructors, modify existing constructor.
(ExprStmtWithoutBlock::operator=): Remove assignment operator.
(ExprStmtWithBlock::expr): Remove field.
(ExprStmtWithBlock::get_expr): Remove method.
(ExprStmtWithBlock::ExprStmt): Remove copy/move constructors, modify existing constructor.
(ExprStmtWithBlock::operator=): Remove assignment operator.
(ExprStmt::as_string): Add method.
(ExprStmtWithBlock::as_string): Remove method.
(ExprStmtWithoutBlock::as_string): Remove method.
* hir/tree/rust-hir.cc
(ExprStmt::as_string): Add method.
(ExprStmtWithBlock::as_string): Remove method.
(ExprStmtWithoutBlock::as_string): Remove method.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-expr.h
(class IfExprConseqElse): Make else_block ExprWithBlock.
(class IfExprConseqIf): Remove.
(class IfExprConseqIfLet): Remove.
* ast/rust-ast-full-decls.h
(class IfExprConseqIf): Remove.
(class IfExprConseqIfLet): Remove.
* ast/rust-ast.cc
(IfExprConseqElse::as_string): Adjust output.
(IfExprConseqIf::as_string): Remove.
(IfExprConseqIfLet::as_string): Remove.
(IfExprConseqIf::accept_vis): Remove.
(IfExprConseqIfLet::accept_vis): Remove.
* ast/rust-ast-visitor.h
(ASTVisitor::visit): Remove IfExprConseqIf{,Let} visitors.
* ast/rust-ast-tokenstream.cc
(TokenStream::visit): Likewise.
* ast/rust-ast-tokenstream.h
(TokenStream::visit): Likewise.
* ast/rust-ast-dump.cc
(Dump::visit): Likewise.
* ast/rust-ast-dump.h
(Dump::visit): Likewise.
* checks/errors/rust-feature-gate.h
(FeatureGate::visit): Likewise.
* util/rust-attributes.cc
(AttributeChecker::visit): Likewise.
* util/rust-attributes.h
(AttributeChecker::visit): Likewise.
* resolve/rust-early-name-resolver.cc
(EarlyNameResolver::visit): Likewise.
* resolve/rust-early-name-resolver.h
(EarlyNameResolver::visit): Likewise.
* resolve/rust-ast-resolve-base.h
(ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-base.cc
(ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-expr.h
(ResolveExpr::visit): Remove IfExprConseqIf visitor.
* resolve/rust-ast-resolve-expr.cc
(ResolveExpr::visit): Likewise.
* expand/rust-cfg-strip.cc
(CfgStrip::visit): Remove IfExprConseqIf{,Let} visitors.
* expand/rust-cfg-strip.h
(CfgStrip::visit): Likewise.
* expand/rust-expand-visitor.cc
(ExpandVisitor::visit): Likewise.
* expand/rust-expand-visitor.h
(ExpandVisitor::visit): Likewise.
* hir/rust-ast-lower-base.cc
(ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h
(ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-block.h
(ASTLoweringIfBlock::visit): Remove IfExprConseqIf visitor.
(ASTLoweringExprWithBlock::visit): Likewise.
* hir/rust-ast-lower.cc
(ASTLoweringIfBlock::visit):
Remove IfExprConseqIf visitor, adjust IfExprConseqElse lowering.
* hir/rust-ast-lower-expr.h
(ASTLoweringExpr::visit): Remove IfExprConseqIf visitor.
* hir/rust-ast-lower-expr.cc
(ASTLoweringExpr::visit): Likewise.
* parse/rust-parse-impl.h
(Parser::parse_if_expr): Replace IfExprConseqIf{,Let} with IfExprConseqElse.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Fix inner
attribute tokenstream output.
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
* ast/rust-ast-dump.cc (Dump::debug): New.
* ast/rust-ast-dump.h (Dump::debug): Untemplate it.
(debug): New.
* ast/rust-ast.h (class Visitable): New.
(class TokenTree): Inherit from Visitable.
(class MacroMatch): Likewise.
(class AttrInput): Likewise.
(class MetaItemInner): Likewise.
(class Pattern): Likewise.
(classTypeParamBound): Likewise.
(class GenericParam): Likewise.
(class TraitItem): Likewise.
(classInherentImplItem): Likewise.
(class TraitImplItem): Likewise.
(class ExternalItem): Likewise.
(class SingleASTNode): Likewise.
2024-01-16 Thomas Schwinge <thomas@codesourcery.com>
* rust-lang.cc (grs_langhook_type_for_mode): Placate clang-format.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h: Add boolean for differenciation.
* parse/rust-parse-impl.h (Parser::parse_doc_comment): Change
function interface to make code cleaner. It should return a body
instead of the whole attribute.
(Parser::parse_inner_attribute): Specify the inner status of the
node.
(Parser::parse_attribute_body): Change function interface to
make the code cleaner much like parse_doc_comment.
(Parser::parse_outer_attribute): Specify outer status of the
node.
* parse/rust-parse.h: Update functions prototypes.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile):
reuse resolve_method_address to monomorphize the call if required
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments):
allow matching against unimplemented trait item bounds
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-path-probe.cc: dont subst with a dynamic object
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): moved here
* backend/rust-compile-base.h: refactored prototype
* backend/rust-compile-expr.cc (CompileExpr::resolve_method_address): refactor
* backend/rust-compile-expr.h: likewise
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): remove unused
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): call destructure
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (CompileExpr::resolve_method_address):
call path probe impl trait
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-expand-visitor.cc (ExpandVisitor::visit): Add call
to attribute expansion function.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-expand-visitor.cc (ExpandVisitor::visit_outer_attrs):
Change condition order.
(ExpandVisitor::visit_inner_using_attrs): Likewise.
(ExpandVisitor::visit_attrs_with_derive): Likewise.
(ExpandVisitor::is_builtin): Add builtin identification
function.
* expand/rust-expand-visitor.h: Add function prototype.
* util/rust-attributes.cc: Add missing rustc_builtin_macro
attribute.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-expand-visitor.cc (ExpandVisitor::expand_struct_fields):
Add call to expand structu fields.
(ExpandVisitor::expand_function_params): Add call to expand
function parameters.
(ExpandVisitor::expand_closure_params): Add call to expand
closure parameters.
(ExpandVisitor::visit): Add calls for item outer attribute
expansions.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-expand-visitor.cc (ExpandVisitor::expand_outer_attribute):
Stub for a single attribute expansion.
(ExpandVisitor::visit_outer_attrs): Visit the attributes to
expand on a given item.
* expand/rust-expand-visitor.h: Add function prototypes.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast.h: Add getter to Expr class.
* ast/rust-expr.h: Add override attribute to existing getters.
Also implement it for RangeExpr, attempting to retrieve outer
attributes on those types will crash the compiler.
* ast/rust-macro.h: Add override attribute to existing getters.
* ast/rust-path.h: Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-expand-visitor.cc (ExpandVisitor::visit): Add call
to inner attribute stub.
(ExpandVisitor::expand_inner_attribute): Expand one single
attribute.
(ExpandVisitor::visit_inner_using_attrs): Expand a given item
using a vector of attributes.
(ExpandVisitor::visit_inner_attrs): Visit inner attributes of a
given item.
* expand/rust-expand-visitor.h: Add function prototypes.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* expand/rust-expand-visitor.cc (ExpandVisitor::visit): Add call
to derive expander.
(ExpandVisitor::expand_derive): Expand a single derive.
(ExpandVisitor::visit_attrs_with_derive): Visit an item with
derive attributes.
(ExpandVisitor::is_derive): Identify a derive attribute.
* expand/rust-expand-visitor.h: Add function prototypes.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Fix ICE.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Remove
default separator.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Visit inner
attributes.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Change token
type.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Fix existing
and implement remaining attribute visitors.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Add visitor
to the union's outer attributes.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Add call to
inner attribute visitor.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Fix ICE.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Make comma
mandatory.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Remove
additional semicolon output.
* ast/rust-ast-tokenstream.h: Change block visitor prototype
with a default value for trailing tokens.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* Make-lang.in: Add two new files to the list of sources.
* ast/rust-ast-full.h: Add new ast formatting header.
* ast/rust-ast.cc (enum indent_mode): Move formatting function
to it's own file.
(indent_spaces): Likewise.
(get_string_in_delims): Likewise.
(enum AttrMode): Likewise.
(get_mode_dump_desc): Likewise.
(append_attributes): Likewise.
(unquote_string): Likewise.
(GroupedExpr::as_string): Move pattern implementation to it's
own file.
(RangePattern::as_string): Likewise.
(RangePatternBoundLiteral::as_string): Likewise.
(SlicePattern::as_string): Likewise.
(AltPattern::as_string): Likewise.
(TuplePatternItemsMultiple::as_string): Likewise.
(TuplePatternItemsRanged::as_string): Likewise.
(TuplePattern::as_string): Likewise.
(StructPatternField::as_string): Likewise.
(StructPatternFieldIdent::as_string): Likewise.
(StructPatternFieldTuplePat::as_string): Likewise.
(StructPatternFieldIdentPat::as_string): Likewise.
(StructPatternElements::as_string): Likewise.
(StructPattern::as_string): Likewise.
(LiteralPattern::as_string): Likewise.
(ReferencePattern::as_string): Likewise.
(IdentifierPattern::as_string): Likewise.
(TupleStructItemsNoRange::as_string): Likewise.
(TupleStructItemsRange::as_string): Likewise.
(TupleStructPattern::as_string): Likewise.
(GroupedExpr::accept_vis): Likewise.
(LiteralPattern::accept_vis): Likewise.
(IdentifierPattern::accept_vis): Likewise.
(WildcardPattern::accept_vis): Likewise.
(RestPattern::accept_vis): Likewise.
(RangePatternBoundLiteral::accept_vis): Likewise.
(RangePatternBoundPath::accept_vis): Likewise.
(RangePatternBoundQualPath::accept_vis): Likewise.
(RangePattern::accept_vis): Likewise.
(ReferencePattern::accept_vis): Likewise.
(StructPatternFieldTuplePat::accept_vis): Likewise.
(StructPatternFieldIdentPat::accept_vis): Likewise.
(StructPatternFieldIdent::accept_vis): Likewise.
(StructPattern::accept_vis): Likewise.
(TupleStructItemsNoRange::accept_vis): Likewise.
(TupleStructItemsRange::accept_vis): Likewise.
(TupleStructPattern::accept_vis): Likewise.
(TuplePatternItemsMultiple::accept_vis): Likewise.
(TuplePatternItemsRanged::accept_vis): Likewise.
(TuplePattern::accept_vis): Likewise.
(GroupedPattern::accept_vis): Likewise.
(SlicePattern::accept_vis): Likewise.
(AltPattern::accept_vis): Likewise.
* ast/rust-ast-formatting.cc: New file.
* ast/rust-ast-formatting.h: New file.
* ast/rust-pattern.cc: New file.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* Make-lang.in: Add new file for rust-path implementation.
* ast/rust-ast.cc (PathInExpression::as_string): Move function
to the new file.
(PathPattern::as_string): Likewise.
(QualifiedPathInExpression::as_string): Likewise.
(ConstGenericParam::as_string): Likewise.
(QualifiedPathInType::as_string): Likewise.
(TypePath::as_string): Likewise.
(PathPattern::convert_to_simple_path): Likewise.
(TypePath::as_simple_path): Likewise.
(PathExprSegment::as_string): Likewise.
(GenericArgs::as_string): Likewise.
(GenericArgsBinding::as_string): Likewise.
(TypePath::to_trait_bound): Likewise.
(TypePathSegmentGeneric::as_string): Likewise.
(TypePathFunction::as_string): Likewise.
(TypePathSegmentFunction::as_string): Likewise.
(ConstGenericParam::accept_vis): Likewise.
(PathInExpression::accept_vis): Likewise.
(TypePathSegment::accept_vis): Likewise.
(TypePathSegmentGeneric::accept_vis): Likewise.
(TypePathSegmentFunction::accept_vis): Likewise.
(TypePath::accept_vis): Likewise.
(QualifiedPathInExpression::accept_vis): Likewise.
(QualifiedPathInType::accept_vis): Likewise.
(GenericArg::disambiguate_to_const): Likewise.
(GenericArg::disambiguate_to_type): Likewise.
* ast/rust-path.cc: New file.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-item.cc (CompileItem::visit): unwrap the constant expression
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* util/rust-lang-item.h
(RustLangItem::ItemType::FN): Add.
(RustLangItem::ItemType::FN_MUT): Add.
(RustLangItem::Parse): Handle FN and FN_MUT.
(RustLangItem::ToString): Handle FN and FN_MUT.
2024-01-16 Emanuele Micheletti <micheletti.emanuele@hotmail.com>
* typecheck/rust-casts.cc (TypeCastRules::cast_rules):
case INTEGRAL handles TypeKind::CHAR
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit):
add check for reference marker and type's in self params
(ResolveItem::visit): likewise
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
remove bad generics check
(TypeCheckExpr::resolve_segments): likewise
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): likewise
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* resolve/rust-ast-resolve-item.cc
(ResolveTraitItems::visit): add name resolution self param
(ResolveItem::visit): likewise
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::TypeBoundPredicate): this is an empty
(TypeBoundPredicate::operator=): likewise
* typecheck/rust-tyty-subst.cc (SubstitutionArgumentMappings::empty): new interface
(SubstitutionArgumentMappings::is_error): this marks it as an error
* typecheck/rust-tyty-subst.h: update prototypes
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::check_base_type_privacy): allow error types to be permissive
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit_items_as_lines):
Handle trailing chars.
(TokenStream::visit_items_as_block): Likewise.
(TokenStream::visit): Fix visitor.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-token.cc (Token::as_string): Add type hint output.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* rust-session-manager.cc (Session::enable_dump): Enable new
dump.
(Session::compile_crate): CLI argument parsing.
(Session::dump_tokenstream): Dump the tokenstream as a string in
the specified file.
* rust-session-manager.h (struct CompileOptions): Add
tokenstream dump option.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-token.cc (Token::as_string): Add as_string
implementation.
* lex/rust-token.h: Add as_string prototype.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::TokenStream): Add
constructor.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::collect_tokens): Add
getter.
(TokenStream::go): Rename function.
(TokenStream::visit): Likewise.
* ast/rust-ast-tokenstream.h: Add collect prototype.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Change
getter name.
* ast/rust-ast.cc (SimplePath::as_string): Change attribute
name.
* ast/rust-ast.h (class SimplePath): Refactor attribute name and
change getter name.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit_as_line): Add
formatting calls.
(TokenStream::visit_items_as_block): Likewise.
(TokenStream::newline): Add stub.
(TokenStream::indentation): Add stub.
(TokenStream::increment_indentation): Add stub.
(TokenStream::decrement_indentation): Add stub.
(TokenStream::visit): Add formatting calls.
(TokenStream::visit_function_common): Likewise.
* ast/rust-ast-tokenstream.h: Add stub prototypes.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Add visitor.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Add visitor
implementation.
* ast/rust-ast-tokenstream.h: Add additional function prototype.
* ast/rust-item.h: Add some getters.
* ast/rust-macro.h: Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Add visitor.
* ast/rust-item.h: Add missing getters.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Add visitor.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Add
visitors.
(TokenStream::visit_closure_common): Merge common code for
closure visitors.
* ast/rust-ast-tokenstream.h: Add function prototype.
* ast/rust-expr.h: Add missing move attribute getter.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Add
visitors.
(TokenStream::visit_loop_common): Merge common loop code.
* ast/rust-ast-tokenstream.h: Add function prototypes.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Implement
visitor.
* ast/rust-ast-tokenstream.h: Add function prototype for missing
component.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::trailing_comma):
Output a trailing comma to the token stream according to the
configuration.
* ast/rust-ast-tokenstream.h: Add function prototype.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Implement
visitors.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Implement
visitors.
* ast/rust-ast-tokenstream.h: Add function prototypes.
* ast/rust-ast.h: Add missing getters.
* ast/rust-expr.h: Likewise.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* Make-lang.in: Add rust-as-tokenstream to compile list.
* ast/rust-item.h: Add missing getter for location.
* ast/rust-ast-tokenstream.cc: Add ast visitor implementation.
* ast/rust-ast-tokenstream.h: New file.
* ast/rust-pattern.h: Add getter.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit):
Add implicit unit type as the return type when not specified
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* util/rust-attributes.cc: Add stable to the table of known attributes
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): return early on bad type
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::TypeCheckPattern):
remove assertion in favor of check
(TypeCheckPattern::visit): likewise
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (CompileExpr::generate_closure_function):
when its not a block we dont have any ribs to generate locals from
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* parse/rust-parse-impl.h
(Parser<ManagedTokenSource>::parse_expr_without_block):
Remove direct array expression handling.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-item.h: Fix `Visibility::has_path()` implementation.
* checks/errors/privacy/rust-visibility-resolver.cc
(VisibilityResolver::resolve_module_path): Check if we are dealing with pub(crate) properly.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Set
resolved_node_id when visiting root segment of SimplePath.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.h: Call SimplePath constructor differently in
SimplePath::from_str
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/rust-ast-lower-type.h: Move all remaining definitions to source file.
* hir/rust-ast-lower-type.cc (ASTLoweringType::translate): Moved to source file.
(ASTLoweringType::visit): Likewise.
(ASTLowerGenericParam::translate): Likewise.
(ASTLowerGenericParam::visit): Likewise.
(ASTLoweringTypeBounds::translate): Likewise.
(ASTLoweringTypeBounds::visit): Likewise.
(ASTLowerWhereClauseItem::translate): Likewise.
(ASTLowerWhereClauseItem::visit): Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-pattern.h: Remove commented out code.
2024-01-16 emanuele-em <micheletti.emanuele@hotmail.com>
* typecheck/rust-casts.cc (TypeCastRules::cast_rules): BOOL removed from switch cases
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Rename rust-asttribute-visitor.o -> rust-cfg-strip.o
* expand/rust-attribute-visitor.cc: Moved to...
* expand/rust-cfg-strip.cc: ...here.
* expand/rust-attribute-visitor.h: Moved to...
* expand/rust-cfg-strip.h: ...here.
* expand/rust-macro-expand.cc: Fix include of rust-attribute-visitor.h
* expand/rust-macro-builtins.cc: Likewise.
* rust-session-manager.cc (Session::expansion): Call CfgStrip instead of
AttrVisitor.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Add new object file.
* expand/rust-attribute-visitor.cc (AttrVisitor::go): Visit all items of a
crate.
(AttrVisitor::expand_struct_fields): Do not perform macro expansion anymore.
(AttrVisitor::expand_function_params): Likewise.
(AttrVisitor::expand_generic_args): Likewise.
(AttrVisitor::expand_qualified_path_type): Likewise.
(AttrVisitor::expand_self_param): Likewise.
(AttrVisitor::expand_trait_function_decl): Likewise.
(AttrVisitor::expand_trait_method_decl): Likewise.
(AttrVisitor::visit): Likewise.
(AttrVisitor::maybe_expand_expr): Remove function.
(AttrVisitor::maybe_expand_type): Likewise.
* expand/rust-attribute-visitor.h: Do not keep MacroExpander inside AttrVisitor
anymore.
* expand/rust-macro-expand.h (struct MacroExpander): Turn ContextType into an
enum class for more type safety.
* expand/rust-macro-expand.cc (MacroExpander::expand_crate): Use new ContextType
API.
* rust-session-manager.cc (Session::expansion): Call into ExpandVisitor.
* expand/rust-expand-visitor.cc: New file.
* expand/rust-expand-visitor.h: New file.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-expand.cc (MacroExpander::expand_crate): Do not cfg-attr
strip in MacroExpander
(MacroExpander::fails_cfg): Function moved...
(MacroExpander::fails_cfg_with_expand): Function moved...
(MacroExpander::expand_cfg_attrs): Function moved...
* expand/rust-attribute-visitor.cc (fails_cfg): ...here.
(fails_cfg_with_expand): ...here.
(expand_cfg_attrs): ...here.
(AttrVisitor::expand_struct_fields): Use new functions.
(AttrVisitor::expand_tuple_fields): Likewise.
(AttrVisitor::expand_function_params): Likewise.
(AttrVisitor::visit): Likewise.
(AttrVisitor::go): New function.
* expand/rust-attribute-visitor.h: Declare AttrVisitor::go.
* expand/rust-macro-expand.h (struct MacroExpander): Remove cfg-attr related
functions.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_macro_definition):
New function.
* hir/rust-ast-lower-base.h: Declare `lower_macro_definition`.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Lower public
macro definitions.
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Likewise.
* hir/rust-ast-lower-stmt.h: Add visitor for `AST::MacroRulesDefinition`.
* hir/rust-ast-lower.cc (ASTLowering::go): Formatting.
(ASTLoweringBlock::visit): Visit `AST::MacroRulesDefinition`
(ASTLoweringIfLetBlock::visit): Formatting.
(ASTLoweringExprWithBlock::visit): Formatting.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Add new visitor
for AST::MacroRulesDefinition.
* hir/rust-ast-lower-item.h: Declare above mentioned visitor.
* metadata/rust-export-metadata.cc (ExportContext::emit_macro): New function.
* metadata/rust-export-metadata.h: Declare it.
(PublicInterface::gather_export_data): Go through each exported macro.
* util/rust-hir-map.cc (Mappings::insert_exported_macro): New function.
(Mappings::get_exported_macros): New function.
* util/rust-hir-map.h: Add new mappings for exported macros.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-compile-item.h: Revert 1c946687239b86a92839d57dfbc928ad7ce35eae.
* backend/rust-compile-stmt.h: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* checks/errors/privacy/rust-pub-restricted-visitor.cc
(PubRestrictedVisitor::visit): Likewise.
* checks/errors/privacy/rust-pub-restricted-visitor.h: Likewise.
* checks/errors/privacy/rust-reachability.cc
(ReachabilityVisitor::visit): Likewise.
* checks/errors/privacy/rust-reachability.h: Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc
(VisibilityResolver::visit): Likewise.
* checks/errors/privacy/rust-visibility-resolver.h: Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-const-checker.h: Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.h: Likewise.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Likewise.
* hir/rust-ast-lower-item.h: Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/rust-hir-dump.h: Likewise.
* hir/tree/rust-hir-full-decls.h (class ExportedMacro): Likewise.
* hir/tree/rust-hir-item.h (class ExportedMacro): Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
* hir/tree/rust-hir.cc (ExportedMacro::accept_vis): Likewise.
(ExportedMacro::get_locus): Likewise.
(ExportedMacro::get_item_kind): Likewise.
(ExportedMacro::clone_item_impl): Likewise.
* hir/tree/rust-hir.h: Likewise.
* metadata/rust-export-metadata.cc: Likewise.
* typecheck/rust-hir-type-check-item.h: Likewise.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.h: Likewise.
* typecheck/rust-tycheck-dump.h: Likewise.
* util/rust-attributes.cc: Likewise.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): return a TraitObject
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-resolve.cc: don't inject extra inference variables
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-dump.cc (Dump::visit): Remove extraneous semicolon when
dumping macro rules.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* metadata/rust-imports.cc (add_search_path): Change `Go` -> `Rust`.
(Import::try_package_in_directory): Likewise.
(Import::find_export_data): Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* hir/rust-ast-lower-pattern.cc
(ASTLoweringPattern::visit): Lower AltPattern.
* hir/rust-ast-lower-pattern.h:
(ASTLoweringPattern::visit): Add AltPattern visitor.
2024-01-16 Xiao Ma <turingki@yeah.net>
Thomas Schwinge <thomas@codesourcery.com>
* checks/errors/rust-feature-gate.cc: Adjust 'ld'->'u'.
* checks/errors/rust-feature.h: Adjust
the type of `m_issue`: 'uint64_t' -> 'unsigned'.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* ast/rust-ast.h: add const get_final_segment helper
* hir/rust-ast-lower-enumitem.h: dont add an item mapping for enumitems
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): add enum to enum-items mappings
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): likewise
* hir/tree/rust-hir-item.h: add non const helper to get variants
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): resolve the use declaration
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): handle self
* resolve/rust-ast-resolve-toplevel.h: add enum item mappings to module mappings
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path): ensure variant
(TypeCheckExpr::resolve_segments): likewise
* typecheck/rust-type-util.cc (query_type): lookup enum's
* util/rust-hir-map.cc (Mappings::insert_hir_enumitem): enum item mappings
(Mappings::lookup_hir_enumitem): likewise
* util/rust-hir-map.h: likewise
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* resolve/rust-ast-resolve-path.cc (ResolvePath::ResolvePath): return NodeId
(ResolvePath::go): update signiture
(ResolvePath::resolve_path): return resolved_node_id
* resolve/rust-ast-resolve-path.h: update prototypes
2024-01-16 Mahmoud Mohamed <mahadelr19@gmail.com>
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit):
Add lowering for SlicePattern.
* hir/rust-ast-lower-pattern.h: Likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit):
Add name resolution visit for SlicePattern.
* resolve/rust-ast-resolve-pattern.h: Likewise.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* hir/rust-ast-lower-implitem.h (RUST_AST_LOWER_IMPLITEM_H): cleanup header usage
* hir/rust-ast-lower-item.cc: likewise
* hir/rust-ast-lower-item.h (RUST_AST_LOWER_ITEM): likewise
* hir/rust-ast-lower-stmt.cc: likewise
* hir/rust-ast-lower-stmt.h (RUST_AST_LOWER_STMT): likewise
* hir/rust-ast-lower-type.h: likewise
* hir/rust-ast-lower.cc: likewise
* hir/rust-ast-lower.h: likewise
* resolve/rust-ast-resolve-expr.h: likewise
* resolve/rust-ast-resolve-item.cc: likewise
* resolve/rust-ast-resolve-item.h: likewise
* resolve/rust-ast-resolve-stmt.cc: likewise
* resolve/rust-ast-resolve-stmt.h: likewise
* resolve/rust-ast-resolve-struct-expr-field.h: likewise
* resolve/rust-ast-resolve-toplevel.h: likewise
* resolve/rust-ast-resolve-type.h: likewise
* resolve/rust-ast-resolve.h: likewise
2024-01-16 Mahmoud Mohamed <mahadelr19@gmail.com>
* resolve/rust-ast-resolve-pattern.h (class ResolvePattern): Removed.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-intrinsic.cc (move_val_init_handler): new intrinsice
(uninit_handler): use a builtin memcpy
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-coercion.cc (TypeCoercionRules::select): use the result
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): fix ctor
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): likewise
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise
* typecheck/rust-typecheck-context.cc (TypeCheckContext::push_new_loop_context): likewise
* typecheck/rust-tyty-util.cc (TyVar::get_implicit_infer_var): likewise
* typecheck/rust-tyty.cc (InferType::InferType): new ctor with type hint
(InferType::clone): fix ctor
(InferType::apply_primitive_type_hint): new function to apply possible hint
* typecheck/rust-tyty.h: update prototypes
* typecheck/rust-unify.cc (UnifyRules::expect_inference_variable): apply type hints
(UnifyRules::expect_bool): likewise
(UnifyRules::expect_char): likewise
(UnifyRules::expect_int): likewise
(UnifyRules::expect_uint): likewise
(UnifyRules::expect_float): likewise
(UnifyRules::expect_isize): likewise
(UnifyRules::expect_usize): likewise
2024-01-16 Jiakun Fan <120090316@link.cuhk.edu.cn>
* hir/rust-hir-dump.cc (Dump::go): fix format
(Dump::visit): impl `visit (AST::Attribute &)`, dump inner attrs and
`visit (Lifetime &)`
* hir/rust-hir-dump.h:add `visit (AST::Attribute &)`
2024-01-16 Mahmoud Mohamed <mahadelr19@gmail.com>
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::go):
Print out consistency errors.
(PatternDeclaration::visit): Implement visit for AltPattern.
(PatternDeclaration::add_new_binding): New helper function for
adding a binding to identifier.
* resolve/rust-ast-resolve-pattern.h (struct BindingInfo):
New struct to facilitate checking for inconsistencies between bindings.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-block.h
(CompileConditionalBlocks::visit): Remove IfLetExprConseqIf{,Let} visitors.
(CompileExprWithBlock::visit): Remove IfLetExprConseqIf{,Let} visitors.
* backend/rust-compile-expr.h
(CompileExpr::visit): Remove IfLetExprConseqIf{,Let} visitors.
* checks/errors/rust-unsafe-checker.cc
(UnsafeChecker::visit): Remove IfLetExprConseqIf{,Let} visitors.
* checks/errors/rust-unsafe-checker.h
(UnsafeChecker::visit): Remove IfLetExprConseqIf{,Let} visitors.
* checks/errors/rust-const-checker.cc
(ConstChecker::visit): Remove IfLetExprConseqIf{,Let} visitors.
* checks/errors/rust-const-checker.h
(ConstChecker::visit): Remove IfLetExprConseqIf{,Let} visitors.
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::visit): Remove IfLetExprConseqIf{,Let} visitors.
* checks/errors/privacy/rust-privacy-reporter.h
(PrivacyReporter::visit): Remove IfLetExprConseqIf{,Let} visitors.
* hir/tree/rust-hir-expr.h
(class IfLetExprConseqElse): Make else_block ExprWithBlock.
(class IfLetExprConseqIf): Remove.
(class IfLetExprConseqIfLet): Remove.
* hir/tree/rust-hir-full-decls.h
(class IfLetExprConseqIf): Remove.
(class IfLetExprConseqIfLet): Remove.
* hir/tree/rust-hir.cc
(IfLetExprConseqElse::as_string): Adjust output.
(IfLetExprConseqIf::as_string): Remove.
(IfLetExprConseqIfLet::as_string): Remove.
(IfLetExprConseqIf::accept_vis): Remove.
(IfLetExprConseqIfLet::accept_vis): Remove.
* hir/tree/rust-hir-visitor.h
(HIRFullVisitor::visit): Remove IfLetExprConseqIf{,Let} visitors.
(HIRFullVisitorBase::visit): Remove IfLetExprConseqIf{,Let} visitors.
(HIRExpressionVisitor::visit): Remove IfLetExprConseqIf{,Let} visitors.
* hir/rust-hir-dump.cc
(Dump::visit): Remove IfLetExprConseqIf{,Let} visitors.
* hir/rust-hir-dump.h
(Dump::visit): Remove IfLetExprConseqIf{,Let} visitors.
* typecheck/rust-hir-type-check-expr.h
(TypeCheckExpr::visit): Remove IfLetExprConseqIf{,Let} visitors.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-hir-type-check-expr.cc
(TypeCheckExpr::visit): Remove IfExprConseqIf visitor.
* typecheck/rust-hir-type-check-expr.h
(TypeCheckExpr::visit): Remove IfExprConseqIf{,Let} visitor.
* backend/rust-compile-block.cc
(CompileConditionalBlocks::visit): Remove IfExprConseqIf visitor.
* backend/rust-compile-block.h
(CompileConditionalBlocks::visit): Remove IfExprConseqIf{,Let} visitors.
(CompileExprWithBlock::visit):
Remove IfExprConseqIf{,Let} visitors, implement BlockExpr visitor.
* backend/rust-compile-expr.cc
(CompileExpr::visit): Remove IfExprConseqIf visitor.
* backend/rust-compile-expr.h
(CompileExpr::visit): Remove IfExprConseqIf{,Let} visitors.
* checks/lints/rust-lint-marklive.h
(MarkLive::visit): Remove IfExprConseqIf visitor.
* checks/errors/rust-const-checker.cc
(ConstChecker::visit): Remove IfExprConseqIf{,Let} visitors.
* checks/errors/rust-const-checker.h
(ConstChecker::visit): Remove IfExprConseqIf{,Let} visitors.
* checks/errors/rust-unsafe-checker.cc
(UnsafeChecker::visit): Remove IfExprConseqIf{,Let} visitors.
* checks/errors/rust-unsafe-checker.h
(UnsafeChecker::visit): Remove IfExprConseqIf{,Let} visitors.
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::visit): Remove IfExprConseqIf{,Let} visitors.
* checks/errors/privacy/rust-privacy-reporter.h
(PrivacyReporter::visit): Remove IfExprConseqIf{,Let} visitors.
* hir/tree/rust-hir-expr.h
(class IfExprConseqElse): Make else_block ExprWithBlock.
(class IfExprConseqIf): Remove.
(class IfExprConseqIfLet): Remove.
* hir/tree/rust-hir-full-decls.h
(class IfExprConseqIf): Remove.
(class IfExprConseqIfLet): Remove.
* hir/tree/rust-hir.cc
(IfExprConseqElse::as_string): Adjust output.
(IfExprConseqIf::as_string): Remove.
(IfExprConseqIfLet::as_string): Remove.
(IfExprConseqIf::accept_vis): Remove.
(IfExprConseqIfLet::accept_vis): Remove.
* hir/tree/rust-hir-visitor.h
(HIRFullVisitor::visit): Remove IfExprConseqIf{,Let} visitors.
(HIRFullVisitorBase::visit): Remove IfExprConseqIf{,Let} visitors.
(HIRExpressionVisitor::visit): Remove IfExprConseqIf{,Let} visitors.
* hir/rust-hir-dump.cc
(Dump::visit): Remove IfExprConseqIf{,Let} visitors.
* hir/rust-hir-dump.h
(Dump::visit): Remove IfExprConseqIf{,Let} visitors.
* hir/rust-ast-lower.cc
(ASTLoweringIfBlock::visit): Replace HIR::IfExprConseqIf with HIR::IfExprConseqElse.
2024-01-16 Mahmoud Mohamed <mahadelr19@gmail.com>
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit):
Push a Product context instead of an Or context.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-inherent-impl-overlap.h (class ImplItemToName): remove
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (CompileExpr::resolve_method_address): remove unused code
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): remove infer call
(TypeCheckExpr::resolve_root_path): only infer when we need to
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-dot-operator.cc (MethodResolver::select): add debug
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile.cc: use unify_and instead
* typecheck/rust-tyty-subst.cc (SubstitutionRef::solve_missing_mappings_from_this): remove
* typecheck/rust-tyty-subst.h: update header
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-coercion.cc (TypeCoercionRules::select): use new unify_and interface
* typecheck/rust-hir-dot-operator.cc (MethodResolver::try_hook): grab bounds behind refs
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.cc: fix headers
* backend/rust-compile-base.h: likewise
* backend/rust-compile-expr.cc: likewise
* backend/rust-compile-extern.h: likewise
* backend/rust-compile-pattern.cc: likewise
* backend/rust-compile.cc: likewise
* typecheck/rust-autoderef.cc: likewise
* typecheck/rust-hir-dot-operator.cc: likewise
* typecheck/rust-hir-inherent-impl-overlap.h: likewise
* typecheck/rust-hir-path-probe.cc: likewise
* typecheck/rust-hir-trait-resolve.cc: likewise
* typecheck/rust-hir-type-check-base.cc: likewise
* typecheck/rust-hir-type-check-base.h (RUST_HIR_TYPE_CHECK_BASE): likewise
* typecheck/rust-hir-type-check-enumitem.cc: likewise
* typecheck/rust-hir-type-check-expr.cc: likewise
* typecheck/rust-hir-type-check-implitem.cc: likewise
* typecheck/rust-hir-type-check-item.cc: likewise
* typecheck/rust-hir-type-check-path.cc: likewise
* typecheck/rust-hir-type-check-pattern.cc: likewise
* typecheck/rust-hir-type-check-stmt.cc: likewise
* typecheck/rust-hir-type-check-struct.cc: likewise
* typecheck/rust-hir-type-check-type.cc: likewise
* typecheck/rust-hir-type-check-type.h: likewise
* typecheck/rust-hir-type-check.h (RUST_HIR_TYPE_CHECK): likewise
* typecheck/rust-tyty-bounds.cc: likewise
* typecheck/rust-tyty-call.cc: likewise
* typecheck/rust-tyty-subst.cc: likewise
* typecheck/rust-tyty.cc: likewise
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty.cc (BaseType::has_subsititions_defined): new implementation
(BaseType::needs_generic_substitutions): likewise
(ProjectionType::needs_generic_substitutions): remove
(ProjectionType::has_subsititions_defined): remove
* typecheck/rust-tyty.h: update header
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): update to use new interface
(TypeCheckExpr::resolve_root_path): likewise
(TypeCheckExpr::resolve_segments): likewise
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise
(TypeCheckType::resolve_root_path): likewise
* typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args): likewise
* typecheck/rust-tyty.cc (BaseType::supports_substitutions): likewise
(BaseType::can_substitute): remove
(BaseType::contains_type_parameters): remove
(handle_substitions): cleanup
(TupleType::handle_substitions): update
(FnType::handle_substitions): update
(ProjectionType::supports_substitutions): update
* typecheck/rust-tyty.h: update header
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty.h: cleanup ordering of header
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty.cc (BaseType::monomorphized_clone): new impl
(InferType::monomorphized_clone): remove
(ErrorType::monomorphized_clone): likewise
(ADTType::monomorphized_clone): likewise
(TupleType::monomorphized_clone): likewise
(FnType::monomorphized_clone): likewise
(FnPtr::monomorphized_clone): likewise
(ClosureType::monomorphized_clone): likewise
(ArrayType::clone): likewise
(ArrayType::get_var_element_type): likewise
(ArrayType::monomorphized_clone): likewise
(SliceType::clone): likewise
(SliceType::get_var_element_type): likewise
(SliceType::monomorphized_clone): likewise
(BoolType::monomorphized_clone): likewise
(IntType::monomorphized_clone): likewise
(UintType::monomorphized_clone): likewise
(FloatType::monomorphized_clone): likewise
(USizeType::monomorphized_clone): likewise
(ISizeType::monomorphized_clone): likewise
(CharType::monomorphized_clone): likewise
(ReferenceType::clone): likewise
(ReferenceType::get_var_element_type): likewise
(ReferenceType::monomorphized_clone): likewise
(PointerType::clone): likewise
(PointerType::get_var_element_type): likewise
(PointerType::monomorphized_clone): likewise
(ParamType::monomorphized_clone): likewise
(StrType::monomorphized_clone): likewise
(NeverType::monomorphized_clone): likewise
(PlaceholderType::monomorphized_clone): likewise
(ProjectionType::monomorphized_clone): likewise
(DynamicObjectType::monomorphized_clone): likewise
* typecheck/rust-tyty.h: update header
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty.cc (BaseType::is_unit): new implementation
(ErrorType::is_unit): remove
(TupleType::is_unit): likewise
(NeverType::is_unit): likewise
(PlaceholderType::is_unit): likewise
(ProjectionType::is_unit): likewise
* typecheck/rust-tyty.h: update header
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty.cc (BaseType::is_concrete): new implementation
(InferType::is_concrete): remove
(ErrorType::is_concrete): likewise
(StructFieldType::is_concrete): likewise
(ADTType::is_concrete): likewise
(TupleType::is_concrete): likewise
(BoolType::is_concrete): likewise
(IntType::is_concrete): likewise
(UintType::is_concrete): likewise
(FloatType::is_concrete): likewise
(USizeType::is_concrete): likewise
(ISizeType::is_concrete): likewise
(CharType::is_concrete): likewise
(ReferenceType::is_concrete): likewise
(PointerType::is_concrete): likewise
(ParamType::is_concrete): likewise
(StrType::is_concrete): likewise
(NeverType::is_concrete): likewise
(PlaceholderType::is_concrete): likewise
(ProjectionType::is_concrete): likewise
(DynamicObjectType::is_concrete): likewise
* typecheck/rust-tyty.h: update header
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-type.cc (TyTyResolveCompile::TyTyResolveCompile): call destructure
(TyTyResolveCompile::compile): use error_mark_node
(TyTyResolveCompile::visit): use error_mark_node
* backend/rust-compile-type.h: remove recursive ops
2024-01-16 Tage Johansson <frans.tage@gmail.com>
* parse/rust-parse.cc: fix follow-sets
2024-01-16 Mahmoud Mohamed <mahadelr19@gmail.com>
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit) :declare and
pass bindings to PatternDeclaration::go.
(ResolveExpr::resolve_closure_param): Likewise.
* resolve/rust-ast-resolve-expr.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): Likewise.
(ResolveItem::visit): Likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::go): Likewise.
(PatternDeclaration::visit): check for previous identifier bindings
before inserting the new one.
* resolve/rust-ast-resolve-pattern.h (enum PatternBoundCtx): New enum.
* resolve/rust-ast-resolve-stmt.h: pass bindings to PatterDeclaration::go.
2024-01-16 Mahmoud Mohamed <mahadelr19@gmail.com>
* backend/rust-compile-expr.cc (CompileExpr::generate_closure_function):
handle closure parameters pattern bindings using CompilePatternBindings visitor
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* README.md (process): Rename `rust1` to `crab1` in examples.
* Make-lang.in: Rename `rust1` to `crab1`.
* config-lang.in: Likewise.
* lang-specs.h: Likewise.
* rustspec.cc (lang_specific_driver): Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* hir/tree/rust-hir-pattern.h
(SlicePattern::get_items): Add.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* hir/tree/rust-hir-full-decls.h
(struct GenericArgsBinding): Convert to class.
(class GenericArgsBinding): Convert from struct.
(struct TypePathFunction): See above.
(class TypePathFunction): See above.
(struct QualifiedPathType): See above.
(class QualifiedPathType): See above.
* ast/rust-ast-full-decls.h
(struct WhereClause): See above.
(class WhereClause): See above.
(struct SelfParam): See above.
(class SelfParam): See above.
(struct FunctionQualifiers): See above.
(class FunctionQualifiers): See above.
(struct FunctionParam): See above.
(class FunctionParam): See above.
(struct StructField): See above.
(class StructField): See above.
(struct TupleField): See above.
(class TupleField): See above.
(struct TraitFunctionDecl): See above.
(class TraitFunctionDecl): See above.
(struct TraitMethodDecl): See above.
(class TraitMethodDecl): See above.
(struct NamedFunctionParam): See above.
(class NamedFunctionParam): See above.
* hir/tree/rust-hir-path.h
(struct GenericArgsBinding): See above.
(class GenericArgsBinding): See above.
(struct TypePathFunction): See above.
(class TypePathFunction): See above.
(struct QualifiedPathType): See above.
(class QualifiedPathType): See above.
* ast/rust-item.h
(struct WhereClause): See above.
(class WhereClause): See above.
(struct SelfParam): See above.
(class SelfParam): See above.
(struct FunctionQualifiers): See above.
(class FunctionQualifiers): See above.
(struct FunctionParam): See above.
(class FunctionParam): See above.
(struct StructField): See above.
(class StructField): See above.
(struct TupleField): See above.
(class TupleField): See above.
(struct TraitFunctionDecl): See above.
(class TraitFunctionDecl): See above.
(struct TraitMethodDecl): See above.
(class TraitMethodDecl): See above.
(struct NamedFunctionParam): See above.
(class NamedFunctionParam): See above.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* hir/tree/rust-hir-pattern.h
(class AltPattern): Remove duplicate access specifier.
(AltPattern::get_alts): Add.
* hir/tree/rust-hir.cc
(AltPattern::as_string): Add.
(AltPattern::accept_vis): Add.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/tree/rust-hir-item.h (class ExportedMacro): Add new ExportedMacro class.
* hir/tree/rust-hir.cc (ExportedMacro::accept_vis): New function.
(ExportedMacro::get_locus): Likewise.
(ExportedMacro::get_item_kind): Likewise.
(ExportedMacro::clone_item_impl): Likewise.
* hir/tree/rust-hir-full-decls.h (class ExportedMacro): Forward declare class.
* backend/rust-compile-item.h: Add visitor for ExportedMacro.
* backend/rust-compile-stmt.h: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* checks/errors/privacy/rust-pub-restricted-visitor.cc (PubRestrictedVisitor::visit):
Likewise.
* checks/errors/privacy/rust-pub-restricted-visitor.h: Likewise.
* checks/errors/privacy/rust-reachability.cc (ReachabilityVisitor::visit): Likewise.
* checks/errors/privacy/rust-reachability.h: Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::visit): Likewise.
* checks/errors/privacy/rust-visibility-resolver.h: Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-const-checker.h: Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.h: Likewise.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Likewise.
* hir/rust-ast-lower-item.h: Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/rust-hir-dump.h: Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
* metadata/rust-export-metadata.cc: Likewise.
* typecheck/rust-hir-type-check-item.h: Likewise.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.h: Likewise.
* typecheck/rust-tycheck-dump.h: Likewise.
* hir/tree/rust-hir.h: Add new ItemKind::MacroExport variant.
* util/rust-attributes.cc: Add #[macro_export] attribute.
2024-01-16 Mahmoud Mohamed <mahadelr19@gmail.com>
* backend/rust-compile-fnparam.cc (CompileFnParam::visit):
Added visit implementation for ReferencePattern.
(CompileFnParam::create_tmp_param_var):
Refactored duplicated code into a helper function.
* backend/rust-compile-fnparam.h: Added visit implementation for
ReferencePattern.
* backend/rust-compile-pattern.cc (CompilePatternBindings::visit):
Added visit implementation for ReferencePattern and
IdentifierPattern.
* backend/rust-compile-pattern.h: Added visit implementation for
ReferencePattern and IdentifierPattern.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Move
unloaded module item loading to...
* expand/rust-attribute-visitor.cc (AttrVisitor::visit): ...here.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* hir/rust-hir-dump.cc (Dump::visit): Simplify indentation dump to single line.
2024-01-16 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Indent::Indent): Move to separate file.
(operator<<): Move to separate file.
(Indent::increment): Move to separate file.
(Indent::decrement): Move to separate file.
* ast/rust-ast-dump.h (class Indent): Move to separate file.
* hir/rust-hir-dump.cc (Dump::Dump): Use new indentation object.
(Dump::go): Use new indentation object.
(Dump::visit): Use new indention object.
* hir/rust-hir-dump.h: Use new indentation object.
* util/rust-dump.h: New file. Moved Indentation from rust-ast-dump.cc
2024-01-16 Mahmoud Mohamed <mahadelr19@gmail.com>
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
Add the missing infered type assignment
2024-01-16 Marc Poulhiès <dkm@kataplop.net>
PR rust/108111
* ast/rust-ast-full-decls.h (StructPatternElements): Declare as a
class.
* ast/rust-item.h (EnumItem): Mark several method as being
overrides.
* ast/rust-pattern.h (StructPattern::get_locus): Add override.
* lex/rust-lex.h (BufferInputSource): Use reference_wrapper
instead of bare reference.
(TokenSource::get): Add method to implement the reference_wrapper
interface.
* typecheck/rust-tyty.h (TypeBoundPredicate): Add empty dtor.
* util/rust-buffered-queue.h (peek): Source token stream is now
using a reference_wrapper, use .get()
2024-01-16 vincent <jfan30@u.rochester.edu>
* typecheck/rust-hir-type-check-pattern.cc
(TypeCheckPattern::visit): rewrite part code to helper function
(TypeCheckPattern::typecheck_range_pattern_bound): helper function
* typecheck/rust-hir-type-check-pattern.h
(TypeCheckPattern::typecheck_range_pattern_bound):
change the parameter of the function
2024-01-16 goar5670 <mahadelr19@gmail.com>
* hir/tree/rust-hir-pattern.h (HIR::ReferencePattern):
added get_referenced_pattern function.
* resolve/rust-ast-resolve-pattern.h
(Resolve::PatternDeclaration): add visit function for
AST::ReferencePattern
* typecheck/rust-hir-type-check-pattern.cc
(Resolver::TypeCheckPattern): add visit function for
HIR::ReferencePattern
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* util/rust-lang-item.h
(RustLangItem::ItemType): New enumerators.
(RustLangItem::Parse): Parse new enumerators.
(RustLangItem::ToString): Handle new enumerators.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-fnparam.h:
(CompileFnParam::visit): Add AltPattern visitor.
* backend/rust-compile-pattern.h:
(CompilePatternCaseLabelExpr::visit): Add AltPattern visitor.
(CompilePatternBindings::visit): Add AltPattern visitor.
(CompilePatternLet::visit): Add AltPattern visitor.
* backend/rust-compile-resolve-path.h:
(ResolvePathRef::visit): Add AltPattern visitor.
* backend/rust-compile-var-decl.h:
(CompileVarDecl::visit): Add AltPattern visitor.
* checks/errors/rust-const-checker.cc
(ConstChecker::visit): Add AltPattern visitor.
* checks/errors/rust-const-checker.h:
(ConstChecker::visit): Add AltPattern visitor.
* checks/errors/rust-unsafe-checker.cc
(UnsafeChecker::visit): Add AltPattern visitor.
* checks/errors/rust-unsafe-checker.h:
(UnsafeChecker::visit): Add AltPattern visitor.
* hir/rust-hir-dump.cc
(Dump::visit): Add AltPattern visitor.
* hir/rust-hir-dump.h:
(Dump::visit): Add AltPattern visitor.
* hir/tree/rust-hir-full-decls.h
(class AltPattern): Add forward declaration.
* hir/tree/rust-hir-pattern.h
(class AltPattern): New class.
* hir/tree/rust-hir-visitor.h:
(HIRFullVisitor::visit): Add AltPattern visitor.
(HIRFullVisitorBase::visit): Add AltPattern visitor.
(HIRPatternVisitor::visit): Add AltPattern visitor.
* hir/tree/rust-hir.h:
(Pattern::PatternType::ALT): New enumerator.
* typecheck/rust-hir-type-check-pattern.cc
(TypeCheckPattern::visit): Add AltPattern visitor.
* typecheck/rust-hir-type-check-pattern.h:
(TypeCheckPattern::visit): Add AltPattern visitor.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-macro.cc (builtin_macro_from_string): Add identifier
identification.
* ast/rust-macro.h (enum class): Add Stringify builtin macro
type.
* expand/rust-macro-builtins.cc (make_macro_path_str): Add path
for builtin stringify macro.
(MacroBuiltin::stringify_handler): Add handler for builtin
stringify macro.
* expand/rust-macro-builtins.h: Add stringify handler's
prototype.
* util/rust-hir-map.cc (Mappings::insert_macro_def): Add
stringify handler to builtin hir map.
2024-01-16 Nikos Alexandris <nikos-alexandris@protonmail.com>
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
Add length checking for tuple patterns.
(TypeCheckPattern::emit_pattern_size_error): New function.
* typecheck/rust-hir-type-check-pattern.h: New function
emit_pattern_size_error.
2024-01-16 goar5670 <mahadelr19@gmail.com>
* parse/rust-parse-impl.h (Parser::parse_expr):
split LEFT_SHIFT before null_denotation.
2024-01-16 Parthib <parthibdutta02@gmail.com>
* rust-object-export.cc: Modified
* hir/rust-ast-lower-type.cc (rust_fatal_error): Removed
(rust_assert): Added
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-early-name-resolver.cc
(EarlyNameResolver::visit):
Check for closure parameter without given type.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-typecheck-context.cc (TypeCheckContext::insert_resolved_predicate): remove
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* resolve/rust-ast-resolve-type.cc (ResolveRelativeQualTypePath::resolve_qual_seg): fix
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* ast/rust-path.h: add missing copy for node_id
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* rust-gcc.h: remove unused headers
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* ast/rust-ast.cc (QualifiedPathInType::as_string): add missing to string
* ast/rust-path.h: add missing copy+move constructors and assignment overloads
* hir/tree/rust-hir-path.h: likewise
* hir/tree/rust-hir.cc (QualifiedPathInType::as_string): add missing to string
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty.cc (ParamType::get_name): call destructure
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-resolve.cc: use unify_and infer
2024-01-16 goar5670 <mahadelr19@gmail.com>
* parse/rust-parse-impl.h (Parser::parse_closure_param):
Replace parse_pattern with parse_pattern_no_alt.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_while_let_loop_expr):
Prevent hard error on token skip.
(Parser::null_denotation): Fix parser for while let expressions.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-builtins.cc (BuiltinsContext::setup): add memset builtin to the map
* backend/rust-compile-intrinsic.cc (uninit_handler): implement uninit intrinsic
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_slice_pattern): Add
closing square bracket check.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_external_type_item):
Fix compilation error due to unnecessary move.
2024-01-16 Abdul Rafey <abdulrafeyq@gmail.com>
* hir/rust-hir-dump.cc (Dump::go): support inner attrs, crate items and node mappings
(Dump::visit): support functions, arith/logical exprs, let stmts and literals
2024-01-16 Nikos Alexandris <nikos-alexandris@protonmail.com>
* expand/rust-macro-builtins.cc (load_file_bytes): Add location parameter.
(MacroBuiltin::include_bytes_handler): Pass location to load_file_bytes.
(MacroBuiltin::include_str_handler): Pass location to load_file_bytes.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_pattern_no_alt): Handle
RestPattern correctly.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-pattern.h (class RestPattern): Add NodeId as well as
the clone_impl function.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::null_denotation): Fix if let
parsing.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-intrinsic.cc (op_with_overflow_inner): wraps op_with_overflow
(std::function<tree): likewise
(op_with_overflow): generate the intrinsic based on the tree_code op
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Add rust-ast-lower-stmt.o
* hir/rust-ast-lower-stmt.h: Move definitions to...
* hir/rust-ast-lower-stmt.cc: ...here.
2024-01-16 mxlol233 <mxlol233@outlook.com>
* 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.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-pattern.h
(StructPatternElements::operator=): Clear vector before inserting.
(TupleStructItemsNoRange::operator=): Clear vector before inserting.
(TupleStructItemsRange::operator=): Clear vectors before inserting.
(TuplePatternItemsMultiple::operator=): Clear vector before inserting.
(TuplePatternItemsRanged::operator=): Clear vectors before inserting.
(SlicePattern::operator=): Clear vector before inserting.
(AltPattern::operator=): Clear vector before inserting.
* hir/tree/rust-hir-pattern.h
(StructPatternElements::operator=): Clear vector before inserting.
(TupleStructItemsNoRange::operator=): Clear vector before inserting.
(TupleStructItemsRange::operator=): Clear vectors before inserting.
(TuplePatternItemsMultiple::operator=): Clear vector before inserting.
(TuplePatternItemsRanged::operator=): Clear vectors before inserting.
(SlicePattern::operator=): Clear vector before inserting.
2024-01-16 bl7awy <mahadelr19@gmail.com>
* typecheck/rust-casts.cc (TypeCastRules::cast_rules): Perform destructure on `from` type.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-pattern.h
(struct StructPatternElements): Change to class.
(class StructPatternElements): Change from struct.
* hir/tree/rust-hir-pattern.h
(struct StructPatternElements): Change to class.
(class StructPatternElements): Change from struct.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-hir-type-check-pattern.cc
(TypeCheckPattern::visit): Improve error messages.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* hir/tree/rust-hir-pattern.h
(class TupleStructItemsNoRange): Fix formatting.
(class TupleStructItemsRange): Fix formatting.
(class TuplePatternItemsMultiple): Fix formatting.
(class TuplePatternItemsRanged): Fix formatting.
(class SlicePattern): Fix formatting.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* ast/rust-ast-dump.cc (Dump::visit): Add visitor.
* ast/rust-ast-dump.h: Add visitor prototype.
* ast/rust-ast-full-decls.h (class RestPattern): Add forward
declaration for class RestPattern.
* ast/rust-ast-visitor.h: Add visitor prototype.
* ast/rust-ast.cc (RestPattern::accept_vis): Add function to
accept a foreign visitor.
* ast/rust-pattern.h (class RestPattern): Add class RestPattern.
* checks/errors/rust-feature-gate.h: Add visitor prototype.
* expand/rust-attribute-visitor.cc (AttrVisitor::visit): Add
visitor implementation.
* expand/rust-attribute-visitor.h: Add visitor prototype.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Add
visitor implementation.
* hir/rust-ast-lower-base.h: Add visitor prototype.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Add
visitor implementation.
* resolve/rust-ast-resolve-base.h: Add visitor prototype.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
Add visitor implementation.
* resolve/rust-early-name-resolver.h: Add visitor prototype.
* util/rust-attributes.cc (AttributeChecker::visit): Add visitor
implementation.
* util/rust-attributes.h: Add visitor prototype.
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty-cmp.h: remove
* typecheck/rust-tyty.cc (set_cmp_autoderef_mode): likewise
(reset_cmp_autoderef_mode): likewise
* typecheck/rust-tyty.h (set_cmp_autoderef_mode): likewise
(reset_cmp_autoderef_mode): likewise
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-coercion.cc (TypeCoercionRules::Coerce): Add new try_flag
(TypeCoercionRules::TypeCoercionRules): set new try flag
(TypeCoercionRules::do_coercion): default to a final unify_and in the else case
(TypeCoercionRules::coerce_unsafe_ptr): cannot coerce to a ptr from ref during autoderef
(TypeCoercionRules::coerce_borrowed_pointer): respect coerceable mutability
* typecheck/rust-coercion.h: update header
* typecheck/rust-hir-dot-operator.cc (MethodResolver::select): use new TryCoerce interface
(MethodResolver::append_adjustments): ensure we maintain adjustment mappings
* typecheck/rust-hir-dot-operator.h: add new method append_adjustments
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): extra logging
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-unify.cc (UnifyRules::go): fix inference check
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-base.h: unconsify
* backend/rust-compile.cc (HIRCompileBase::coercion_site): likewise
(HIRCompileBase::coercion_site1): likewise
* typecheck/rust-autoderef.cc (Adjuster::try_deref_type): likewise
(Adjuster::try_raw_deref_type): likewise
(Adjuster::try_unsize_type): likewise
(AutoderefCycle::cycle): likewise
(AutoderefCycle::try_autoderefed): likewise
* typecheck/rust-autoderef.h: likewise
* typecheck/rust-coercion.cc (TypeCoercionRules::select): likewise
* typecheck/rust-coercion.h: likewise
* typecheck/rust-hir-dot-operator.cc (MethodResolver::Probe): likewise
(MethodResolver::select): likewise
* typecheck/rust-hir-dot-operator.h: likewise
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-unify.cc (UnifyRules::go): respect the emit_errors flag
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-casts.cc (TypeCastRules::check): update to new interface
* typecheck/rust-coercion.cc (TypeCoercionRules::Coerce): likewise
(TypeCoercionRules::TryCoerce): likewise
(TypeCoercionRules::TypeCoercionRules): likewise
* typecheck/rust-coercion.h: likewise
* typecheck/rust-type-util.cc (coercion_site): likewise
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-unify.cc (UnifyRules::go): allow lhs infer vars
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-expr.cc (CompileExpr::resolve_method_address): update to new inteface
* typecheck/rust-coercion.cc (TypeCoercionRules::coerce_unsafe_ptr): likewise
(TypeCoercionRules::coerce_borrowed_pointer): likewise
* typecheck/rust-hir-type-check.h: likewise
* typecheck/rust-type-util.cc (unify_site_and): new interface to allow for infer and commit
* typecheck/rust-type-util.h (unify_site_and): likewise
* typecheck/rust-typecheck-context.cc (TypeCheckContext::clear_type): new interface
* typecheck/rust-unify.cc (UnifyRules::UnifyRules): update
(UnifyRules::Resolve): new optional flags for commit and infer
(UnifyRules::go): likewise
(UnifyRules::expect_adt): refactor to use new interface
(UnifyRules::expect_reference): likewise
(UnifyRules::expect_pointer): likewise
(UnifyRules::expect_array): likewise
(UnifyRules::expect_slice): likewise
(UnifyRules::expect_fndef): likewise
(UnifyRules::expect_fnptr): likewise
(UnifyRules::expect_tuple): likewise
(UnifyRules::expect_closure): likewise
* typecheck/rust-unify.h: refactor interface
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-unify.cc (UnifyRules::Resolve): refactor
(UnifyRules::commit): refactor
* typecheck/rust-unify.h: likewise
2024-01-16 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty.cc (ADTType::is_concrete): need to consider if is a num_variant
* typecheck/rust-tyty.h: refactor to cc file
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_external_type_item):
Add function to parser an external type item.
(Parser::parse_external_item):
Add identification and parsing for external type items.
* parse/rust-parse.h:
Add parser_external_type_item prototype.
2024-01-16 omkar-mohanty <franzohouser@gmail.com>
* expand/rust-macro-builtins.cc
(MacroBuiltin::include_str_handler): eager expansion
(make_macro_path_str): macto to string
(parse_single_string_literal): check for eager invocation
(MacroBuiltin::assert_handler): eager expansion
(MacroBuiltin::include_bytes_handler): eager expansion
(MacroBuiltin::include_str_handler): eager expansion
(MacroBuiltin::compile_error_handler): eager expansion
(MacroBuiltin::include_handler): eager expansion
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-item.h (class Method): Add `is_default` field.
(class Function): Likewise.
* parse/rust-parse-impl.h (Parser::parse_item): Add nice error when
parsing `default` outside of an `impl` block
(Parser::parse_trait_impl_item): Allow parsing functions
or methods when seeing `default`.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::cast_site):
Remove cast_site.
* typecheck/rust-hir-type-check-base.h: Remove cast_site
prototype.
* typecheck/rust-type-util.cc (cast_site): Add cast_site.
* typecheck/rust-type-util.h (cast_site): Add cast_site
prototype.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-item.h: Add non-const `get_visibility` to ExternalTypeItem.
* ast/rust-ast-dump.cc (Dump::visit): Add implementation for ExternalTypeItem.
* expand/rust-attribute-visitor.cc (AttrVisitor::visit): Likewise.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-item.h (class ExternalTypeItem): New class.
* ast/rust-ast.cc (ExternalTypeItem::as_string): New function.
(ExternalTypeItem::accept_vis): Likewise.
* ast/rust-ast-full-decls.h (class ExternalTypeItem): Declare class.
* ast/rust-ast-dump.cc (Dump::visit): Add base visitor for ExternalTypeItem.
* ast/rust-ast-dump.h: Likewise.
* ast/rust-ast-visitor.h: Likewise.
* checks/errors/rust-feature-gate.h: Likewise.
* expand/rust-attribute-visitor.cc (AttrVisitor::visit): Likewise.
* expand/rust-attribute-visitor.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise.
* resolve/rust-early-name-resolver.h: Likewise.
* util/rust-attributes.cc (AttributeChecker::visit): Likewise.
* util/rust-attributes.h: Likewise.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-invoc-lexer.cc (MacroInvocLexer::split_current_token):
Add proper implementation.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-item.h (class Trait): Add `has_auto` field.
* checks/errors/rust-feature.cc: Add handling for `feature(optin_builtin_traits)`
* checks/errors/rust-feature.h: Likewise.
* lex/rust-lex.cc: Fix keyword classification using hashmap.
* lex/rust-token.h: Add `auto` keyword token.
* parse/rust-parse-impl.h (Parser::parse_vis_item): Parse auto traits
on `auto` keyword.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
Remove TypeCheckBase namespace qualifier.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::coercion_site):
Remove coercion_site function.
* typecheck/rust-hir-type-check-base.h: Remove coercion_site
prototype.
* typecheck/rust-type-util.cc (coercion_site): Add coercion_site
function.
* typecheck/rust-type-util.h (coercion_site): Add coercion_site
prototype.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit):
Remove TypeCheckBase namespace qualifier.
(TypeCheckMethodCallExpr::check): Remove TypeCheckBase namespace
qualifier.
2024-01-16 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* typecheck/rust-autoderef.cc: Remove TypeCheckBase qualifier.
* typecheck/rust-hir-trait-resolve.cc: Remove TypeCheckBase
qualifier.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::unify_site):
Remove unify_site.
* typecheck/rust-hir-type-check-base.h: Remove unify_site
header.
* typecheck/rust-hir-type-check.cc (TypeResolution::Resolve):
Remove TypeCheckBase qualifier.
* typecheck/rust-type-util.cc (unify_site): Add unify_site
function.
* typecheck/rust-type-util.h (unify_site): Add unify_site
prototype.
* typecheck/rust-tyty-call.cc (TypeCheckMethodCallExpr::check):
Remove TypeCheckBase qualifier.
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_type): Allow LEFT_SHIFT to
start a type and then split it in `parse_qualified_path_type`
2024-01-16 Arthur Cohen <arthur.cohen@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_path_generic_args): Split leading
`LEFT_SHIFT` token into two `LEFT_ANGLE` tokens when parsing generic arguments.
(Parser::parse_type_path_segment): Allow `LEFT_ANGLE` as starting token for
parsing generic arguments.
2024-01-16 mxlol233 <mxlol233@outlook.com>
* checks/errors/rust-feature-gate.cc: Add implementations
for `rustc_attri`.
* checks/errors/rust-feature-gate.h: Likewise.
2024-01-16 Owen Avery <powerboat9.gamer@gmail.com>
* parse/rust-parse-impl.h
(Parser::parse_pattern): Add.
(Parser::parse_pattern_no_alt): Rename.
* parse/rust-parse.h:
(Parser::parse_pattern): Add.
(Parser::parse_pattern_no_alt): Rename.
2024-01-04 David Malcolm <dmalcolm@redhat.com>
* lang.opt.urls: New file, autogenerated by
regenerate-opt-urls.py.
2023-12-14 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Thomas Schwinge <thomas@codesourcery.com>
* config-lang.in: Add libgrust as a target module for the rust
language.
2023-11-19 David Malcolm <dmalcolm@redhat.com>
* rust-location.h: Include "rich-location.h".
2023-10-20 Patrick Palka <ppalka@redhat.com>
PR rust/111899
* backend/rust-constexpr.cc (potential_constant_expression_1):
Remove NON_DEPENDENT_EXPR handling.
* backend/rust-tree.cc (mark_exp_read): Likewise.
(mark_use): Likewise.
(lvalue_kind): Likewise.
2023-09-28 Richard Sandiford <richard.sandiford@arm.com>
* backend/rust-constexpr.cc (rs_fold_indirect_ref): Remove unused
variables.
2023-09-21 Iain Buclaw <ibuclaw@gdcproject.org>
* rust-session-manager.cc (Session::init): Call
targetrustm.rust_os_info.
* rust-target.def (rust_os_info): New hook.
2023-09-21 Iain Buclaw <ibuclaw@gdcproject.org>
* rust-lang.cc (rust_add_target_info): Remove sorry.
* rust-session-manager.cc: Replace include of target.h with
include of tm.h and rust-target.h.
(Session::init): Call targetrustm.rust_cpu_info.
* rust-target.def (rust_cpu_info): New hook.
* rust-target.h (rust_add_target_info): Declare.
2023-09-21 Iain Buclaw <ibuclaw@gdcproject.org>
* rust-target-def.h: New file.
* rust-target.def: New file.
* rust-target.h: New file.
2023-09-11 Parthib <94271200+Parthib314@users.noreply.github.com>
* Make-lang.in: Removed rust-gcc-diagnostics object file.
* rust-diagnostics.cc (rust_be_get_quotechars): Added from original file.
(rust_be_internal_error_at): Likewise.
(rust_be_error_at): Likewise.
(class rust_error_code_rule): Likewise.
(rust_be_warning_at): Likewise.
(rust_be_fatal_error): Likewise.
(rust_be_inform): Likewise.
(rust_be_debug_p): Likewise.
* rust-gcc-diagnostics.cc: Removed.
2023-09-07 David Malcolm <dmalcolm@redhat.com>
* rust-diagnostics.cc (rust_error_at): New overload.
* rust-diagnostics.h (struct ErrorCode): New struct.
(rust_error_at): New.
(rust_be_error_at): Likewise.
* rust-gcc-diagnostics.cc (class rust_error_code_rule): New class.
(rust_be_error_at): New function.
* typecheck/rust-casts.cc (TypeCastRules::emit_cast_error): Emit E0054
when reporting invalid cast error.
2023-07-05 Robin Dapp <rdapp@ventanamicro.com>
Juzhe-Zhong <juzhe.zhong@rivai.ai>
* backend/rust-tree.cc (c_common_type_for_mode): Ditto.
2023-06-22 Paul E. Murphy <murphyp@linux.ibm.com>
* rust-object-export.cc [TARGET_AIX]: Rename and update usage to
TARGET_AIX_OS.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* parse/rust-parse-impl.h
(Parser::parse_stmt): Handle unsafe expression statements.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* parse/rust-parse-impl.h
(Parser::parse_expr_stmt): Remove hypothetical unsafe + expr_stmt_without_block handling.
2023-04-06 M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
* ast/rust-ast-full-decls.h (class InlineAsm):Added class declaration.
* ast/rust-expr.h (class InlineAsm):Added class definition.
2023-04-06 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-diagnostics.h (struct Error): Add new Kind enum and various new
static constructors to allow for hints as well.
* rust-diagnostics.cc (Error::Error): Use new `kind` field properly.
* checks/errors/privacy/rust-visibility-resolver.cc
(VisibilityResolver::resolve_module_path): Use new Error API.
* expand/rust-macro-builtins.cc (MacroBuiltin::include_handler): Likewise.
* expand/rust-macro-expand.cc (parse_many): Likewise.
(transcribe_type): Likewise.
* parse/rust-parse-impl.h (Parser::parse_crate): Likewise.
* rust-session-manager.cc (Session::handle_crate_name): Likewise.
* ast/rust-ast.cc (Module::load_items): Likewise.
2023-04-06 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.h: Keep location in TraitItem base class
* ast/rust-item.h (class TraitItemFunc): Use base class location instead.
(class TraitItemMethod): Likewise.
(class TraitItemConst): Likewise.
(class TraitItemType): Likewise.
* ast/rust-macro.h: Likewise.
2023-04-06 SainiAditya1 <Adityasaini10012001@outlook.com>
* hir/tree/rust-hir-full-test.cc: Moved to...
* hir/tree/rust-hir.cc: ...here.
* Make-lang.in: Rename rust-hir-full-test.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-ast-dump.cc
(Dump::visit): Add AltPattern visitor.
* ast/rust-ast-dump.h:
(Dump::visit): Add AltPattern visitor.
* ast/rust-ast-full-decls.h
(class AltPattern): Add declaration.
* ast/rust-ast-visitor.h:
(ASTVisitor::visit): Add AltPattern visitor.
* ast/rust-ast.cc
(AltPattern::as_string): Add definition.
(AltPattern::accept_vis): Add definition.
* ast/rust-pattern.h
(class AltPattern): Add declaration.
* checks/errors/rust-feature-gate.h:
(FeatureGate::visit) Add AltPattern visitor
* expand/rust-attribute-visitor.cc
(AttrVisitor::visit): Add AltPattern visitor.
* expand/rust-attribute-visitor.h:
(AttrVisitor::visit): Add AltPattern visitor.
* hir/rust-ast-lower-base.cc
(ASTLoweringBase::visit): Add AltPattern visitor.
* hir/rust-ast-lower-base.h:
(ASTLoweringBase::visit): Add AltPattern visitor.
* resolve/rust-ast-resolve-base.cc
(ResolverBase::visit): Add AltPattern visitor.
* resolve/rust-ast-resolve-base.h:
(ResolverBase::visit): Add AltPattern visitor.
* resolve/rust-early-name-resolver.cc
(EarlyNameResolver::visit): Add AltPattern visitor.
* resolve/rust-early-name-resolver.h:
(EarlyNameResolver::visit): Add AltPattern visitor.
* util/rust-attributes.cc
(AttributeChecker::visit): Add AltPattern visitor.
* util/rust-attributes.h:
(AttributeChecker::visit): Add AltPattern visitor.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-pattern.h: Fix formatting.
2023-04-06 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-builtins.cc (MacroBuiltin::include_handler): Do not
return nullptr token in expansion of `include!()`
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* checks/errors/rust-feature-gate.h: Add trailing newline before EOF.
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-reference.cc (TraitReference::clear_associated_types): make const
(TraitReference::clear_associated_type_projections): new interface
* typecheck/rust-hir-trait-reference.h:
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): refactor
(TraitItemReference::associated_type_reset): reset projections
* typecheck/rust-hir-type-bounds.h:
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): fix bounds
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::TypeBoundsProbe): refactor into cc file
(TypeBoundsProbe::Probe): refactor
(TypeBoundsProbe::is_bound_satisfied_for_type): likewise
(TypeBoundsProbe::assemble_sized_builtin): add builtin for Sized
(TypeCheckBase::get_predicate_from_bound): refactor
(TypeBoundPredicate::lookup_associated_type): refactor
* typecheck/rust-tyty-subst.cc (SubstitutionRef::lookup_associated_impl)
(SubstitutionRef::prepare_higher_ranked_bounds): new interface to clear hanging bounds
(SubstitutionRef::monomorphize): refactor
* typecheck/rust-tyty-subst.h:
* typecheck/rust-tyty.cc (BaseType::get_locus): helper
(BaseType::satisfies_bound): ensure bounds are satisfied and assoicated types
(ParamType::ParamType): new field in constructor
(ParamType::clone): update clone
(ParamType::set_implicit_self_trait): new interface
(ParamType::is_implicit_self_trait): likewise
* typecheck/rust-tyty.h: cleanup
* util/rust-hir-map.cc (Mappings::Mappings): builtin marker
(Mappings::~Mappings): delete marker
(Mappings::lookup_builtin_marker): lookup
* util/rust-hir-map.h: update header
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* hir/tree/rust-hir-item.h: implement virtual function
* hir/tree/rust-hir.h: add virtual function
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* Make-lang.in: add new dependancy
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::query_type): refactor
* typecheck/rust-hir-type-check-base.h: refactor
* typecheck/rust-hir-type-check.h (RUST_HIR_TYPE_CHECK): refactor
* typecheck/rust-type-util.cc: New file.
* typecheck/rust-type-util.h: New file.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* expand/rust-macro-builtins.cc
(MacroBuiltin::include_str_handler): Add check for valid UTF-8.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* parse/rust-parse-impl.h
(Parser::parse_grouped_or_tuple_pattern): Add support for empty tuple patterns.
2023-04-06 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* lex/rust-lex.h: Add file type check.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-pattern.cc
(CompilePatternLet::visit): Simplify WildcardPattern compilation for let statements.
* backend/rust-compile-var-decl.h:
(CompileVarDecl::visit): Remove variable declaration for WildcardPattern.
* resolve/rust-ast-resolve-pattern.h:
(PatternDeclaration::visit): Remove name resolution for WildcardPattern.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-tyty-call.cc
(TypeCheckCallExpr::visit): Add variadic argument type checking.
(TypeCheckCallExpr::visit): Fix comment spelling ("varadic").
2023-04-06 mxlol233 <mxlol233@outlook.com>
* checks/errors/rust-feature-gate.cc: Add implementation for
`void FeatureGate::visit (AST::ExternBlock &block)`. Add `valid_feature`
construction process in `FeatureGate::check`.
* checks/errors/rust-feature-gate.h: Add declaration for
`void FeatureGate::visit (AST::ExternBlock &block)`. Add private
variable `valid_feature`.
* checks/errors/rust-feature.h: Change `issue` to `m_issue`.
2023-04-06 Thomas Schwinge <thomas@codesourcery.com>
* ast/rust-ast-fragment.cc: Update copyright years.
* ast/rust-ast-fragment.h: Likewise.
* ast/rust-macro.cc: Likewise.
* checks/errors/rust-feature-gate.cc: Likewise.
* checks/errors/rust-feature-gate.h: Likewise.
* checks/errors/rust-feature.cc: Likewise.
* checks/errors/rust-feature.h: Likewise.
* hir/rust-ast-lower-expr.cc: Likewise.
* hir/rust-ast-lower-type.cc: Likewise.
* resolve/rust-early-name-resolver.cc: Likewise.
* resolve/rust-early-name-resolver.h: Likewise.
* rust-gcc.h: Likewise.
* typecheck/rust-hir-path-probe.cc: Likewise.
* typecheck/rust-hir-trait-reference.cc: Likewise.
* typecheck/rust-tyty-bounds.h: Likewise.
* typecheck/rust-tyty-subst.cc: Likewise.
* typecheck/rust-tyty-subst.h: Likewise.
* typecheck/rust-tyty-util.cc: Likewise.
* typecheck/rust-tyty-util.h: Likewise.
* typecheck/rust-unify.cc: Likewise.
* typecheck/rust-unify.h: Likewise.
* util/rust-inline-visitor.h: Likewise.
2023-04-06 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* rust-session-manager.cc (Session::compile_crate): Update the
environment variable name.
2023-04-06 Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
* Make-lang.in: Add `rust-hir-trait-reference.o`.
* typecheck/rust-hir-trait-reference.h: Remove multiple function body.
* typecheck/rust-hir-trait-reference.cc: Add multiple function body.
2023-04-06 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-expand.cc (MacroExpander::expand_eager_invocations):
Add documentation explaining the algorithm.
2023-04-06 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-macro.cc: New file.
* Make-lang.in: Add `rust-macro.o` object
* ast/rust-ast-fragment.cc (Fragment::Fragment): Change API around
the construction of AST fragments.
(Fragment::operator=): Correct `Fragment::operator=` to take into
account the fragment tokens.
(Fragment::create_error): Use new constructor.
(Fragment::complete): Remove in favor of new constructor.
(Fragment::unexpanded): Remove as that Fragment type is no longer used
or possible.
(Fragment::get_tokens): Add helper to access a fragment's tokens.
* ast/rust-ast-fragment.h (enum class): Remove `FragmentKind::Unused`
* ast/rust-ast.cc (MacroInvocation::as_string): Display
builtin macro invocations properly.
* ast/rust-ast.h: Fix `DelimTokenTree` class copy constructors and
handling of its token vector.
* ast/rust-macro.h (class MacroMatcher): Format.
(class MetaItemSeq): Likewise.
(builtin_macro_from_string): Get a `BuiltinMacroKind` from a given
string, i.e the name of the macro (`assert!`, `cfg!` and so on).
* expand/rust-attribute-visitor.cc (AttrVisitor::visit): Do not expand
macros recursively anymore.
(AttrVisitor::maybe_expand_expr): Likewise.
(AttrVisitor::maybe_expand_type): Likewise.
* expand/rust-attribute-visitor.h: Likewise, and remove
`expand_macro_fragment_recursively` function.
* expand/rust-macro-builtins.cc (make_token): Add shorthand for
returning `std::unique_ptr<AST::Token>`s.
(make_macro_invocation): Add shorthand for returning fragments
containing builtin macro invocations.
(try_expand_macro_expression): Do not expand macros recursively.
(try_expand_single_string_literal): Likewise.
(try_expand_many_expr): Likewise.
(parse_single_string_literal): Error out more appropriately.
(MacroBuiltin::compile_error_handler): Add explanation for eager
invocation
(MacroBuiltin::file_handler): Return the proper tokens associated with
macro invocation, and builtin macros in the case of necessary eager
expansion.
(MacroBuiltin::column_handler): Likewise.
(MacroBuiltin::include_bytes_handler): Likewise.
(MacroBuiltin::include_str_handler): Likewise.
(MacroBuiltin::concat_handler): Likewise.
(MacroBuiltin::env_handler): Likewise.
(MacroBuiltin::cfg_handler): Likewise.
(MacroBuiltin::include_handler): Likewise.
(MacroBuiltin::line_handler): Likewise.
* expand/rust-macro-expand.cc (MacroExpander::expand_eager_invocations):
Add function to expand eager invocations *once* in the fixed point
pipeline.
(MacroExpander::expand_invoc): Call into `expand_eager_invocations` for
builtin macro invocations.
(MacroExpander::expand_crate): Use new `AttrVisitor` API.
(parse_many): Return tokens in `AST::Fragment`.
(transcribe_expression): Likewise.
(transcribe_type): Likewise.
* expand/rust-macro-expand.h (struct MacroExpander): Add `has_changed`
flag for fixed point checking.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::EarlyNameResolver):
Keep track of the current macro scope.
(EarlyNameResolver::go): Use `scoped` API.
(EarlyNameResolver::visit): Likewise.
* resolve/rust-early-name-resolver.h: Add `scoped` API.
* rust-session-manager.cc (Session::expansion): Perform macro expansion
in a fixed-point fashion.
2023-04-06 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-invoc-lexer.cc (MacroInvocLexer::get_token_slice):
Add API to retrieve token slices when lexing macro expansions.
* expand/rust-macro-invoc-lexer.h: Declare `get_token_slice`.
2023-04-06 Arthur Cohen <arthur.cohen@embecosm.com>
* parse/rust-parse.h: Move `parse_macro_invocation` to public API.
2023-04-06 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-item.h (class BlockExpr): Remove forward declaration of
class `BlockExpr`.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* hir/tree/rust-hir-pattern.h
(TuplePatternItemsRanged::get_lower_patterns): Add method.
(TuplePatternItemsRanged::get_upper_patterns): Add method.
* backend/rust-compile-pattern.cc
(CompilePatternLet::visit): Implement TuplePattern visitor.
* backend/rust-compile-pattern.h
(CompilePatternLet::visit): Move TuplePattern visitor out of header file.
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-unify.cc (UnifyRules::go): ensure the bounds are checked
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): remove error message
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-reference.h: add const infterface
* typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::get_generic_param): make const
(SubstitutionRef::monomorphize): fix issue
* typecheck/rust-tyty-subst.h: constify interface
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* util/rust-lang-item.h:
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty-subst.cc (SubstitutionArg::is_conrete): fix check
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* Make-lang.in: update names
* backend/rust-compile-expr.cc (CompileExpr::resolve_method_address):
update to use new interface
* typecheck/rust-coercion.cc (TypeCoercionRules::coerce_borrowed_pointer): likewise
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::unify_site): likewise
* typecheck/rust-tyty.cc (BaseType::destructure): likewise
(InferType::unify): removed old unify interface
(ErrorType::unify): likewise
(ADTType::unify): likewise
(TupleType::unify): likewise
(FnType::unify): likewise
(FnPtr::unify): likewise
(ClosureType::unify): likewise
(ArrayType::unify): likewise
(SliceType::unify): likewise
(BoolType::unify): likewise
(IntType::unify): likewise
(UintType::unify): likewise
(FloatType::unify): likewise
(USizeType::unify): likewise
(ISizeType::unify): likewise
(CharType::unify): likewise
(ReferenceType::unify): likewise
(PointerType::unify): likewise
(ParamType::unify): likewise
(StrType::unify): likewise
(NeverType::unify): likewise
(PlaceholderType::unify): likewise
(ProjectionType::unify): likewise
(DynamicObjectType::unify): likewise
* typecheck/rust-tyty.h: update destructure interface
* typecheck/rust-tyty-rules.h: Removed.
* typecheck/rust-unify.cc: New file.
* typecheck/rust-unify.h: New file.
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-reference.h: change interface to return self
* typecheck/rust-hir-trait-resolve.cc: likewise
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): likewise
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): remove monomorphization hack
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty-subst.cc: add missing callback
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty-subst.cc: update copy constructors
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty-bounds.cc: refactor to take a reference
* typecheck/rust-tyty-subst.cc: likewise
(SubstitutionRef::get_substitution_arguments): likewise
(SubstitutionRef::infer_substitions): likewise
* typecheck/rust-tyty-subst.h: likewise
* typecheck/rust-tyty.cc (ADTType::handle_substitions): likewise
(TupleType::handle_substitions): likewise
(FnType::handle_substitions): likewise
(ClosureType::handle_substitions): likewise
(ArrayType::handle_substitions): likewise
(SliceType::handle_substitions): likewise
(ReferenceType::handle_substitions): likewise
(PointerType::handle_substitions): likewise
(ParamType::handle_substitions): likewise
(ProjectionType::handle_substitions): likewise
* typecheck/rust-tyty.h: likewise
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-trait-ref.h: Moved to...
* typecheck/rust-hir-trait-reference.h: ...here.
* typecheck/rust-hir-trait-resolve.cc: refactor
* typecheck/rust-hir-trait-resolve.h (RUST_HIR_TRAIT_RESOLVE_H): likewise
* typecheck/rust-hir-type-check.h: likewise
* typecheck/rust-tyty.cc: likewise
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* Make-lang.in: update name
* typecheck/rust-tyctx.cc: Moved to...
* typecheck/rust-typecheck-context.cc: ...here.
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-type-check.h: refactor
* typecheck/rust-tyctx.cc (TypeCheckContext::iterate): refactor
(TypeCheckContext::have_loop_context): likewise
(TypeCheckContext::push_new_loop_context): likewise
(TypeCheckContext::push_new_while_loop_context): likewise
(TypeCheckContext::peek_loop_context): likewise
(TypeCheckContext::pop_loop_context): likewise
(TypeCheckContext::swap_head_loop_context): likewise
(TypeCheckContext::insert_trait_reference): likewise
(TypeCheckContext::lookup_trait_reference): likewise
(TypeCheckContext::insert_receiver): likewise
(TypeCheckContext::lookup_receiver): likewise
(TypeCheckContext::insert_associated_type_mapping): likewise
(TypeCheckContext::clear_associated_type_mapping): likewise
(TypeCheckContext::lookup_associated_type_mapping): likewise
(TypeCheckContext::insert_variant_definition): likewise
(TypeCheckContext::lookup_variant_definition): likewise
(TypeCheckContext::insert_operator_overload): likewise
(TypeCheckContext::lookup_operator_overload): likewise
(TypeCheckContext::insert_unconstrained_check_marker): likewise
(TypeCheckContext::have_checked_for_unconstrained): likewise
(TypeCheckContext::insert_resolved_predicate): likewise
(TypeCheckContext::lookup_predicate): likewise
(TypeCheckContext::insert_query): likewise
(TypeCheckContext::query_completed): likewise
(TypeCheckContext::query_in_progress): likewise
(TypeCheckContext::insert_trait_query): likewise
(TypeCheckContext::trait_query_completed): likewise
(TypeCheckContext::trait_query_in_progress): likewise
(TypeCheckContextItem::Item::Item): likewise
(TypeCheckContextItem::TypeCheckContextItem): likewise
(TypeCheckContextItem::get_item): likewise
(TypeCheckContextItem::get_impl_item): likewise
(TypeCheckContextItem::get_trait_item): likewise
(TypeCheckContextItem::get_type): likewise
* typecheck/rust-tyty.cc (StructFieldType::StructFieldType): likewise
(StructFieldType::get_ref): likewise
(StructFieldType::get_name): likewise
(StructFieldType::get_field_type): likewise
(StructFieldType::set_field_type): likewise
(StructFieldType::is_concrete): likewise
(StructFieldType::debug): likewise
(StructFieldType::get_locus): likewise
(VariantDef::variant_type_string): likewise
(VariantDef::VariantDef): likewise
(VariantDef::operator=): likewise
(VariantDef::get_error_node): likewise
(VariantDef::is_error): likewise
(VariantDef::get_id): likewise
(VariantDef::get_defid): likewise
(VariantDef::get_variant_type): likewise
(VariantDef::is_data_variant): likewise
(VariantDef::is_dataless_variant): likewise
(VariantDef::get_identifier): likewise
(VariantDef::num_fields): likewise
(VariantDef::get_field_at_index): likewise
(VariantDef::get_fields): likewise
(VariantDef::lookup_field): likewise
(VariantDef::get_discriminant): likewise
(VariantDef::as_string): likewise
(VariantDef::is_equal): likewise
(VariantDef::clone): likewise
(VariantDef::monomorphized_clone): likewise
(VariantDef::get_ident): likewise
(TupleType::TupleType): likewise
(TupleType::get_unit_type): likewise
(TupleType::is_unit): likewise
(TupleType::num_fields): likewise
(TupleType::is_concrete): likewise
(TupleType::get_fields): likewise
(BoolType::BoolType): likewise
(BoolType::get_name): likewise
(BoolType::is_concrete): likewise
(IntType::IntType): likewise
(IntType::get_name): likewise
(IntType::get_int_kind): likewise
(IntType::is_concrete): likewise
(UintType::UintType): likewise
(UintType::get_name): likewise
(UintType::get_uint_kind): likewise
(UintType::is_concrete): likewise
(FloatType::FloatType): likewise
(FloatType::get_name): likewise
(FloatType::get_float_kind): likewise
(FloatType::is_concrete): likewise
(USizeType::USizeType): likewise
(USizeType::get_name): likewise
(USizeType::is_concrete): likewise
(ISizeType::ISizeType): likewise
(ISizeType::get_name): likewise
(ISizeType::is_concrete): likewise
(CharType::CharType): likewise
(CharType::is_concrete): likewise
(CharType::get_name): likewise
(ReferenceType::ReferenceType): likewise
(ReferenceType::is_concrete): likewise
(ReferenceType::mutability): likewise
(ReferenceType::is_mutable): likewise
(ReferenceType::is_dyn_object): likewise
(ReferenceType::is_dyn_slice_type): likewise
(ReferenceType::is_dyn_str_type): likewise
(PointerType::PointerType): likewise
(PointerType::is_concrete): likewise
(PointerType::mutability): likewise
(PointerType::is_mutable): likewise
(PointerType::is_const): likewise
(PointerType::is_dyn_object): likewise
(PointerType::is_dyn_slice_type): likewise
(PointerType::is_dyn_str_type): likewise
(ParamType::ParamType): likewise
(ParamType::get_generic_param): likewise
(ParamType::can_resolve): likewise
(ParamType::is_concrete): likewise
(StrType::StrType): likewise
(StrType::get_name): likewise
(StrType::is_concrete): likewise
(NeverType::NeverType): likewise
(NeverType::get_name): likewise
(NeverType::is_unit): likewise
(NeverType::is_concrete): likewise
(PlaceholderType::PlaceholderType): likewise
(PlaceholderType::get_name): likewise
(PlaceholderType::is_unit): likewise
(PlaceholderType::get_symbol): likewise
(PlaceholderType::is_concrete): likewise
(ProjectionType::is_unit): likewise
(ProjectionType::get_name): likewise
(ProjectionType::needs_generic_substitutions): likewise
(ProjectionType::supports_substitutions): likewise
(ProjectionType::has_subsititions_defined): likewise
(ProjectionType::get): likewise
(ProjectionType::is_concrete): likewise
(DynamicObjectType::is_concrete): likewise
* typecheck/rust-tyty.h: likewise
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-path-probe.cc (PathProbeCandidate::Candidate::Candidate): refactor
(PathProbeCandidate::PathProbeCandidate): likewise
(PathProbeCandidate::as_string): likewise
(PathProbeCandidate::is_enum_candidate): likewise
(PathProbeCandidate::is_impl_candidate): likewise
(PathProbeCandidate::is_trait_candidate): likewise
(PathProbeCandidate::is_full_trait_item_candidate): likewise
(PathProbeCandidate::get_error): likewise
(PathProbeCandidate::is_error): likewise
(PathProbeCandidate::get_defid): likewise
(PathProbeCandidate::operator<): likewise
* typecheck/rust-hir-path-probe.h (struct PathProbeCandidate): likewise
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-hir-path-probe.cc (PathProbeType::PathProbeType): refactor
(PathProbeType::Probe): likewise
(PathProbeType::visit): likewise
(PathProbeType::process_enum_item_for_candiates): likewise
(PathProbeType::process_impl_items_for_candidates): likewise
(PathProbeType::is_reciever_generic): likewise
(PathProbeImplTrait::PathProbeImplTrait): likewise
(PathProbeImplTrait::Probe): likewise
(PathProbeImplTrait::process_trait_impl_items_for_candidates): likewise
* typecheck/rust-hir-path-probe.h (struct PathProbeCandidate): likewise
* typecheck/rust-hir-trait-resolve.cc
(PathProbeImplTrait::process_trait_impl_items_for_candidates): likewise
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty.cc (BaseType::BaseType): refactor
(BaseType::~BaseType): likewise
(BaseType::get_ref): likewise
(BaseType::set_ref): likewise
(BaseType::get_ty_ref): likewise
(BaseType::set_ty_ref): likewise
(BaseType::is_equal): likewise
(BaseType::is_unit): likewise
(BaseType::get_kind): likewise
(BaseType::get_combined_refs): likewise
(BaseType::append_reference): likewise
(BaseType::supports_substitutions): likewise
(BaseType::has_subsititions_defined): likewise
(BaseType::can_substitute): likewise
(BaseType::needs_generic_substitutions): likewise
(BaseType::contains_type_parameters): likewise
(BaseType::get_ident): likewise
(BaseType::get_locus): likewise
(InferType::InferType): likewise
(InferType::get_infer_kind): likewise
(InferType::get_name): likewise
(InferType::is_concrete): likewise
(ErrorType::ErrorType): likewise
(ErrorType::is_unit): likewise
(ErrorType::is_concrete): likewise
(ErrorType::get_name): likewise
(ErrorType::monomorphized_clone): likewise
* typecheck/rust-tyty.h (class SubstitutionArgumentMappings): likewise
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-substitution-mapper.cc (SubstMapper::SubstMapper): refactor
(SubstMapper::Resolve): likewise
(SubstMapper::InferSubst): likewise
(SubstMapper::have_generic_args): likewise
(SubstMapper::visit): likewise
(SubstMapperInternal::visit): likewise
(SubstMapperFromExisting::SubstMapperFromExisting): likewise
(SubstMapperFromExisting::Resolve): likewise
(SubstMapperFromExisting::visit): likewise
(GetUsedSubstArgs::GetUsedSubstArgs): likewise
(GetUsedSubstArgs::From): likewise
(GetUsedSubstArgs::visit): likewise
* typecheck/rust-substitution-mapper.h: refactor
* typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::get_generic_param): likewise
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* Make-lang.in: update the makefile
* typecheck/rust-tyty.cc (SubstitutionParamMapping::need_substitution): likewise
(SubstitutionParamMapping::override_context): likewise
(SubstitutionRef::get_mappings_from_generic_args): likewise
(SubstitutionRef::infer_substitions): likewise
(SubstitutionRef::are_mappings_bound): likewise
(SubstitutionRef::solve_missing_mappings_from_this): likewise
(SubstitutionRef::monomorphize): likewise
* typecheck/rust-tyty.h (class SubstitutionParamMapping): likewise
(class SubstitutionArg): likewise
(std::function<void): likewise
(class SubstitutionArgumentMappings): likewise
(class SubstitutionRef): likewise
* typecheck/rust-tyty-subst.cc: New file.
* typecheck/rust-tyty-subst.h: New file.
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* Make-lang.in: update makefile
* typecheck/rust-tyty.cc (TyVar::TyVar): move to new file
(TyVar::get_tyty): likewise
(TyVar::get_implicit_infer_var): likewise
(TyVar::subst_covariant_var): likewise
(TyVar::clone): likewise
(TyVar::monomorphized_clone): likewise
(TyWithLocation::TyWithLocation): likewise
* typecheck/rust-tyty.h (class BaseType): cleanup
(class TypeBoundPredicate): move to its own file
(class TypeBoundPredicateItem): likewise
(class TypeBoundsMappings): likewise
(class TyVar): likewise
(class TyWithLocation): likewise
* typecheck/rust-tyty-bounds.h: New file.
* typecheck/rust-tyty-util.cc: New file.
* typecheck/rust-tyty-util.h: New file.
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* typecheck/rust-tyty-bounds.cc (TypeBoundPredicateItem::error): refactor
(TypeBoundPredicateItem::is_error): likewise
(TypeBoundPredicateItem::get_parent): likewise
* typecheck/rust-tyty.h: Move the implementation for the above
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): Removed copy-pasted comment.
2023-04-06 mxlol233 <mxlol233@outlook.com>
* Make-lang.in: Add object files: `rust-feature.o` and `rust-feature-gate.o`
* checks/errors/rust-feature-gate.cc: New file.
* checks/errors/rust-feature-gate.h: New file.
* checks/errors/rust-feature.cc: New file.
* checks/errors/rust-feature.h: New file.
* rust-session-manager.cc: Add FeatureGate check.
2023-04-06 Arthur Cohen <arthur.cohen@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_closure_expr): Advance tokens
properly when parsing closure param list.
2023-04-06 Arthur Cohen <arthur.cohen@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_generic_arg): Handle type
paths and nested generics properly.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* ast/rust-pattern.h:
(ReferencePattern::is_double_reference): Add method.
(ReferencePattern::get_is_mut): Add method.
* hir/rust-ast-lower-pattern.cc
(ASTLoweringPattern::visit): Add ReferencePattern visitor.
* hir/rust-ast-lower-pattern.h:
(ASTLoweringPattern::visit): Add ReferencePattern visitor.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* hir/tree/rust-hir-pattern.h
(class ReferencePattern): Remove has_two_amps field.
* hir/tree/rust-hir-full-test.cc
(ReferencePattern::as_string): Remove usage of ReferencePattern::has_two_amps.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-fnparam.h
(CompileFnParam::visit): Remove HIR::GroupedPattern visitor.
* backend/rust-compile-pattern.cc
(CompilePatternCaseLabelExpr::visit): Remove HIR::GroupedPattern visitor.
(CompilePatternBindings::visit): Remove HIR::GroupedPattern visitor.
* backend/rust-compile-pattern.h
(CompilePatternCaseLabelExpr::visit): Remove HIR::GroupedPattern visitor.
(CompilePatternBindings::visit): Remove HIR::GroupedPattern visitor.
(CompilePatternLet::visit): Remove HIR::GroupedPattern visitor.
* backend/rust-compile-resolve-path.h
(ResolvePathRef::visit): Remove HIR::GroupedPattern visitor.
* backend/rust-compile-var-decl.h
(CompileVarDecl::visit): Remove HIR::GroupedPattern visitor.
* checks/errors/rust-const-checker.cc
(ConstChecker::visit): Remove HIR::GroupedPattern visitor.
* checks/errors/rust-const-checker.h
(ConstChecker::visit): Remove HIR::GroupedPattern visitor.
* checks/errors/rust-unsafe-checker.cc
(UnsafeChecker::visit): Remove HIR::GroupedPattern visitor.
* checks/errors/rust-unsafe-checker.h
(UnsafeChecker::visit): Remove HIR::GroupedPattern visitor.
* hir/rust-hir-dump.cc (Dump::visit): Remove HIR::GroupedPattern visitor.
* hir/rust-hir-dump.h (Dump::visit): Remove HIR::GroupedPattern visitor.
* hir/tree/rust-hir-full-decls.h (class GroupedPattern): Remove class.
* hir/tree/rust-hir-full-test.cc (GroupedPattern::accept_vis): Remove method.
* hir/tree/rust-hir-pattern.h (class GroupedPattern): Remove class.
* hir/tree/rust-hir-visitor.h
(HIRFullVisitor::visit): Remove HIR::GroupedPattern visitor.
(HIRFullVisitorBase::visit): Remove HIR::GroupedPattern visitor.
(HIRPatternVisitor::visit): Remove HIR::GroupedPattern visitor.
* typecheck/rust-hir-type-check-pattern.cc
(TypeCheckPattern::visit): Remove HIR::GroupedPattern visitor.
* typecheck/rust-hir-type-check-pattern.h
(TypeCheckPattern::visit): Remove HIR::GroupedPattern visitor.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* hir/rust-ast-lower-pattern.cc
(ASTLoweringPattern::visit): Lower AST::GroupedPattern to its inner pattern.
2023-04-06 MAHAD <mahadtxt@gmail.com>
* rust-buffered-queue.h: Moved to...
* util/rust-buffered-queue.h: ...here.
2023-04-06 Arthur Cohen <arthur.cohen@embecosm.com>
* parse/rust-parse-impl.h (Parser::parse_type): Handle double ampersan
properly
(Parser::parse_reference_type): Call into `parse_reference_type_inner`
and wrap double reference types in another `AST::ReferenceType` node
(Parser::parse_reference_type_inner): Add parsing implementation
which does not care about the leading token (& or &&)
(Parser::parse_type_no_bounds): Handle double ampersand properly
* parse/rust-parse.h: Declare `parse_reference_type_inner`
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-pattern.cc (CompilePatternLet::visit): New function.
* backend/rust-compile-stmt.cc (CompileStmt::visit): Likewise.
* backend/rust-compile-pattern.h (class CompilePatternLet): New visitor.
2023-04-06 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-macro.h (enum class): Add `BuiltinMacro` enum class.
* expand/rust-attribute-visitor.cc (AttrVisitor::visit): Mention
switching on `macro.kind` once builtin macro invocations are properly
handled.
* parse/rust-parse-impl.h (Parser::parse_macro_invocation): Switch to new MacroInvocation
API.
(Parser::parse_type): Likewise.
(Parser::parse_type_no_bounds): Likewise.
2023-04-06 Abdul Rafey <abdulrafeyq@gmail.com>
* ast/rust-ast-dump.cc (Dump::visit): removed extra indentations in trait ast dump
2023-04-06 Abdul Rafey <abdulrafeyq@gmail.com>
* parse/rust-parse-impl.h (Parser::null_denotation): Add proper error
when seeing wildcard var on right side of assignment.
2023-04-06 Abdul Rafey <abdulrafeyq@gmail.com>
* ast/rust-ast.cc: Fix include list.
* ast/rust-expr.h: Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
* rust-backend.h: Likewise.
* util/rust-lang-item.h: Likewise.
* operator.h: Moved to...
* util/rust-operators.h: ...here.
2023-04-06 Parthib <parthibdutta02@gmail.com>
* Make-lang.in: Rename object file.
* ast/rust-ast-full-test.cc: Moved to...
* ast/rust-ast.cc: ...here.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Add proper
visitor.
(CompilePatternBindings::visit): Likewise.
* backend/rust-compile-pattern.h: Declare them.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Add proper
visitor.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* hir/tree/rust-hir-pattern.h: Add get_item method.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Add proper visitor.
* hir/rust-ast-lower-pattern.h: Declare it.
2023-04-06 Lyra <teromene@teromene.fr>
* expand/rust-macro-expand.cc (transcribe_expression): Fix ICE when expanding
empty macros.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* resolve/rust-ast-resolve-pattern.h: Support GroupedPattern properly.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* backend/rust-compile-base.cc (HIRCompileBase::compile_locals_for_block):
Allow patterns to declare zero or multiple variables.
* backend/rust-compile-var-decl.h: Change function declaration.
2023-04-06 mxlol233 <mxlol233@outlook.com>
* lex/rust-lex.cc (Lexer::build_token): Make location enclose entire token.
(Lexer::parse_byte_char): Likewise.
(Lexer::parse_byte_string): Likewise.
(Lexer::parse_raw_byte_string): Likewise.
(Lexer::parse_raw_identifier): Likewise.
(Lexer::parse_string): Likewise.
(Lexer::parse_identifier_or_keyword): Likewise.
(Lexer::parse_raw_string): Likewise.
(Lexer::parse_non_decimal_int_literal): Likewise.
(Lexer::parse_decimal_int_or_float): Likewise.
(Lexer::parse_char_or_lifetime): Likewise.
2023-04-06 mxlol233 <mxlol233@outlook.com>
* ast/rust-ast.h: Add get_locus method.
* ast/rust-expr.h: Likewise.
* ast/rust-macro.h: Likewise.
2023-04-06 Owen Avery <powerboat9.gamer@gmail.com>
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Cleanup LetStmt
type checking.
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* hir/tree/rust-hir-path.h: Add const get_identifier and get_type method.
* typecheck/rust-hir-path-probe.h: Use new SubstitutionArgumentMappings constructor.
* typecheck/rust-hir-trait-resolve.cc: Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
* typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound):
Do not assert failure on size mismatch anymore.
(TypeBoundPredicate::TypeBoundPredicate): Use new SubstitutionArgumentMappings constructor.
(TypeBoundPredicate::operator=): Likewise.
(TypeBoundPredicate::apply_generic_arguments): Likewise.
(TypeBoundPredicateItem::get_tyty_for_receiver): Likewise.
(TypeBoundPredicate::get_num_associated_bindings): Likewise.
(TypeBoundPredicate::lookup_associated_type): Fix implementation for new system.
(TypeBoundPredicate::get_associated_type_items): Likewise.
* typecheck/rust-tyty.cc (SubstitutionRef::get_mappings_from_generic_args): Add new
behavior.
(SubstitutionRef::infer_substitions): Use new constructor and add comment.
(SubstitutionRef::solve_missing_mappings_from_this): Use new constructor.
* typecheck/rust-tyty.h: Define new constructors.
2023-04-06 Philip Herron <herron.philip@googlemail.com>
* resolve/rust-ast-resolve-type.cc (ResolveGenericArgs::go): Add name resolution to
Trait items.
2023-04-06 Raiki Tamura <tamaron1203@gmail.com>
* ast/rust-ast-full-decls.h (class MacroItem): Remove forward declaration.
* ast/rust-ast-full-test.cc (MacroRulesDefinition):
Rework MacroRulesDefinition class
* ast/rust-ast.h (class MacroItem): Remove abstract class.
* ast/rust-item.h (class MacroItem): Remove forward declaration.
* ast/rust-macro.h (class MacroItem): Likewise.
(class MacroRulesDefinition): Add MacroKind enum.
(class MacroInvocation): Fix inheritance.
* lex/rust-token.h: Token "macro" is now used.
* parse/rust-parse-impl.h (Parser::parse_item): Add handling for MACRO.
(Parser::parse_vis_item): Call into parse_decl_macro_def.
(Parser::parse_macro_item): Delete function.
(Parser::parse_macro_rules_def): Return MBE macros only.
(Parser::parse_decl_macro_def): New function.
(Parser::parse_stmt): Handle MACRO token.
(Parser::parse_stmt_or_expr_without_block): Call into parse_macro_rules_def.
* parse/rust-parse.h: Declare new function.
2023-04-06 mxlol233 <mxlol233@outlook.com>
* parse/rust-parse-impl.h (Parser::parse_generic_arg): Add proper bound parsing.
2023-04-06 Dave <dme2223@gmail.com>
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Use StackedContext
class.
2023-04-06 Prajwal S N <prajwalnadig21@gmail.com>
* checks/errors/rust-unsafe-checker.cc (check_target_attr): New function.
(UnsafeChecker::check_function_attr): Call into `check_target_attr`.
(UnsafeChecker::visit): Check for target_feature attributes.
* checks/errors/rust-unsafe-checker.h: Add declarations.
* util/rust-attributes.cc: Add attribute.
2023-04-06 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-session-manager.cc (Session::compile_crate): Fix typo.
2023-02-22 Thomas Schwinge <thomas@codesourcery.com>
* rust-lang.cc (grs_langhook_type_for_mode): Also consider all
'int_n' modes/types.
2023-02-22 Thomas Schwinge <thomas@codesourcery.com>
* rust-lang.cc (grs_langhook_init): Do not initialize
void_list_node.
2023-02-22 Thomas Schwinge <thomas@codesourcery.com>
* config-lang.in (target_libs): Remove.
2023-02-21 Raiki Tamura <tamaron1203@gmail.com>
* backend/rust-builtins.cc (BuiltinsContext::setup_math_fns): New functions.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-constexpr.cc (get_nth_callarg): Remove function.
(rs_bind_parameters_in_call): Use CALL_EXPR_ARG instead.
(potential_constant_expression_1): Likewise.
2023-02-21 Thomas Schwinge <thomas@codesourcery.com>
* lang.opt: Fix ordering of file.
2023-02-21 Philip Herron <herron.philip@googlemail.com>
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Remove unused parameters.
* backend/rust-constexpr.cc (constant_value_1): Likewise.
(fold_non_dependent_init): Likewise.
* backend/rust-tree.cc (publicly_uniquely_derived_p): Likewise.
(instantiation_dependent_expression_p): Likewise.
(type_has_nontrivial_copy_init): Likewise.
(is_normal_capture_proxy): Likewise.
(resolve_nondeduced_context): Likewise.
(undeduced_auto_decl): Likewise.
(require_deduced_type): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-reachability.cc (ReachabilityVisitor::visit): Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::visit): Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
* checks/lints/rust-lint-marklive.cc (MarkLive::go): Likewise.
* checks/lints/rust-lint-unused-var.cc (unused_var_walk_fn): Likewise.
* expand/rust-macro-builtins.cc (try_expand_single_string_literal): Likewise.
(try_expand_many_expr): Likewise.
(parse_single_string_literal): Likewise.
(MacroBuiltin::assert_handler): Likewise.
(MacroBuiltin::file_handler): Likewise.
(MacroBuiltin::column_handler): Likewise.
(MacroBuiltin::concat_handler): Likewise.
(MacroBuiltin::env_handler): Likewise.
(MacroBuiltin::line_handler): Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
(ASTLoweringBase::handle_doc_item_attribute): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/tree/rust-hir-full-test.cc (ConstGenericParam::accept_vis): Likewise.
* lex/rust-lex.cc (Lexer::parse_utf8_escape): Likewise.
(Lexer::parse_string): Likewise.
(Lexer::parse_char_or_lifetime): Likewise.
* lex/rust-lex.h: Likewise.
* metadata/rust-export-metadata.cc: Likewise.
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveType::visit): Likewise.
(ResolveTypeToCanonicalPath::visit): Likewise.
* resolve/rust-ast-verify-assignee.h: Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* typecheck/rust-hir-type-check-item.h: Likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise.
* typecheck/rust-tyty-rules.h: Likewise.
* util/rust-attributes.cc (AttributeChecker::visit): Likewise.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* hir/tree/rust-hir-expr.h: Add const `get_method_name`.
* hir/tree/rust-hir-full-decls.h (struct GenericArgs): Move from `struct`...
(class GenericArgs): ...to `class`.
* hir/tree/rust-hir-path.h (struct GenericArgs): Likewise.
(class GenericArgs): Clear `type_args` in copy constructor.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Reorder
debug print.
* typecheck/rust-tyty.h: Add default constructors for `SubstitutionArgumentMappings`.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* backend/rust-compile-context.cc (Context::push_closure_context): New function.
(Context::pop_closure_context): Likewise.
(Context::insert_closure_binding): Likewise.
(Context::lookup_closure_binding): Likewise.
* backend/rust-compile-context.h: Declare new functions and closure mappings.
* backend/rust-compile-expr.cc (CompileExpr::visit): Visit captures properly.
(CompileExpr::generate_closure_function): Compile captures properly.
* backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve): Check for
closure bindings.
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Compile capture list's
types as well.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Pass captures
properly to `TyTy::ClosureType` constructor.
* typecheck/rust-tyty.cc (ClosureType::as_string): Fix string representation.
(ClosureType::clone): Pass `captures` argument.
* typecheck/rust-tyty.h: Add `captures` field.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Use proper closure
contexts.
* resolve/rust-name-resolver.cc (Scope::lookup_decl_type): New function.
(Scope::lookup_rib_for_decl): Likewise.
(Resolver::insert_resolved_name): Insert captured items.
(Resolver::push_closure_context): New function.
(Resolver::pop_closure_context): Likewise.
(Resolver::insert_captured_item): Likewise.
(Resolver::decl_needs_capture): Likewise.
(Resolver::get_captures): Likewise.
* resolve/rust-name-resolver.h: Declare new functions.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Add Rib argument.
(ResolveExpr::resolve_closure_param): Likewise.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit): Likewise.
(ResolveItem::visit): Likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): Likewise.
* resolve/rust-ast-resolve-pattern.h: Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* resolve/rust-ast-resolve-type.h: Likewise.
* resolve/rust-name-resolver.cc (Rib::lookup_decl_type): Likewise.
(Scope::insert): Likewise.
(Resolver::insert_builtin_types): Likewise.
* resolve/rust-name-resolver.h: Likewise.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* resolve/rust-name-resolver.cc (MKBUILTIN_TYPE): Remove macro.
(Rib::Rib): Remove `mappings` field.
(Resolver::generate_builtins): Use `setup_builtin` instead of macro.
(Resolver::setup_builtin): New function.
* resolve/rust-name-resolver.h: Declare `setup_builtin`, add FIXME
comment.
2023-02-21 Raiki Tamura <tamaron1203@gmail.com>
* lex/rust-lex.cc (Lexer::Lexer): Add `dump_lex` boolean flag.
(Lexer::skip_token): Dump tokens if flag is enabled.
(Lexer::dump_and_skip): New function.
* lex/rust-lex.h: Include optional.h and declare functions.
* parse/rust-parse-impl.h (Parser::debug_dump_lex_output): Remove old
unused function.
* parse/rust-parse.h: Likewise.
* rust-session-manager.cc (Session::compile_crate): Pass lexer dump
option to lexer.
(Session::dump_lex): New function.
* util/rust-optional.h: Add missing constructor.
2023-02-21 Dave <dme2223@gmail.com>
* ast/rust-item.h: Remoe default location for Visibility class.
* parse/rust-parse-impl.h (Parser::parse_visibility): Pass proper location
when instantiating visibilities.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Fix dumping of fn params.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Remove extraneous string when
dumping statements.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc: Remove unused include.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
* ast/rust-ast-dump.h: Likewise.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
* ast/rust-ast-dump.h: Add missing getter declaration.
* ast/rust-ast-full-test.cc (BareFunctionType::as_string): Fix bare function
string representation.
* ast/rust-type.h (class BareFunctionType): Declare said getter.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing visitor.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing tuple type visitor.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing never type visitor.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing RawPointer visitor.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing array visitor
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing slice visitor.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing visitors.
* ast/rust-ast-dump.h: Likewise.
* ast/rust-ast.h: Add `get_lifetime_bounds` method.
* ast/rust-item.h: Add missing getter for lifetimes.
* ast/rust-type.h: Likewise.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add new reference visitor wrapper.
* ast/rust-ast-dump.h: Declare it.
* ast/rust-item.h: Add mutable visibility getters.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Fix extra call
to `delete`.
2023-02-21 Dave <dme2223@gmail.com>
* ast/rust-item.h: Add location member.
* hir/rust-ast-lower.cc (translate_visibility): Pass location argument.
* hir/tree/rust-hir-item.h: Fix constructor to accept Location argument.
2023-02-21 Raiki Tamura <tamaron1203@gmail.com>
* util/rust-lang-item.h: Add handling for `phantom_data` lang item.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add handling for unit structures.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.h: Fix documentation.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::go): Use new API.
(Dump::format_function_param): Refactor.
(Dump::visit_items_joined_by_separator): New function.
(Dump::emit_attrib): Refactor.
(Dump::visit_as_line): New function.
(Dump::visit_items_as_lines): Likewise.
(Dump::visit_items_as_block): Likewise.
(Dump::visit): Use new API.
(Dump::emit_visibility): Likewise.
(Dump::emit_indented_string): Likewise.
(Dump::emit_generic_params): Likewise.
(Dump::format_tuple_field): Likewise.
(Dump::format_struct_field): Likewise.
(Dump::format_function_common): Likewise.
(Dump::visit_function_common): Likewise.
* ast/rust-ast-dump.h: Declare new functions and add documentation.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add new visit function for overloading.
* ast/rust-ast-dump.h: Add documentation for layer.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-builtins.cc (BuiltinsContext::setup_atomic_fns): Declare atomic
load intrinsics.
* backend/rust-compile-intrinsic.cc (atomic_load_handler_inner): New handler.
(atomic_load_handler): Likewise.
(unchecked_op_handler): Remove `static` function qualifier.
(build_atomic_builtin_name): Handle load intrinsics.
(atomic_store_handler_inner): New handler.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-compile-intrinsic.cc (check_for_basic_integer_type): New function.
(build_atomic_builtin_name): Use HIR Type instead of `tree`.
(atomic_store_handler_inner): Cleanup error handling.
(unchecked_op_inner): Likewise.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-compile-intrinsic.cc (wrapping_op_handler): Refactor to return
an `std::function`.
(wrapping_op_handler_inner): Rename.
(wrapping_add_handler): Remove function.
(wrapping_sub_handler): Likewise.
(wrapping_mul_handler): Likewise.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-compile-intrinsic.cc (is_basic_integer_type): New function.
(unchecked_op_inner): New handler.
(unchecked_op_handler): New handler.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-builtins.cc (BuiltinsContext::setup_atomic_fns): New function.
(BuiltinsContext::setup): Call `setup_atomic_fns`.
* backend/rust-builtins.h: Declare `setup_atomic_fns`.
* backend/rust-compile-intrinsic.cc (atomic_store_handler_inner): New function.
(atomic_store_handler): New handler.
(make_unsigned_long_tree): Add helper around making unsigned long trees.
(prefetch_data_handler): Use `make_unsigned_long_tree`.
(build_atomic_builtin_name): New function.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-constexpr.cc (build_anon_member_initialization): Workaround uninitialized
values.
(build_data_member_initialization): Likewise.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-compile-intrinsic.cc (sorry_handler): New intrinsic handler.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-builtins.cc (MacroBuiltin::assert): Rename to...
(MacroBuiltin::assert_handler): ..this.
(MacroBuiltin::file): Rename to...
(MacroBuiltin::file_handler): ..this.
(MacroBuiltin::column): Rename to...
(MacroBuiltin::column_handler): ..this.
(MacroBuiltin::include_bytes): Rename to...
(MacroBuiltin::include_bytes_handler): ..this.
(MacroBuiltin::include_str): Rename to...
(MacroBuiltin::include_str_handler): ..this.
(MacroBuiltin::compile_error): Rename to...
(MacroBuiltin::compile_error_handler): ..this.
(MacroBuiltin::concat): Rename to...
(MacroBuiltin::concat_handler): ..this.
(MacroBuiltin::env): Rename to...
(MacroBuiltin::env_handler): ..this.
(MacroBuiltin::cfg): Rename to...
(MacroBuiltin::cfg_handler): ..this.
(MacroBuiltin::include): Rename to...
(MacroBuiltin::include_handler): ..this.
(MacroBuiltin::line): Rename to...
(MacroBuiltin::line_handler): ..this.
* expand/rust-macro-builtins.h: Rename all handlers.
* util/rust-hir-map.cc (Mappings::insert_macro_def): Use new handler
names.
2023-02-21 Simon Cook <simon.cook@embecosm.com>
* util/rust-inline-visitor.h: Remove some offending system includes.
2023-02-21 YizhePKU <yizhe@pku.edu.cn>
* util/rust-inline-visitor.h: New file.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): Refactor checking of closures.
(CompileExpr::generate_possible_fn_trait_call): New function.
* backend/rust-compile-expr.h: Declare `generate_possible_fn_trait_call`.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound): Add missing
implementation.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* Make-lang.in: Compile rust-ast-lower-type.cc.
* ast/rust-path.h: Add `get_locus` method to `TypePathFunction`.
* hir/rust-ast-lower-base.cc (ASTLowerTypePath::visit): Move implementation to
rust-ast-lower-type.cc.
(ASTLowerQualifiedPathInType::visit): Likewise.
(ASTLoweringType::visit): Likewise.
* hir/rust-ast-lower-type.h: Move implementations to source file.
* hir/tree/rust-hir-path.h: Likewise.
* hir/rust-ast-lower-type.cc: New file.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Add missing handling of
function case.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* backend/rust-compile-context.h: Add new functions: `insert_closure_decl` and
`lookup_closure_decl`.
* backend/rust-compile-expr.cc (CompileExpr::visit): Start compiling Closures properly.
(CompileExpr::generate_closure_function): New function.
(CompileExpr::generate_closure_fntype): Likewise.
* backend/rust-compile-expr.h: Declare `generate_closure_function` and
`generate_closure_fntype`.
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Visit closure types properly.
* backend/rust-mangle.cc (legacy_mangle_name): Add support for closures.
* backend/rust-tree.h (RS_CLOSURE_FLAG): Add new tree macro.
(RS_CLOSURE_TYPE_P): And checking for it on tree nodes.
* typecheck/rust-tyty.cc (ClosureType::is_equal): Add implementation.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* hir/tree/rust-hir-expr.h: Add `get_params` method.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Typecheck closure nodes.
(TypeCheckExpr::resolve_fn_trait_call): New function.
* typecheck/rust-hir-type-check-expr.h: Declare `resolve_fn_trait_call` and
`resolve_possible_fn_trait_call_method_name`.
* typecheck/rust-hir-type-check.h: Declare `get_context_type`.
* typecheck/rust-tyctx.cc (TypeCheckContextItem::get_context_type): New function.
* typecheck/rust-tyty-cmp.h: Visit closures properly.
* typecheck/rust-tyty-rules.h: Likewise.
* typecheck/rust-tyty.cc (BaseType::bounds_compatible): Add commented out assertin.
(ClosureType::as_string): Implement it.
(ClosureType::clone): Fix closure cloning.
(ClosureType::setup_fn_once_output): New function.
* typecheck/rust-tyty.h: Improve `ClosureType` class and declare `setup_fn_once_output`.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Visit closures properly.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
* checks/lints/rust-lint-marklive.h: Likewise.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Simplify method
call type checking by removing visitor and instead using one static cast. Use the
new interface.
* typecheck/rust-tyty-call.cc (TypeCheckMethodCallExpr::visit): Likewise.
(TypeCheckMethodCallExpr::go): Likewise.
(TypeCheckMethodCallExpr::check): Likewise.
* typecheck/rust-tyty-call.h (class TypeCheckMethodCallExpr): Likewise.
(class Argument): Likewise.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Visit closure properly when
name resolving.
(ResolveExpr::resolve_closure_param): Implement closure name resolving.
* resolve/rust-ast-resolve-expr.h: Declare visitors for closure types.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::ASTLoweringPattern):
Improve formatting.
(ASTLoweringPattern::translate): Likewise.
* hir/rust-ast-lower-pattern.h: Likewise.
* resolve/rust-ast-resolve-expr.h: Likewise.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* Make-lang.in: Add new object file for expression lowering.
* ast/rust-expr.h: Move implementation of expr lowering to source file.
* backend/rust-compile-block.h: Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* backend/rust-compile-expr.h: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-const-checker.h: Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.h: Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-expr.h (RUST_AST_LOWER_EXPR): Likewise.
* hir/rust-ast-lower.cc (ASTLoweringBase::lower_closure_param): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/rust-hir-dump.h: Likewise.
* hir/tree/rust-hir-expr.h (class ClosureExpr): Likewise.
(class ClosureExprInner): Likewise.
(class ClosureExprInnerTyped): Likewise.
* hir/tree/rust-hir-full-decls.h (class ClosureExprInner): Likewise.
(class ClosureExprInnerTyped): Likewise.
* hir/tree/rust-hir-full-test.cc (ClosureExprInnerTyped::as_string): Likewise.
(ClosureExprInner::as_string): Likewise.
(ClosureExprInner::accept_vis): Likewise.
(ClosureExpr::accept_vis): Likewise.
(ClosureExprInnerTyped::accept_vis): Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
* hir/tree/rust-hir.h (class Expr): Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* hir/rust-ast-lower-expr.cc: New file.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* util/rust-lang-item.h: Add handling for `fn_once_output`.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-fragment.cc (Fragment::Fragment): Add better APIs.
(Fragment::complete): New function.
(Fragment::unexpanded): New function.
* ast/rust-ast-fragment.h: Declare new APIs and add documentation.
* expand/rust-attribute-visitor.h: Use new Fragment API.
* expand/rust-macro-builtins.cc (MacroBuiltin::file): Likewise.
(MacroBuiltin::column): Likewise.
(MacroBuiltin::include_bytes): Likewise.
(MacroBuiltin::include_str): Likewise.
(MacroBuiltin::concat): Likewise.
(MacroBuiltin::env): Likewise.
(MacroBuiltin::cfg): Likewise.
(MacroBuiltin::include): Likewise.
(MacroBuiltin::line): Likewise.
* expand/rust-macro-expand.cc (parse_many): Likewise.
(transcribe_expression): Likewise.
(transcribe_type): Likewise.
* expand/rust-macro-expand.h (struct MacroExpander): Likewise.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.h (class ASTFragment): Remove old ASTFragment class.
* ast/rust-macro.h (class MacroRulesDefinition): Use new Fragment API.
* expand/rust-attribute-visitor.h: Likewise.
* expand/rust-macro-builtins.cc (macro_end_token): Likewise.
(MacroBuiltin::assert): Likewise.
(MacroBuiltin::file): Likewise.
(MacroBuiltin::column): Likewise.
(MacroBuiltin::include_bytes): Likewise.
(MacroBuiltin::include_str): Likewise.
(MacroBuiltin::compile_error): Likewise.
(MacroBuiltin::concat): Likewise.
(MacroBuiltin::env): Likewise.
(MacroBuiltin::cfg): Likewise.
(MacroBuiltin::include): Likewise.
(MacroBuiltin::line): Likewise.
* expand/rust-macro-builtins.h: Likewise.
* expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Likewise.
(MacroExpander::expand_invoc): Likewise.
(MacroExpander::match_repetition): Likewise.
(parse_many): Likewise.
(transcribe_many_items): Likewise.
(transcribe_many_ext): Likewise.
(transcribe_many_trait_items): Likewise.
(transcribe_many_impl_items): Likewise.
(transcribe_many_trait_impl_items): Likewise.
(transcribe_expression): Likewise.
(transcribe_type): Likewise.
(transcribe_on_delimiter): Likewise.
(tokens_to_str): Likewise.
* expand/rust-macro-expand.h (struct MacroExpander): Likewise.
* util/rust-hir-map.cc (Mappings::insert_macro_def): Likewise.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Add `rust-ast-fragment.o` object file.
* ast/rust-ast-fragment.cc: New file.
* ast/rust-ast-fragment.h: New file.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): Check if a
trait query is currently in progress.
* typecheck/rust-hir-type-check.h (class TraitQueryGuard): Add helpers around
checking for trait queries and inserting them.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-dump.cc (Dump::visit): Add missing visitors for macro definition dumping.
(get_delimiters): New function.
* ast/rust-ast-dump.h: Declare `get_delimiters` and add documentation.
* ast/rust-macro.h: Add `get_token_tree` method.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Properly handle unloaded modules.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-dump.cc (Dump::visit): Fix formatting when dumping modules.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-dump.cc (Dump::visit): Dump items in modules properly.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-dump.cc: Emit visibility when dumping items.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* hir/rust-ast-lower-base.h (class ItemWrapper): New class.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_outer_attributes): Use
`ItemWrapper` class.
(ASTLoweringBase::handle_doc_item_attribute): Likewise.
(ASTLoweringBase::handle_lang_item_attribute): Likewise.
* hir/rust-ast-lower-implitem.h: Check outer attributes on items.
* hir/tree/rust-hir-item.h: Add `get_trait_locus` methods.
* hir/tree/rust-hir.h: Likewise.
* util/rust-hir-map.h: Add defId mappings and associated functions.
* util/rust-hir-map.cc (Mappings::insert_defid_mapping): Implement insertion to said
mappings.
(Mappings::lookup_trait_item_defid): And looking up said mappings.
2023-02-21 Jakub Dupak <dev@jakubdupak.com>
* ast/rust-ast-dump.cc (Dump::visit): Add code for dumping type aliases.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::TraitResolver): Do not nullptr init
`resolved_trait_reference` anymore.
(TraitResolver::resolve_path): Simplify function and rename to...
(TraitResolver::resolve_path_to_trait): ...this.
(TraitResolver::lookup_path): Use new interface.
* typecheck/rust-hir-trait-resolve.h (class TraitResolver): Do not inherit `HIRFullVisitor`
class anymore.
2023-02-21 David Faust <david.faust@oracle.com>
* ast/rust-ast-dump.cc (Dump::visit): Add dump for RangeExprs.
2023-02-21 David Faust <david.faust@oracle.com>
* ast/rust-ast-dump.cc (Dump::visit): Add dump for, BorrowExpr, DereferenceExpr,
ErrorPropagationExpr, NegationExpr, TypeCastExpr and GroupedExpr.
2023-02-21 David Faust <david.faust@oracle.com>
* ast/rust-ast-dump.cc (Dump::visit): Add dump code for ArrayExpr.
2023-02-21 David Faust <david.faust@oracle.com>
* ast/rust-ast-dump.cc (Dump::visit): Add dumps for ComparisonExpr and
LazyBooleanExpr.
2023-02-21 David Faust <david.faust@oracle.com>
* ast/rust-ast-dump.cc (Dump::visit): Fix IfExpr formatting.
2023-02-21 David Faust <david.faust@oracle.com>
* ast/rust-ast-dump.cc (Dump::visit): Fix block formatting.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-autoderef.cc: Add support for multiple resolution candidates.
* typecheck/rust-hir-dot-operator.cc (MethodResolver::MethodResolver): Edit
`try_result` field and change constructor.
(MethodResolver::Probe): Return set of candidates instead of singular candidate.
(MethodResolver::select): Add better implementation to account for multiple
candidates.
* typecheck/rust-hir-dot-operator.h (struct MethodCandidate): Overload comparison
operator in order to store them in `std::set`.
* typecheck/rust-hir-inherent-impl-overlap.h: Do not fail assertion on missing type.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Adapt code to use
multiple candidates.
* typecheck/rust-tyty.cc (set_cmp_autoderef_mode): Add code to handle automatic
derefs properly.
(reset_cmp_autoderef_mode): Add helper function to reset said mode.
* typecheck/rust-tyty.h (set_cmp_autoderef_mode): Declare function.
(reset_cmp_autoderef_mode): Likewise.
* typecheck/rust-tyty-cmp.h: Add handling of `autoderef_cmp_flag`
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* util/rust-abi.cc (get_abi_from_string): Add missing "rust-call"
possibility for ABI variant.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* util/rust-lang-item.h: Add `fn_once` lang item.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* backend/rust-compile.cc: Add note about missing support for super
traits.
* typecheck/rust-tyty.cc (BaseType::satisfies_bound): New function.
(BaseType::bounds_compatible): New function.
(DynamicObjectType::get_object_items): New function.
* typecheck/rust-hir-trait-ref.h: Use new API to perform type resolution
on dyn objects.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Compile early name resolver.
* expand/rust-attribute-visitor.cc (AttrVisitor::visit): Move macro
name resolution.
* expand/rust-macro-builtins.cc (try_expand_macro_expression): Run ENR
when recursively expanding macros.
* expand/rust-macro-expand.cc (MacroExpander::expand_invoc): No longer
perform name resolution in `expand_invoc`.
* expand/rust-macro-expand.h (struct MacroExpander): Keep ENR within
MacroExpander.
* rust-session-manager.cc (Session::expansion): Run ENR.
* resolve/rust-early-name-resolver.cc: New file.
* resolve/rust-early-name-resolver.h: New file.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-path.h: Add `accept_vis` method to `GenericArg` class.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Add note for
glob import resolving.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-hir-map.h: Add new mappings.
* util/rust-hir-map.cc (Mappings::insert_macro_invocation): Add insertion
function into mappings.
(Mappings::lookup_macro_invocation): Add lookup function for mappings.
2023-02-21 Marc Poulhiès <dkm@kataplop.net>
* parse/rust-parse-impl.h (Parser::parse_stmt_or_expr_without_block):
Check if `expr` is valid after parsing it.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-builtins.cc (BuiltinsContext::setup): Declare prefetch
intrinsics.
* backend/rust-compile-intrinsic.cc (enum class Prefetch): Add kinds of
prefetch intrinsics.
(prefetch_data_handler): New function.
(prefetch_read_data): Likewise.
(prefetch_write_data): Likewise.
2023-02-21 David Faust <david.faust@oracle.com>
* ast/rust-ast-dump.cc (Dump::visit): Fill empty functions for
structs, enums and unions.
2023-02-21 David Faust <david.faust@oracle.com>
* ast/rust-ast-dump.cc (Dump::format_tuple_field): New.
(Dump::format_struct_field): New.
* ast/rust-ast-dump.h (format_tuple_field): New.
(format_struct_field): New.
2023-02-21 David Faust <david.faust@oracle.com>
* ast/rust-ast-dump.cc (Dump::visit): move generic params dump ...
(Dump::emit_generic_params): ... here.
* ast/rust-ast-dump.h (emit_generic_params): New.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-hir-trait-ref.h (lookup_trait_item): Add lookup
in super_trait.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* backend/rust-compile-expr.cc
(CompileExpr::resolve_method_address): Use auto and minor change
in candidate init.
* typecheck/rust-hir-type-check-path.cc
(TypeCheckExpr::resolve_segments): Likewise.
* typecheck/rust-hir-type-check-type.cc: Likewise.
* backend/rust-compile-resolve-path.cc
(HIRCompileBase::query_compile): Likewise. Removecall to
set_ty_ref.
* typecheck/rust-hir-path-probe.h (struct PathProbeCandidate): Add
locus initializer in ctor, implement get_defid.
(class PathProbeType::Probe): return a set instead of vector.
Adjust class impl.
(class ReportMultipleCandidateError): Do not inherit from
HIRImplVisitor anymore and remove corresponding impl. Adjust for
change in Probe. Simplify Report handling.
(class PathProbeImplTrait::Probe): Adjust return type.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-hir-type-check-enumitem.cc
(TypeCheckEnumItem::visit): Adjust VariantDef ctor calls with
DefID.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit):
Likewise.
* typecheck/rust-tyty.h (VariantDef): Add defid parameter to ctor.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* Make-lang.in: Add `rust-builtins.o` as target
* backend/rust-builtins.h: Refactor to new file.
* backend/rust-builtins.cc: New file.
2023-02-21 David Faust <david.faust@oracle.com>
* ast/rust-ast-dump.cc (Dump::visit): Implement visitor for If
expressions.
2023-02-21 David Faust <david.faust@oracle.com>
* ast/rust-ast-dump.cc (Dump::visit): Dump assignment and compound
assignment expressions.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::query_type):
Check for recursive queries.
* typecheck/rust-hir-type-check.h: New functions: `query_completed`,
`query_in_progress`, `insert_query`.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Use `query_type` API.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-dump.cc (Dump::emit_visibility): New function.
(Dump::visit): Call into `emit_visibility`.
(Dump::format_function_common): Likewise.
* ast/rust-ast-dump.h: Declare `emit_visibility`.
2023-02-21 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-item.h: Rename get_public_vis_type.
* hir/rust-ast-lower.cc (translate_visibility): Use new name.
2023-02-21 Philip Herron <philip.herron@embecosm.com>
* resolve/rust-name-resolver.h: Add miscellenaous item mappings.
* resolve/rust-name-resolver.cc (Resolver::insert_resolved_misc): Use
new mappings.
(Resolver::lookup_resolved_misc): Likewise.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments):
Adapt function to insert into miscelleanous mappings.
* checks/lints/rust-lint-marklive.cc (MarkLive::find_ref_node_id):
Allow lookup in miscelleanous mappings in mark-live phase.
2023-02-20 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* backend/rust-tree.cc: Include memmodel.h.
2023-02-17 Thomas Schwinge <thomas@codesourcery.com>
* backend/rust-tree.cc: '#include "tm_p.h"'.
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* Make-lang.in: Remove `rust-hir-typecheck-toplevel` object and add
`rust-hir-path-probe` one.
* typecheck/rust-hir-dot-operator.cc (MethodResolver::MethodResolver):
Remove no longer used `context` and `mapping` fields, and use new
`query_type` API.
(MethodResolver::MethodResolver): Likewise.
(MethodResolver::select): Use new `query_type` API.
* typecheck/rust-hir-path-probe.h: New header.
* typecheck/rust-hir-path-probe.cc: New file.
* typecheck/rust-hir-dot-operator.h (class MethodResolver): Remove no
longer used `context` and `mapping` fields, and use new `query_type` API.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::query_type): New function.
* typecheck/rust-hir-type-check-base.h: Declare `query_type` function.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Add debug print.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::Resolve):
Refactor and make use of new query system.
(TypeCheckTopLevelExternItem::Resolve): Likewise.
(TypeCheckTopLevelExternItem::visit): Likewise.
(TypeCheckTopLevelImplItem::visit): Likewise.
(TypeCheckImplItem::visit): Likewise.
(TypeCheckImplItem::TypeCheckImplItem): Likewise.
(TypeCheckImplItem::Resolve): Likewise.
(TypeCheckImplItemWithTrait::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.h (class TypeCheckTopLevelImplItem): Likewise.
(class TypeCheckImplItemWithTrait): Likewise.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::TypeCheckItem): Likewise.
(TypeCheckItem::Resolve): Likewise.
(TypeCheckItem::ResolveImplItem): Likewise.
(TypeCheckItem::ResolveImplBlockSelf): Likewise.
(TypeCheckItem::visit): Likewise.
(TypeCheckItem::resolve_impl_item): Likewise.
(TypeCheckItem::resolve_impl_block_substitutions): Likewise.
(TypeCheckItem::resolve_impl_block_self): Likewise.
* typecheck/rust-hir-type-check-item.h: Likewise.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path): Likewise.
(TypeCheckExpr::resolve_segments): Likewise.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.h: Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::Resolve): Likewise.
(TypeCheckType::visit): Likewise.
(TypeCheckType::resolve_root_path): Likewise.
* typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): Likewise.
* typecheck/rust-hir-type-check.h: Likewise.
* typecheck/rust-substitution-mapper.h: Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Likewise.
(TypeCheckBase::get_predicate_from_bound): Likewise.
(TypeBoundsMappings::add_bound): Likewise.
* typecheck/rust-tyty-cmp.h: Likewise.
* typecheck/rust-tyty.h: Likewise.
* typecheck/rust-tyty.cc (SubstitutionRef::infer_substitions): Likewise.
(ParamType::resolve): Do not infinite loop anymore.
* util/rust-hir-map.h: Add new `hirImplBlockTypeMappings` and
declare `lookup_impl_block_type`.
* util/rust-hir-map.cc (Mappings::insert_hir_impl_block): Use new
`hirImplBlockTypeMappings`
(Mappings::lookup_impl_block_type): New function.
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* backend/rust-compile-context.h: Add new optional `asm_name` string
argument to `lookup_function_decl`.
* backend/rust-compile-item.cc (CompileItem::visit): Compute assembly
name and pass it to `lookup_function_decl` when calling it.
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* backend/rust-constexpr.cc (eval_store_expression): Remove invalid
assertion on constexpr constructors.
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* backend/rust-compile-expr.h: Formatting.
2023-01-31 liushuyu <liushuyu011@gmail.com>
* ast/rust-ast.h (class MacroInvocData): Store expander as
member of the class.
(class Expr): Add `is_literal` virtual method
* ast/rust-expr.h: Override `is_literal` for `LiteralExpr`s.
* expand/rust-macro-builtins.cc (try_expand_macro_expression): New function.
(try_extract_string_literal_from_fragment): Likewise.
(try_expand_single_string_literal): Likewise.
(try_expand_many_expr): Likewise.
(parse_single_string_literal): Add macro expander as argument.
(MacroBuiltin::include_bytes): Pass expander as argument to
`parse_single_string_literal`.
(MacroBuiltin::include_str): Likewise.
(MacroBuiltin::compile_error): Likewise.
(MacroBuiltin::include): Likewise.
(MacroBuiltin::concat): Likewise and add better error handling.
(MacroBuiltin::env): Likewise.
* expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Expand
invocations recursively.
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
* lang.opt: Add new ``-frust-compile-until` option.
* rust-session-manager.cc (Session::compile_crate): Add stops around
various compilation steps in the pipeline.
* rust-session-manager.h (struct CompileOptions): Add `CompileStep` enum
and field.
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* backend/rust-tree.cc (rs_type_quals): Comment out bad assertion
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-hir-type-check-toplevel.cc (TypeCheckTopLevel::visit):
Make static items behave more similarly to const items.
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* backend/rust-compile-item.cc (CompileItem::visit): Const evaluate
static item expressions.
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Do not lower
null items within modules.
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-attributes.cc: Add `macro_use` to list of builtin
attributes.
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/errors/rust-const-checker.cc (ConstChecker::ctx_to_str): Allow
getting an error string from a specific constant context.
(ConstChecker::ctx_allows_default): New function, check if a context
allows default values for Const generics.
(ConstChecker::visit): Call into `ctx_allows_default`.
* checks/errors/rust-const-checker.h: Declare `ctx_allows_default`.
2023-01-31 liushuyu <liushuyu011@gmail.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): Properly formulate
exit condition when compiling while loops.
2023-01-31 Faisal Abbas <90.abbasfaisal@gmail.com>
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Turn
constant item typechecking into a coercion site instead of a unify
site.
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-tyty.h: Fix `is_concrete` for unit types with
substitutions.
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::contains_associated_types):
Check if a type bound predicate contains assocated types.
* typecheck/rust-tyty.h: Declare the above mentioned function.
* typecheck/rust-hir-trait-resolve.cc: Use `contains_associated_types`
function.
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Add
more calls to `rust_debug` for development.
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* backend/rust-compile-base.cc: Improve compilation pipeline and simplify
function.
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* backend/rust-tree.cc (comptypes): Remove some C++ specific checks in
Rust const folder for now.
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::unify_site): Add
better unification function with debug calls.
* typecheck/rust-autoderef.cc (AutoderefCycle::cycle): Add more debug
calls and use new unify API.
* typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion): Likewise.
(TypeCoercionRules::coerce_borrowed_pointer): Likewise.
(TypeCoercionRules::select): Likewise.
* typecheck/rust-hir-dot-operator.cc (MethodResolver::select): Likewise.
* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item): Likewise.
(TypeCheckBase::coercion_site): Likewise.
(TypeCheckBase::cast_site): Likewise.
* typecheck/rust-hir-type-check-base.h: Likewise.
* typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit): Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelImplItem::visit): Likewise.
(TypeCheckImplItem::visit): Likewise.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Likewise.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): Likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve): Likewise.
* typecheck/rust-hir-type-check-toplevel.cc (TypeCheckTopLevel::visit): Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): Likewise.
* typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): Likewise.
* typecheck/rust-tyctx.cc (TypeCheckContext::peek_return_type): Likewise.
* typecheck/rust-tyty-call.cc (TypeCheckMethodCallExpr::visit): Likewise.
* typecheck/rust-tyty-cmp.h: Likewise.
* typecheck/rust-tyty-rules.h: Likewise.
* typecheck/rust-tyty.cc (BaseType::mappings_str): Likewise.
(BaseType::debug): Print type name more clearly.
(BaseType::debug_str): Add new function to print type pointer and name.
(TupleType::get_name): Improve type name fetching function.
(ReferenceType::get_name): Likewise.
(PointerType::get_name): Likewise.
* typecheck/rust-tyty.h: Refactor definitions outside of the header.
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::TypeCheckBase):
Remove constructor.
(TypeCheckBase::coercion_site): Add `Location` argument to function.
* typecheck/rust-hir-type-check-base.h: Use `TypeCheckBase::coercion_site`
function with location argument.
* typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit): Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
* typecheck/rust-hir-type-check-expr.h (class TypeCheckExpr): Likewise.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::visit): Likewise.
* typecheck/rust-hir-type-check-toplevel.cc (TypeCheckTopLevel::visit): Likewise.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise.
(TypeCheckMethodCallExpr::visit): Likewise.
* typecheck/rust-tyty.h: Add missing locus field.
* typecheck/rust-tyty.cc (StructFieldType::clone): Use locus field.
(StructFieldType::monomorphized_clone): Likewise.
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-tyctx.cc (TypeCheckContext::pop_return_type): Add
guards around `std::vector<T>.pop_back()`.
(TypeCheckContext::peek_context): Likewise for `std::vector<T>.back()`.
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
philberty <philip.herron@embecosm.com>
* ast/rust-ast.h: Improve assertions within ASTFragment API.
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast.h: Add assertions and accessors for fragment nodes.
* expand/rust-attribute-visitor.cc (AttrVisitor::visit): Fix expansion
context typo when visiting `InherentImpl` items.
(AttrVisitor::maybe_expand_expr): Use new Fragment accessor to fetch
properly typed node.
(AttrVisitor::maybe_expand_type): Likewise.
* expand/rust-macro-expand.cc (transcribe_type): Emit parse errors
when trying to parse a type.
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-dump.h: Add shorthand `AST::Dump::debug` function to
dump an AST node on `stderr`.
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
philberty <philip.herron@embecosm.com>
* expand/rust-macro-expand.cc (parse_many): Return early from parsing
loop if we encounter an error, and emit that error in the meantime.
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
* expand/rust-macro-expand.cc (MacroExpander::match_matcher): Handle
fragments differently based on whether or not we are currently trying
to match a matcher in a repetition context.
(MacroExpander::match_n_matches): Use new `in_repetition` argument
properly when calling `match_matcher`.
* expand/rust-macro-expand.h (MacroExpander::match_matcher): Allow
passing extra `in_repetition` bool argument
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
* parse/rust-parse-impl.h: Allow parsing full range expressions without
erroring out.
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/lints/rust-lint-scan-deadcode.h: Do not report public items
as dead code.
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-attributes.cc: Add `rustc_inherit_overflow_checks` to list
of builtin attributes.
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-compile-expr.cc (CompileExpr::visit): Insert overflow
checks logic.
(CompileExpr::array_copied_expr): Insert overflow checks logic.
* backend/rust-compile-item.cc (CompileItem::visit): Insert overflow
checks logic.
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Insert
overflow checks logic.
* rust-gcc.cc (Gcc_backend::arithmetic_or_logical_expression): Differentiate
existing function from `arithmetic_or_logical_expression_checked`.
This function does insert perform overflow checks.
(Gcc_backend::arithmetic_or_logical_expression_checked): New
function.
(is_overflowing_expr): New function. Check if an expression is an
overflowing one (ADD, SUB, MUL).
(fetch_overflow_builtins): New function.
* rust-backend.h: Declare `arithmetic_or_logical_expression_checked` in
abstract `Backend` class.
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
* backend/rust-builtins.h: Refactor builtin context class and add
overflow builtins.
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-gcc.cc (class Bvariable): Move class to `rust-gcc.h` header.
* rust-gcc.h: New file.
2023-01-31 Philip Herron <philip.herron@embecosm.com>
* hir/rust-ast-lower-expr.h: Lower double borrow expressions to two
`HIR::BorrowExpr`s.
* hir/tree/rust-hir-expr.h: Remove `is_double_borrow` field from
`HIR::BorrowExpr`.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Remove
call to `gcc_unreachable` on double borrow expressions.
2023-01-31 Faisal Abbas <90.abbasfaisal@gmail.com>
* backend/rust-tree.cc : Add new includes.
(scope_chain): New.
(maybe_add_global): New.
(init_modules): New (copied from cp)
(var_in_constexpr_fn): Likewise.
(member_vec_linear_search): Likewise.
(member_vec_binary_search): Likewise.
(is_overloaded_fn): Likewise.
(ovl_make): Likewise.
(lookup_add): Likewise.
(type_memfn_quals): Likewise.
(struct find_parameter_pack_data): Likewise.
(struct conv_type_hasher): Likewise.
(make_conv_op_name): Likewise.
(builtin_pack_fn_p): Likewise.
(builtin_pack_call_p): Likewise.
(has_extra_args_mechanism_p): Likewise.
(find_parameter_packs_r): Likewise.
(WALK_SUBTREE): Likewise.
(type_memfn_rqual): Likewise.
(maybe_add_lang_type_raw): Likewise.
(struct c_fileinfo): Likewise.
(get_fileinfo): Likewise.
(cxx_make_type): Likewise.
(build_min_array_type): Likewise.
(fields_linear_search): Likewise.
(nothrow_spec_p): Likewise.
(maybe_get_fns): Likewise.
(get_fns): Likewise.
(get_first_fn): Likewise.
(dependent_name): Likewise.
(called_fns_equal): Likewise.
(canonical_eh_spec): Likewise.
(rs_tree_code_length): Likewise.
(rs_tree_operand_length): Likewise.
(rs_tree_equal): Likewise.
(publicly_uniquely_derived_p): Likewise.
(comp_except_types): Likewise.
(comp_except_specs): Likewise.
(compparms): Likewise.
(set_array_type_canon): Likewise.
(struct cplus_array_info): Likewise.
(struct cplus_array_hasher): Likewise.
(cplus_array_hasher::hash): Likewise.
(cplus_array_hasher::equal): Likewise.
(is_byte_access_type): Likewise.
(build_cplus_array_type): Likewise.
(rs_build_qualified_type_real): Likewise.
(vector_targets_convertible_p): Likewise.
(comp_array_types): Likewise.
(same_type_ignoring_top_level_qualifiers_p): Likewise.
(comp_ptr_ttypes_const): Likewise.
(similar_type_p): Likewise.
(structural_comptypes): Likewise.
(comptypes): Likewise.
(next_initializable_field): Likewise.
(sufficient_parms_p): Likewise.
(default_ctor_p): Likewise.
(user_provided_p): Likewise.
(type_has_non_user_provided_default_constructor): Likewise.
(default_init_uninitialized_part): Likewise.
(extract_conversion_operator): Likewise.
(get_class_binding_direct): Likewise.
(lang_check_failed): Likewise.
(skip_artificial_parms_for): Likewise.
(in_class_defaulted_default_constructor): Likewise.
(is_instantiation_of_constexpr): Likewise.
(check_for_uninitialized_const_var): Likewise.
(cv_unqualified): Likewise.
(make_tree_vector): Likewise.
(release_tree_vector): Likewise.
(instantiation_dependent_expression_p): Likewise.
(cp_get_callee): Likewise.
(build_nop): Likewise.
(scalarish_type_p): Likewise.
(type_has_nontrivial_copy_init): Likewise.
(build_local_temp): Likewise.
(is_normal_capture_proxy): Likewise.
(reject_gcc_builtin): Likewise.
(is_bitfield_expr_with_lowered_type): Likewise.
(maybe_undo_parenthesized_ref): Likewise.
(fold_offsetof): Likewise.
(char_type_p): Likewise.
(resolve_nondeduced_context): Likewise.
(instantiate_non_dependent_or_null): Likewise.
(resolve_nondeduced_context_or_error): Likewise.
(really_overloaded_fn): Likewise.
(invalid_nonstatic_memfn_p): Likewise.
(strip_top_quals): Likewise.
(cxx_incomplete_type_inform): Likewise.
(cxx_incomplete_type_diagnostic): Likewise.
(decl_constant_var_p): Likewise.
(undeduced_auto_decl): Likewise.
(require_deduced_type): Likewise.
* backend/rust-tree.h (enum c_tree_index): Likewise.
(GTY): Likewise.
(enum cp_tree_index): Likewise.
(wchar_decl_node): Likewise.
(vtable_entry_type): Likewise.
(delta_type_node): Likewise.
(vtable_index_type): Likewise.
(class_type_node): Likewise.
(unknown_type_node): Likewise.
(init_list_type_node): Likewise.
(explicit_void_list_node): Likewise.
(vtbl_type_node): Likewise.
(vtbl_ptr_type_node): Likewise.
(std_node): Likewise.
(abi_node): Likewise.
(global_namespace): Likewise.
(const_type_info_type_node): Likewise.
(conv_op_marker): Likewise.
(abort_fndecl): Likewise.
(current_aggr): Likewise.
(nullptr_node): Likewise.
(nullptr_type_node): Likewise.
(align_type_node): Likewise.
(char8_type_node): Likewise.
(char16_type_node): Likewise.
(char32_type_node): Likewise.
(wchar_type_node): Likewise.
(underlying_wchar_type_node): Likewise.
(wint_type_node): Likewise.
(signed_size_type_node): Likewise.
(unsigned_ptrdiff_type_node): Likewise.
(intmax_type_node): Likewise.
(uintmax_type_node): Likewise.
(widest_integer_literal_type_node): Likewise.
(widest_unsigned_literal_type_node): Likewise.
(sig_atomic_type_node): Likewise.
(int8_type_node): Likewise.
(int16_type_node): Likewise.
(int32_type_node): Likewise.
(int64_type_node): Likewise.
(uint8_type_node): Likewise.
(c_uint16_type_node): Likewise.
(c_uint32_type_node): Likewise.
(c_uint64_type_node): Likewise.
(int_least8_type_node): Likewise.
(int_least16_type_node): Likewise.
(int_least32_type_node): Likewise.
(int_least64_type_node): Likewise.
(uint_least8_type_node): Likewise.
(uint_least16_type_node): Likewise.
(uint_least32_type_node): Likewise.
(uint_least64_type_node): Likewise.
(int_fast8_type_node): Likewise.
(int_fast16_type_node): Likewise.
(int_fast32_type_node): Likewise.
(int_fast64_type_node): Likewise.
(uint_fast8_type_node): Likewise.
(uint_fast16_type_node): Likewise.
(uint_fast32_type_node): Likewise.
(uint_fast64_type_node): Likewise.
(intptr_type_node): Likewise.
(uintptr_type_node): Likewise.
(truthvalue_type_node): Likewise.
(truthvalue_true_node): Likewise.
(truthvalue_false_node): Likewise.
(char_array_type_node): Likewise.
(char8_array_type_node): Likewise.
(char16_array_type_node): Likewise.
(char32_array_type_node): Likewise.
(wchar_array_type_node): Likewise.
(string_type_node): Likewise.
(const_string_type_node): Likewise.
(default_function_type): Likewise.
(function_name_decl_node): Likewise.
(pretty_function_name_decl_node): Likewise.
(c99_function_name_decl_node): Likewise.
(saved_function_name_decls): Likewise.
(null_node): Likewise.
(ctor_identifier): Likewise.
(complete_ctor_identifier): Likewise.
(base_ctor_identifier): Likewise.
(dtor_identifier): Likewise.
(complete_dtor_identifier): Likewise.
(base_dtor_identifier): Likewise.
(deleting_dtor_identifier): Likewise.
(conv_op_identifier): Likewise.
(delta_identifier): Likewise.
(in_charge_identifier): Likewise.
(vtt_parm_identifier): Likewise.
(as_base_identifier): Likewise.
(this_identifier): Likewise.
(pfn_identifier): Likewise.
(vptr_identifier): Likewise.
(global_identifier): Likewise.
(anon_identifier): Likewise.
(auto_identifier): Likewise.
(decltype_auto_identifier): Likewise.
(init_list_identifier): Likewise.
(for_range__identifier): Likewise.
(for_begin__identifier): Likewise.
(for_end__identifier): Likewise.
(for_range_identifier): Likewise.
(for_begin_identifier): Likewise.
(for_end_identifier): Likewise.
(abi_tag_identifier): Likewise.
(aligned_identifier): Likewise.
(begin_identifier): Likewise.
(end_identifier): Likewise.
(get__identifier): Likewise.
(gnu_identifier): Likewise.
(tuple_element_identifier): Likewise.
(tuple_size_identifier): Likewise.
(type_identifier): Likewise.
(value_identifier): Likewise.
(fun_identifier): Likewise.
(closure_identifier): Likewise.
(heap_uninit_identifier): Likewise.
(heap_identifier): Likewise.
(heap_deleted_identifier): Likewise.
(heap_vec_uninit_identifier): Likewise.
(heap_vec_identifier): Likewise.
(omp_identifier): Likewise.
(lang_name_c): Likewise.
(lang_name_cplusplus): Likewise.
(empty_except_spec): Likewise.
(noexcept_true_spec): Likewise.
(noexcept_false_spec): Likewise.
(noexcept_deferred_spec): Likewise.
(terminate_fn): Likewise.
(call_unexpected_fn): Likewise.
(get_exception_ptr_fn): Likewise.
(begin_catch_fn): Likewise.
(end_catch_fn): Likewise.
(allocate_exception_fn): Likewise.
(free_exception_fn): Likewise.
(throw_fn): Likewise.
(rethrow_fn): Likewise.
(atexit_fn_ptr_type_node): Likewise.
(atexit_node): Likewise.
(dso_handle_node): Likewise.
(dynamic_cast_node): Likewise.
(cleanup_type): Likewise.
(vtt_parm_type): Likewise.
(any_targ_node): Likewise.
(source_location_impl): Likewise.
(OVL_FUNCTION): Likewise.
(OVL_CHAIN): Likewise.
(OVL_DEDUP_P): Likewise.
(OVL_USING_P): Likewise.
(OVL_HIDDEN_P): Likewise.
(OVL_NESTED_P): Likewise.
(OVL_LOOKUP_P): Likewise.
(OVL_EXPORT_P): Likewise.
(OVL_FIRST): Likewise.
(OVL_NAME): Likewise.
(OVL_P): Likewise.
(OVL_SINGLE_P): Likewise.
(TYPE_HAS_DEFAULT_CONSTRUCTOR): Likewise.
(CLASSTYPE_LAZY_DEFAULT_CTOR): Likewise.
(CLASSTYPE_CONSTRUCTORS): Likewise.
(ATTR_IS_DEPENDENT): Likewise.
(ABI_TAG_IMPLICIT): Likewise.
(PARENTHESIZED_LIST_P): Likewise.
(DECL_DEPENDENT_P): Likewise.
(USING_DECL_SCOPE): Likewise.
(USING_DECL_DECLS): Likewise.
(USING_DECL_TYPENAME_P): Likewise.
(USING_DECL_UNRELATED_P): Likewise.
(DECL_DECLARES_FUNCTION_P): Likewise.
(DECL_DECLARES_TYPE_P): Likewise.
(IDENTIFIER_KIND_BIT_0): Likewise.
(IDENTIFIER_KIND_BIT_1): Likewise.
(IDENTIFIER_KIND_BIT_2): Likewise.
(IDENTIFIER_MARKED): Likewise.
(IDENTIFIER_VIRTUAL_P): Likewise.
(IDENTIFIER_KEYWORD_P): Likewise.
(IDENTIFIER_CDTOR_P): Likewise.
(IDENTIFIER_CTOR_P): Likewise.
(IDENTIFIER_DTOR_P): Likewise.
(IDENTIFIER_ANY_OP_P): Likewise.
(IDENTIFIER_OVL_OP_P): Likewise.
(IDENTIFIER_ASSIGN_OP_P): Likewise.
(IDENTIFIER_CONV_OP_P): Likewise.
(IDENTIFIER_NEWDEL_OP_P): Likewise.
(IDENTIFIER_NEW_OP_P): Likewise.
(CLASSTYPE_DIAMOND_SHAPED_P): Likewise.
(CLASSTYPE_REPEATED_BASE_P): Likewise.
(CLASSTYPE_KEY_METHOD): Likewise.
(CLASSTYPE_MEMBER_VEC): Likewise.
(CLASSTYPE_DECL_LIST): Likewise.
(CLASSTYPE_DESTRUCTOR): Likewise.
(CLASSTYPE_HAS_PRIMARY_BASE_P): Likewise.
(CLASSTYPE_PRIMARY_BINFO): Likewise.
(CLASSTYPE_VBASECLASSES): Likewise.
(CLASSTYPE_AS_BASE): Likewise.
(DECL_CONV_FN_P): Likewise.
(DECL_CONV_FN_TYPE): Likewise.
(same_type_p): Likewise.
(WILDCARD_TYPE_P): Likewise.
(MAYBE_CLASS_TYPE_P): Likewise.
(FUNCTION_REF_QUALIFIED): Likewise.
(FUNCTION_RVALUE_QUALIFIED): Likewise.
(TYPE_PTRMEMFUNC_FN_TYPE): Likewise.
(TYPE_PTRMEMFUNC_FN_TYPE_RAW): Likewise.
(TYPE_DEPENDENT_P): Likewise.
(TYPE_DEPENDENT_P_VALID): Likewise.
(TYPE_HAS_NONTRIVIAL_DESTRUCTOR): Likewise.
(TYPE_RAISES_EXCEPTIONS): Likewise.
(IDENTIFIER_BINDING): Likewise.
(LANG_IDENTIFIER_CAST): Likewise.
(IF_COND): Likewise.
(THEN_CLAUSE): Likewise.
(ELSE_CLAUSE): Likewise.
(IF_SCOPE): Likewise.
(IF_STMT_CONSTEXPR_P): Likewise.
(IF_STMT_CONSTEVAL_P): Likewise.
(DECLTYPE_TYPE_EXPR): Likewise.
(SET_CLASSTYPE_INTERFACE_UNKNOWN_X): Likewise.
(CLASSTYPE_INTERFACE_ONLY): Likewise.
(TYPE_NAME_STRING): Likewise.
(TYPE_NAME_LENGTH): Likewise.
(CONSTRAINT_VAR_P): Likewise.
(KOENIG_LOOKUP_P): Likewise.
(DECL_PARM_INDEX): Likewise.
(DECL_PARM_LEVEL): Likewise.
(CONV_IMPLICIT): Likewise.
(CONV_STATIC): Likewise.
(CONV_CONST): Likewise.
(CONV_REINTERPRET): Likewise.
(CONV_PRIVATE): Likewise.
(CONV_FORCE_TEMP): Likewise.
(CONV_FOLD): Likewise.
(CONV_OLD_CONVERT): Likewise.
(CONV_C_CAST): Likewise.
(CONV_BACKEND_CONVERT): Likewise.
(WANT_INT): Likewise.
(WANT_FLOAT): Likewise.
(WANT_ENUM): Likewise.
(WANT_POINTER): Likewise.
(WANT_NULL): Likewise.
(WANT_VECTOR_OR_COMPLEX): Likewise.
(WANT_ARITH): Likewise.
(COMPARE_STRICT): Likewise.
(COMPARE_BASE): Likewise.
(COMPARE_DERIVED): Likewise.
(COMPARE_REDECLARATION): Likewise.
(COMPARE_STRUCTURAL): Likewise.
(SF_DEFAULT): Likewise.
(SF_PRE_PARSED): Likewise.
(SF_INCLASS_INLINE): Likewise.
(SD_UNINITIALIZED): Likewise.
(SD_INITIALIZED): Likewise.
(SD_DECOMPOSITION): Likewise.
(SD_DEFAULTED): Likewise.
(SD_DELETED): Likewise.
(TYPE_PTRDATAMEM_P): Likewise.
(RS_TYPE_CONST_P): Likewise.
(TYPE_MAIN_DECL): Likewise.
(DECL_NONTRIVIALLY_INITIALIZED_P): Likewise.
(DECL_DEFAULTED_FN): Likewise.
(TYPE_HAS_USER_CONSTRUCTOR): Likewise.
(DECL_INITIALIZED_IN_CLASS_P): Likewise.
(DECL_DEFAULTED_IN_CLASS_P): Likewise.
(DECL_NONSTATIC_MEMBER_FUNCTION_P): Likewise.
(DECL_HAS_IN_CHARGE_PARM_P): Likewise.
(DECL_HAS_VTT_PARM_P): Likewise.
(FUNCTION_FIRST_USER_PARMTYPE): Likewise.
(FUNCTION_FIRST_USER_PARM): Likewise.
(DECL_CONSTRUCTOR_P): Likewise.
(DECL_DELETED_FN): Likewise.
(BRACE_ENCLOSED_INITIALIZER_P): Likewise.
(DECL_IMMEDIATE_FUNCTION_P): Likewise.
(SET_DECL_IMMEDIATE_FUNCTION_P): Likewise.
(CONSTRUCTOR_MUTABLE_POISON): Likewise.
(PTRMEM_CST_MEMBER): Likewise.
(REF_PARENTHESIZED_P): Likewise.
(TYPE_PTRMEM_P): Likewise.
(TYPE_PTR_OR_PTRMEM_P): Likewise.
(DECL_DECOMPOSITION_P): Likewise.
(DECL_DECOMP_BASE): Likewise.
(DECL_MAYBE_IN_CHARGE_CDTOR_P): Likewise.
(DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P): Likewise.
(DECL_CLONED_FUNCTION_P): Likewise.
(DECL_CLONED_FUNCTION): Likewise.
(DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P): Likewise.
(cp_function_chain): Likewise.
(cdtor_label): Likewise.
(current_class_ptr): Likewise.
(current_class_ref): Likewise.
(current_eh_spec_block): Likewise.
(current_in_charge_parm): Likewise.
(current_vtt_parm): Likewise.
(current_retval_sentinel): Likewise.
(current_function_returns_value): Likewise.
(current_function_returns_null): Likewise.
(current_function_returns_abnormally): Likewise.
(current_function_infinite_loop): Likewise.
(in_base_initializer): Likewise.
(in_function_try_handler): Likewise.
(current_function_return_value): Likewise.
(current_class_type): Likewise.
(TYPE_BEING_DEFINED): Likewise.
(DECL_STATIC_FUNCTION_P): Likewise.
(DECL_FUNCTION_MEMBER_P): Likewise.
(LANG_DECL_MIN_CHECK): Likewise.
(LANG_DECL_FN_CHECK): Likewise.
(LANG_DECL_NS_CHECK): Likewise.
(LANG_DECL_PARM_CHECK): Likewise.
(LANG_DECL_DECOMP_CHECK): Likewise.
(RS_INTEGRAL_TYPE_P): Likewise.
(STAT_HACK_P): Likewise.
(STAT_TYPE_VISIBLE_P): Likewise.
(STAT_TYPE): Likewise.
(STAT_DECL): Likewise.
(STAT_VISIBLE): Likewise.
(MAYBE_STAT_DECL): Likewise.
(MAYBE_STAT_TYPE): Likewise.
(STAT_TYPE_HIDDEN_P): Likewise.
(STAT_DECL_HIDDEN_P): Likewise.
(class warning_sentinel): Likewise.
(struct uid_sensitive_constexpr_evaluation_checker): Likewise.
(class iloc_sentinel): Likewise.
(struct GTY): Likewise.
(struct named_decl_hash): Likewise.
(enum lang_decl_selector): Likewise.
(LANG_DECL_HAS_MIN): Likewise.
(struct named_label_entry): Likewise.
(struct named_label_hash): Likewise.
(enum ref_operator): Likewise.
(struct c_fileinfo): Likewise.
(class ovl_iterator): Likewise.
(class lkp_iterator): Likewise.
(enum rs_ref_qualifier): Likewise.
(enum tsubst_flags): Likewise.
(enum cp_identifier_kind): Likewise.
(enum tag_types): Likewise.
(enum compare_bounds_t): Likewise.
(mark_rvalue_use): Likewise.
(type_unknown_p): Likewise.
(init_modules): Likewise.
(var_in_constexpr_fn): Likewise.
(ovl_first): Likewise.
(lookup_add): Likewise.
(ovl_make): Likewise.
(is_overloaded_fn): Likewise.
(maybe_add_lang_type_raw): Likewise.
(type_memfn_rqual): Likewise.
(builtin_pack_fn_p): Likewise.
(make_conv_op_name): Likewise.
(type_memfn_quals): Likewise.
(get_fileinfo): Likewise.
(cxx_make_type): Likewise.
(build_cplus_array_type): Likewise.
(is_byte_access_type): Likewise.
(comptypes): Likewise.
(canonical_eh_spec): Likewise.
(cp_tree_operand_length): Likewise.
(rs_tree_equal): Likewise.
(compparms): Likewise.
(rs_build_qualified_type_real): Likewise.
(rs_build_qualified_type): Likewise.
(cv_qualified_p): Likewise.
(similar_type_p): Likewise.
(vector_targets_convertible_p): Likewise.
(same_type_ignoring_top_level_qualifiers_p): Likewise.
(comp_ptr_ttypes_const): Likewise.
(get_class_binding_direct): Likewise.
(skip_artificial_parms_for): Likewise.
(lang_check_failed): Likewise.
(default_init_uninitialized_part): Likewise.
(type_has_non_user_provided_default_constructor): Likewise.
(default_ctor_p): Likewise.
(user_provided_p): Likewise.
(sufficient_parms_p): Likewise.
(next_initializable_field): Likewise.
(in_class_defaulted_default_constructor): Likewise.
(is_instantiation_of_constexpr): Likewise.
(check_for_uninitialized_const_var): Likewise.
(reduced_constant_expression_p): Likewise.
(cv_unqualified): Likewise.
(cp_get_callee): Likewise.
(cp_get_callee_fndecl_nofold): Likewise.
(is_nondependent_static_init_expression): Likewise.
(maybe_constant_init): Likewise.
(build_nop): Likewise.
(scalarish_type_p): Likewise.
(is_bitfield_expr_with_lowered_type): Likewise.
(convert_bitfield_to_declared_type): Likewise.
(cp_fold_maybe_rvalue): Likewise.
(maybe_undo_parenthesized_ref): Likewise.
(fold_offsetof): Likewise.
(cp_truthvalue_conversion): Likewise.
(fold_non_dependent_expr): Likewise.
(char_type_p): Likewise.
(instantiation_dependent_expression_p): Likewise.
(type_has_nontrivial_copy_init): Likewise.
(build_local_temp): Likewise.
(is_normal_capture_proxy): Likewise.
(reject_gcc_builtin): Likewise.
(resolve_nondeduced_context): Likewise.
(cxx_incomplete_type_diagnostic): Likewise.
(cxx_incomplete_type_error): Likewise.
(invalid_nonstatic_memfn_p): Likewise.
(really_overloaded_fn): Likewise.
(resolve_nondeduced_context_or_error): Likewise.
(instantiate_non_dependent_or_null): Likewise.
(cxx_incomplete_type_inform): Likewise.
(strip_top_quals): Likewise.
(undeduced_auto_decl): Likewise.
(require_deduced_type): Likewise.
(decl_constant_var_p): Likewise.
(type_of_this_parm): Likewise.
(class_of_this_parm): Likewise.
(identifier_p): Likewise.
(gnu_vector_type_p): Likewise.
(make_tree_vector): Likewise.
(release_tree_vector): Likewise.
(class releasing_vec): Likewise.
(vec_safe_push): Likewise.
(null_node_p): Likewise.
* backend/rust-compile-base.cc (HIRCompileBase::setup_fndecl): Correctly
set fndecl as constexpr from qualifiers.
(HIRCompileBase::compile_function): Test if fndecl is constexpr.
(HIRCompileBase::compile_constant_item): Set fndecl as constexpr.
* backend/rust-compile-intrinsic.cc : Update include.
(finalize_intrinsic_block): Set fndecl as constexpr.
* backend/rust-constexpr.cc : Update include.
(VERIFY_CONSTANT): New.
(is_instantiation_of_constexpr): New.
(literal_type_p): New.
(verify_constant): New.
(find_array_ctor_elt): New.
(array_index_cmp): New.
(potential_constant_expression_1): New.
(get_nth_callarg): New.
(unshare_constructor): New.
(maybe_save_constexpr_fundef): New.
(returns): New.
(breaks): New.
(continues): New.
(switches): New.
(struct constexpr_global_ctx): Add new fields.
(constexpr_fundef): New.
(struct constexpr_call): New.
(constexpr_call_hasher : ggc_ptr_hash<constexpr_call>): New.
(enum constexpr_switch_state): New.
(struct constexpr_ctx): Add new fields.
(struct constexpr_fundef_hasher): New.
(constexpr_fundef_table): New.
(constexpr_fundef_hasher::equal): New.
(constexpr_fundef_hasher::hash): New.
(retrieve_constexpr_fundef): New.
(uid_sensitive_constexpr_evaluation_value): New.
(uid_sensitive_constexpr_evaluation_true_counter): New.
(uid_sensitive_constexpr_evaluation_p): New.
(class temp_override): New.
(struct uid_sensitive_constexpr_evaluation_sentinel): New.
(struct uid_sensitive_constexpr_evaluation_checker): New.
(::uid_sensitive_constexpr_evaluation_sentinel): New.
(::uid_sensitive_constexpr_evaluation_checker): New.
(uid_sensitive_constexpr_evaluation_checker::evaluation_restricted_p): New.
(constexpr_call_table): New.
(constexpr_call_hasher::hash): New.
(constexpr_call_hasher::equal): New.
(maybe_initialize_constexpr_call_table): New.
(fundef_copies_table): New.
(get_fundef_copy): New.
(save_fundef_copy): New.
(constexpr_expression): Refactor in ...
(eval_constant_expression): ...this.
(eval_store_expression): Add 3 bool params.
(eval_call_expression): Likewise.
(eval_binary_expression): Likewise.
(eval_statement_list): New.
(extract_string_elt): New.
(eval_conditional_expression): New.
(eval_bit_field_ref): New.
(eval_loop_expr): New.
(eval_switch_expr): New.
(eval_unary_expression): New.
(call_stack): New.
(call_stack_tick): New.
(last_cx_error_tick): New.
(push_cx_call_context): New.
(pop_cx_call_context): New.
(cx_error_context): New.
(fold_expr): Adjust call to eval_constant_expression.
(same_type_ignoring_tlq_and_bounds_p): New.
(union_active_member): Port more for cxx constexpr.
(fold_indirect_ref_1): New.
(rs_fold_indirect_ref): Likewise.
(rs_eval_indirect_ref): New (from corresponding cxx FE file).
(eval_logical_expression): Adjust parameter list.
(lookup_placeholder): New (from corresponding cxx FE file).
(constant_value_1): Remove.
(inline_asm_in_constexpr_error): New (from corresponding cxx FE file).
(verify_ctor_sanity): New.
(get_callee): Remove.
(initialized_type): New.
(maybe_constexpr_fn): Remove.
(init_subob_ctx): New.
(base_field_constructor_elt): New.
(get_or_insert_ctor_field): New.
(eval_vector_conditional_expression): New (from correponding cxx FE file).
(eval_bare_aggregate): New.
(cxx_eval_trinary_expression): New.
(reduced_constant_expression_p): New.
(adjust_temp_type): New.
(free_constructor): New.
(eval_and_check_array_index): New.
(eval_array_reference): New.
(eval_component_reference): New.
(label_matches): New.
(eval_constant_expression): New.
(modifying_const_object_error): New.
(is_empty_field): New.
(eval_store_expression): New.
(eval_binary_expression): New.
(addr_of_non_const_var): New.
(rs_bind_parameters_in_call): New.
(eval_builtin_function_call): New.
(eval_call_expression): New.
(build_anon_member_initialization): New.
(build_data_member_initialization): New.
(constexpr_fn_retval): New.
(constant_value_1): New.
(decl_constant_value): New.
(non_const_var_error): New.
(get_callee): New.
(get_function_named_in_call): New.
(maybe_constexpr_fn): New.
(get_nth_callarg): New.
(var_in_maybe_constexpr_fn): New.
(instantiate_cx_fn_r): New.
(instantiate_constexpr_fns): New.
(array_index_cmp): New.
(unshare_constructor): New.
(find_array_ctor_elt): New.
(verify_constant): New.
(find_heap_var_refs): New.
(find_immediate_fndecl): New.
(diag_array_subscript): New.
(get_array_or_vector_nelts): New.
(eval_and_check_array_index): New.
(extract_string_elt): New.
(is_valid_constexpr_fn): New.
(explain_invalid_constexpr_fn): New.
(register_constexpr_fundef): New.
(maybe_save_constexpr_fundef): New.
(eval_statement_list): New.
(eval_conditional_expression): New.
(eval_bit_field_ref): New.
(returns): New.
(breaks): New.
(continues): New.
(switches): New.
(eval_loop_expr): New.
(eval_switch_expr): New.
(eval_unary_expression): New.
(cxx_eval_outermost_constant_expr): New.
(is_static_init_expression): New.
(is_constant_expression): New.
(is_nondependent_static_init_expression): New.
(maybe_constant_init_1): New.
(maybe_constant_init): New.
(is_nondependent_constant_expression): New.
(cv_cache): New.
(maybe_constant_value): New.
(potential_constant_expression): New.
(struct check_for_return_continue_data): New.
(check_for_return_continue): New.
(decl_namespace_context): New.
(decl_in_std_namespace_p): New.
(is_std_construct_at): New.
(cxx_dynamic_cast_fn_p): New.
(is_std_allocator_allocate): New.
(is_std_allocator_allocate): New.
(potential_constant_expression_1): New.
(potential_constant_expression_1): New.
(fold_non_dependent_init): New.
* backend/rust-constexpr.h (maybe_save_constexpr_fundef): New.
2023-01-31 Arthur Cohen <arthur.cohen@embecosm.com>
* rust-session-manager.cc (Session::compile_crate): Allow the dump of prettified AST
(Session::dump_ast_pretty): New
* rust-session-manager.h: Add new output file for pretty AST dump
2023-01-05 David Malcolm <dmalcolm@redhat.com>
* resolve/rust-ast-resolve-item.cc (selftest::rust_flatten_list):
Remove output to stderr.
2023-01-05 David Malcolm <dmalcolm@redhat.com>
* Make-lang.in (selftest-rust-gdb): New.
(selftest-rust-valgrind): New.
2022-12-20 Marc Poulhiès <dkm@kataplop.net>
PR rust/108113
* Make-lang.in (rust.serial): New variable.
(rust1$(exeext)): Depend on $(rust.prev). Call LINK_PROGRESS.
2022-12-14 Jakub Jelinek <jakub@redhat.com>
PR rust/106072
* parse/rust-parse-impl.h (parse_closure_param): Store
pattern->get_locus () in a temporary before std::move (pattern) is
invoked.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* CONTRIBUTING.md: New.
* README.md: New.
* logo.png: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* config-lang.in: New.
2022-12-13 Arthur Cohen <arthur.cohen@embecosm.com>
* lang.opt (-frust-incomplete-and-experimental-compiler-do-not-use):
New.
* rust-session-manager.cc (Session::compile_crate): Check it.
* Make-lang.in (RUST_SELFTEST_FLAGS): Add it.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* Make-lang.in: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* lang.opt: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* lang-specs.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* rust-lang.cc: New.
* rust-session-manager.cc: New.
* rust-session-manager.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* rustspec.cc: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* rust-diagnostics.cc: New.
* rust-diagnostics.h: New.
* rust-gcc-diagnostics.cc: New.
* rust-linemap.cc: New.
* rust-linemap.h: New.
* rust-location.h: New.
* rust-system.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
David Faust <david.faust@oracle.com>
Faisal Abbas <90.abbasfaisal@gmail.com>
* backend/rust-compile-context.cc: New.
* backend/rust-compile-context.h: New.
* backend/rust-compile.cc: New.
* backend/rust-compile.h: New.
* backend/rust-constexpr.cc: New.
* backend/rust-constexpr.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
David Faust <david.faust@oracle.com>
* backend/rust-compile-block.cc: New.
* backend/rust-compile-block.h: New.
* backend/rust-compile-expr.cc: New.
* backend/rust-compile-expr.h: New.
* backend/rust-compile-extern.h: New.
* backend/rust-compile-fnparam.cc: New.
* backend/rust-compile-fnparam.h: New.
* backend/rust-compile-implitem.cc: New.
* backend/rust-compile-implitem.h: New.
* backend/rust-compile-intrinsic.cc: New.
* backend/rust-compile-intrinsic.h: New.
* backend/rust-compile-item.cc: New.
* backend/rust-compile-item.h: New.
* backend/rust-compile-pattern.cc: New.
* backend/rust-compile-pattern.h: New.
* backend/rust-compile-resolve-path.cc: New.
* backend/rust-compile-resolve-path.h: New.
* backend/rust-compile-stmt.cc: New.
* backend/rust-compile-stmt.h: New.
* backend/rust-compile-struct-field-expr.cc: New.
* backend/rust-compile-struct-field-expr.h: New.
* backend/rust-compile-type.cc: New.
* backend/rust-compile-type.h: New.
* backend/rust-compile-var-decl.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
David Faust <david.faust@oracle.com>
* backend/rust-builtins.h: New.
* backend/rust-compile-base.cc: New.
* backend/rust-compile-base.h: New.
* backend/rust-mangle.cc: New.
* backend/rust-mangle.h: New.
* backend/rust-tree.cc: New.
* backend/rust-tree.h: New.
* rust-backend.h: New.
* rust-gcc.cc: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* metadata/rust-export-metadata.cc: New.
* metadata/rust-export-metadata.h: New.
* metadata/rust-extern-crate.cc: New.
* metadata/rust-extern-crate.h: New.
* metadata/rust-import-archive.cc: New.
* metadata/rust-imports.cc: New.
* metadata/rust-imports.h: New.
* rust-object-export.cc: New.
* rust-object-export.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* checks/lints/rust-lint-unused-var.cc: New.
* checks/lints/rust-lint-unused-var.h: New.
2022-12-13 Thomas Young <wenzhang5800@gmail.com>
* checks/lints/rust-lint-marklive-base.h: New.
* checks/lints/rust-lint-marklive.cc: New.
* checks/lints/rust-lint-marklive.h: New.
* checks/lints/rust-lint-scan-deadcode.h: New.
2022-12-13 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/errors/privacy/rust-privacy-check.cc: New.
* checks/errors/privacy/rust-privacy-check.h: New.
* checks/errors/privacy/rust-privacy-common.h: New.
* checks/errors/privacy/rust-privacy-ctx.cc: New.
* checks/errors/privacy/rust-privacy-ctx.h: New.
* checks/errors/privacy/rust-privacy-reporter.cc: New.
* checks/errors/privacy/rust-privacy-reporter.h: New.
* checks/errors/privacy/rust-pub-restricted-visitor.cc: New.
* checks/errors/privacy/rust-pub-restricted-visitor.h: New.
* checks/errors/privacy/rust-reachability.cc: New.
* checks/errors/privacy/rust-reachability.h: New.
* checks/errors/privacy/rust-visibility-resolver.cc: New.
* checks/errors/privacy/rust-visibility-resolver.h: New.
2022-12-13 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/errors/rust-const-checker.cc: New.
* checks/errors/rust-const-checker.h: New.
2022-12-13 Arthur Cohen <arthur.cohen@embecosm.com>
* checks/errors/rust-unsafe-checker.cc: New.
* checks/errors/rust-unsafe-checker.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-autoderef.cc: New.
* typecheck/rust-autoderef.h: New.
* typecheck/rust-casts.cc: New.
* typecheck/rust-casts.h: New.
* typecheck/rust-coercion.cc: New.
* typecheck/rust-coercion.h: New.
* typecheck/rust-hir-dot-operator.cc: New.
* typecheck/rust-hir-dot-operator.h: New.
* typecheck/rust-hir-inherent-impl-overlap.h: New.
* typecheck/rust-hir-path-probe.h: New.
* typecheck/rust-hir-trait-ref.h: New.
* typecheck/rust-hir-type-bounds.h: New.
* typecheck/rust-substitution-mapper.cc: New.
* typecheck/rust-substitution-mapper.h: New.
* typecheck/rust-tycheck-dump.h: New.
* typecheck/rust-tyctx.cc: New.
* typecheck/rust-tyty-bounds.cc: New.
* typecheck/rust-tyty-call.cc: New.
* typecheck/rust-tyty-call.h: New.
* typecheck/rust-tyty-cmp.h: New.
* typecheck/rust-tyty-rules.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-tyty.cc: New.
* typecheck/rust-tyty.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* typecheck/rust-hir-trait-resolve.cc: New.
* typecheck/rust-hir-trait-resolve.h: New.
* typecheck/rust-hir-type-check-base.cc: New.
* typecheck/rust-hir-type-check-base.h: New.
* typecheck/rust-hir-type-check-enumitem.cc: New.
* typecheck/rust-hir-type-check-enumitem.h: New.
* typecheck/rust-hir-type-check-expr.cc: New.
* typecheck/rust-hir-type-check-expr.h: New.
* typecheck/rust-hir-type-check-implitem.cc: New.
* typecheck/rust-hir-type-check-implitem.h: New.
* typecheck/rust-hir-type-check-item.cc: New.
* typecheck/rust-hir-type-check-item.h: New.
* typecheck/rust-hir-type-check-path.cc: New.
* typecheck/rust-hir-type-check-pattern.cc: New.
* typecheck/rust-hir-type-check-pattern.h: New.
* typecheck/rust-hir-type-check-stmt.cc: New.
* typecheck/rust-hir-type-check-stmt.h: New.
* typecheck/rust-hir-type-check-struct-field.h: New.
* typecheck/rust-hir-type-check-struct.cc: New.
* typecheck/rust-hir-type-check-toplevel.cc: New.
* typecheck/rust-hir-type-check-toplevel.h: New.
* typecheck/rust-hir-type-check-type.cc: New.
* typecheck/rust-hir-type-check-type.h: New.
* typecheck/rust-hir-type-check-util.cc: New.
* typecheck/rust-hir-type-check-util.h: New.
* typecheck/rust-hir-type-check.cc: New.
* typecheck/rust-hir-type-check.h: New.
* typecheck/rust-tyty-visitor.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* util/rust-canonical-path.h: New.
* util/rust-common.h: New.
* util/rust-hir-map.cc: New.
* util/rust-hir-map.h: New.
* util/rust-identifier.h: New.
* util/rust-lang-item.h: New.
* util/rust-mapping-common.h: New.
* util/rust-stacked-contexts.h: New.
2022-12-13 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-attributes.cc: New.
* util/rust-attributes.h: New.
2022-12-13 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-optional-test.cc: New.
* util/rust-optional.h: New.
2022-12-13 Arthur Cohen <arthur.cohen@embecosm.com>
* util/rust-base62.cc: New.
* util/rust-base62.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* util/rust-abi.cc: New.
* util/rust-abi.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* util/fnv-hash.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* util/rust-make-unique.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* hir/rust-ast-lower-base.cc: New.
* hir/rust-ast-lower-base.h: New.
* hir/rust-ast-lower-block.h: New.
* hir/rust-ast-lower-enumitem.h: New.
* hir/rust-ast-lower-expr.h: New.
* hir/rust-ast-lower-extern.h: New.
* hir/rust-ast-lower-implitem.h: New.
* hir/rust-ast-lower-item.cc: New.
* hir/rust-ast-lower-item.h: New.
* hir/rust-ast-lower-pattern.cc: New.
* hir/rust-ast-lower-pattern.h: New.
* hir/rust-ast-lower-stmt.h: New.
* hir/rust-ast-lower-struct-field-expr.h: New.
* hir/rust-ast-lower-type.h: New.
* hir/rust-ast-lower.cc: New.
* hir/rust-ast-lower.h: New.
* hir/rust-hir-dump.cc: New.
* hir/rust-hir-dump.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* hir/tree/rust-hir-full-decls.h: New.
* hir/tree/rust-hir-full-test.cc: New.
* hir/tree/rust-hir-full.h: New.
* hir/tree/rust-hir-visitor.h: New.
* hir/tree/rust-hir.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* hir/tree/rust-hir-expr.h: New.
* hir/tree/rust-hir-item.h: New.
* hir/tree/rust-hir-path.h: New.
* hir/tree/rust-hir-pattern.h: New.
* hir/tree/rust-hir-stmt.h: New.
* hir/tree/rust-hir-type.h: New.
2022-12-13 Philip Herron <philip.herron@embecosm.com>
* resolve/rust-ast-resolve-base.cc: New.
* resolve/rust-ast-resolve-base.h: New.
* resolve/rust-ast-resolve-expr.cc: New.
* resolve/rust-ast-resolve-expr.h: New.
* resolve/rust-ast-resolve-implitem.h: New.
* resolve/rust-ast-resolve-item.cc: New.
* resolve/rust-ast-resolve-item.h: New.
* resolve/rust-ast-resolve-path.cc: New.
* resolve/rust-ast-resolve-path.h: New.
* resolve/rust-ast-resolve-pattern.cc: New.
* resolve/rust-ast-resolve-pattern.h: New.
* resolve/rust-ast-resolve-stmt.cc: New.
* resolve/rust-ast-resolve-stmt.h: New.
* resolve/rust-ast-resolve-struct-expr-field.cc: New.
* resolve/rust-ast-resolve-struct-expr-field.h: New.
* resolve/rust-ast-resolve-toplevel.h: New.
* resolve/rust-ast-resolve-type.cc: New.
* resolve/rust-ast-resolve-type.h: New.
* resolve/rust-ast-resolve.cc: New.
* resolve/rust-ast-resolve.h: New.
* resolve/rust-ast-verify-assignee.h: New.
* resolve/rust-name-resolver.cc: New.
* resolve/rust-name-resolver.h: New.
2022-12-13 Arthur Cohen <arthur.cohen@embecosm.com>
Philip Herron <philip.herron@embecosm.com>
Joel Phillips <simplytheother@gmail.com>
* expand/rust-attribute-visitor.cc: New.
* expand/rust-attribute-visitor.h: New.
* expand/rust-macro-builtins.cc: New.
* expand/rust-macro-builtins.h: New.
* expand/rust-macro-expand.cc: New.
* expand/rust-macro-expand.h: New.
* expand/rust-macro-invoc-lexer.cc: New.
* expand/rust-macro-invoc-lexer.h: New.
* expand/rust-macro-substitute-ctx.cc: New.
* expand/rust-macro-substitute-ctx.h: New.
2022-12-13 Joel Phillips <simplytheother@gmail.com>
Philip Herron <philip.herron@embecosm.com>
Arthur Cohen <arthur.cohen@embecosm.com>
* parse/rust-parse-impl.h: New, second half.
2022-12-13 Joel Phillips <simplytheother@gmail.com>
Philip Herron <philip.herron@embecosm.com>
Arthur Cohen <arthur.cohen@embecosm.com>
* parse/rust-cfg-parser.cc: New.
* parse/rust-cfg-parser.h: New.
* parse/rust-parse-impl.h: New.
* parse/rust-parse.cc: New.
* parse/rust-parse.h: New.
2022-12-13 Joel Phillips <simplytheother@gmail.com>
Philip Herron <philip.herron@embecosm.com>
Arthur Cohen <arthur.cohen@embecosm.com>
Mark Wielaard <mark@klomp.org>
* lex/rust-codepoint.h: New.
* lex/rust-lex.cc: New.
* lex/rust-lex.h: New.
* lex/rust-token.cc: New.
* lex/rust-token.h: New.
* rust-buffered-queue.h: New.
2022-12-13 Joel Phillips <simplytheother@gmail.com>
Philip Herron <philip.herron@embecosm.com>
Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-dump.cc: New.
* ast/rust-ast-dump.h: New.
* ast/rust-ast-visitor.h: New.
* ast/rust-cond-compilation.h: New.
2022-12-13 Joel Phillips <simplytheother@gmail.com>
Philip Herron <philip.herron@embecosm.com>
* ast/rust-expr.h: New.
* ast/rust-macro.h: New.
* ast/rust-path.h: New.
* ast/rust-pattern.h: New.
* ast/rust-stmt.h: New.
* ast/rust-type.h: New.
2022-12-13 Joel Phillips <simplytheother@gmail.com>
Philip Herron <philip.herron@embecosm.com>
* ast/rust-item.h: New.
2022-12-13 Joel Phillips <simplytheother@gmail.com>
Philip Herron <philip.herron@embecosm.com>
Arthur Cohen <arthur.cohen@embecosm.com>
* ast/rust-ast-full-decls.h: New.
* ast/rust-ast-full-test.cc: New.
* ast/rust-ast-full.h: New.
* ast/rust-ast.h: New.
* operator.h: New.
Copyright (C) 2022-2025 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.