aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-09-09Used `IndexVec` for LoansKushal Pal2-9/+9
gcc/rust/ChangeLog: * 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. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-09-09Used `IndexVec` for ScopesKushal Pal1-13/+12
gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-place.h: Used `IndexVec` with ScopeId as index. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-09-09Introduce `IndexVec`Kushal Pal1-0/+19
gcc/rust/ChangeLog: * 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. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-09-09Strong type BasicBlockIdKushal Pal6-43/+76
gcc/rust/ChangeLog: * 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. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-09-09Strong type ScopeIdKushal Pal4-23/+39
gcc/rust/ChangeLog: * 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. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-09-09Strong type LoanIdKushal Pal4-28/+42
gcc/rust/ChangeLog: * 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. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-09-09Use FreeRegions inplace of `std::vector<FreeRegion>`Kushal Pal8-57/+38
gcc/rust/ChangeLog: * 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. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-09-09Strong type FreeRegionKushal Pal7-37/+68
gcc/rust/ChangeLog: * 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. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-09-09Strong type PlaceIdKushal Pal3-71/+103
gcc/rust/ChangeLog: * 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. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2024-09-07Avoid accidental insertion into mapOwen Avery1-1/+2
gcc/rust/ChangeLog: * resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::check_bindings_consistency): Check if outer_bindings_map contains an entry before indexing. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-09-06Add virtual destructor to AbstractExprOwen Avery1-0/+2
gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir.h (class AbstractExpr): Add virtual destructor. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-09-06Fix v0-mangle1.rs test when run with ASANOwen Avery2-2/+4
gcc/rust/ChangeLog: * util/rust-canonical-path.h (CanonicalPath::CanonicalPath): Properly initialize crate_num with copy constructor. gcc/testsuite/ChangeLog: * rust/compile/v0-mangle1.rs: Make v0-mangle test more crate_num agnostic. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-09-05Bump action version to avoid missing distutilsPierre-Emmanuel Patry1-1/+1
ChangeLog: * .github/workflows/clang-format.yml: Bump action version to 18.2 Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-09-02Provide new asm test case for amd64badumbatish2-0/+25
gcc/testsuite/ChangeLog: * rust/execute/torture/inline_asm_mov_x_5.rs: Move to... * rust/execute/torture/inline_asm_mov_x_5_ARM.rs: ...here. * rust/execute/torture/inline_asm_mov_x_5_x86_64.rs: New test.
2024-09-02Rehaul, Apply code review from Arthurbadumbatish8-123/+42
gcc/rust/ChangeLog: * 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. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_typecheck.rs: Change comments
2024-09-02Fix return type of asm mov 5 to i32:0, torturedbadumbatish1-1/+2
gcc/testsuite/ChangeLog: * rust/execute/inline_asm_mov_x_5.rs: Move to... * rust/execute/torture/inline_asm_mov_x_5.rs: ...here.
2024-09-02Make inline mov compilesbadumbatish6-23/+71
gcc/rust/ChangeLog: * 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() gcc/testsuite/ChangeLog: * rust/compile/inline_asm_parse_operand.rs: Fix format asm * rust/compile/inline_asm_parse_output_operand.rs: Fix format asm * rust/execute/torture/inline_asm_mov_x_5.rs: Move to... * rust/execute/inline_asm_mov_x_5.rs: ...here.
2024-09-02Use's array type when constring string treebadumbatish1-3/+3
gcc/rust/ChangeLog: * 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
2024-09-02Added noreturn checking for nevertype, new testbadumbatish2-7/+32
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Added noreturn checking for nevertype gcc/testsuite/ChangeLog: * rust/compile/inline_asm_typecheck.rs: New test.
2024-09-02Perform lowering hir output operand to treebadumbatish1-1/+11
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::asm_build_expr): Add debug comment (CompileAsm::asm_construct_outputs): Perform lowering hir output operand to tree
2024-09-02Perform type check on InlineAsm's operandbadumbatish1-5/+60
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Perform type check on InlineAsm's operand (typecheck_inline_asm_operand): Likewise
2024-09-02Lower the HIR to tree with CompileExprbadumbatish2-13/+20
gcc/rust/ChangeLog: * 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
2024-09-02Move strip double quotes, add scaffold expandbadumbatish4-29/+39
gcc/rust/ChangeLog: * 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
2024-09-02Start work on expand inline asmbadumbatish2-2/+50
gcc/rust/ChangeLog: * 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 gcc/testsuite/ChangeLog: * rust/execute/torture/inline_asm_mov_x_5.rs: New test.
2024-09-02Added counting to check for asm_construct_outputsbadumbatish1-0/+7
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::asm_construct_outputs): Set up counting to check
2024-09-02Added new test for prep of output {}badumbatish1-0/+18
gcc/testsuite/ChangeLog: * rust/compile/inline_asm_parse_output_operand.rs: New test.
2024-09-02Minor fix to asm codegen prbadumbatish3-18/+21
gcc/rust/ChangeLog: * 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
2024-09-02Refactor compile-asm for first round reviewbadumbatish2-271/+107
gcc/rust/ChangeLog: * 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.
2024-09-02Successfully produce pseudo-nopbadumbatish3-30/+224
gcc/rust/ChangeLog: * 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
2024-09-02Scaffolding codebadumbatish3-1/+97
gcc/rust/ChangeLog: * 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.
2024-09-02Scaffolding new compile-asm filesbadumbatish5-40/+131
gcc/rust/ChangeLog: * 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
2024-09-02Setting up interfaces for codegenjjasmine2-2/+30
gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Setting up interfaces for codegen * hir/tree/rust-hir-expr.h: Likewise.
2024-09-02Local testing for build_string and debug()jjasmine1-1/+4
gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Local testing for build_string and debug()
2024-09-02Make sure CompileExpr::visit is reachedjjasmine3-4/+16
gcc/rust/ChangeLog: * hir/tree/rust-hir.cc (InlineAsm::accept_vis): Make sure CompileExpr::visit is reached * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise gcc/testsuite/ChangeLog: * rust/compile/inline_asm_compile_nop.rs: New test.
2024-09-02Scaffolding asm codegenjjasmine12-0/+40
gcc/rust/ChangeLog: * 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.
2024-09-02Fix the parser's operand and flags storagebadumbatish1-6/+15
gcc/rust/ChangeLog: * 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
2024-08-29Add pop guard for binderbadumbatish1-1/+4
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check.h: Add pop guard for binder
2024-08-29Add glibcxx_assertion checkbadumbatish2-0/+214
ChangeLog: * .github/workflows/ccpp.yml: Add glibcxx_assertion check * .github/glibcxx_ubuntu64b_log_expected_warnings: New file.
2024-08-29Add running cicd 32bitbadumbatish3-1/+234
ChangeLog: * .github/alpine_32bit_log_warnings: New file. * .github/workflows/ccpp32alpine.yml: New file. gcc/rust/ChangeLog: * resolve/rust-ast-resolve.cc (NameResolution::go): Fix warnings from const auto& to const auto
2024-08-28gccrs: emit error code for E0758Raiki Tamura2-7/+11
gcc/rust/ChangeLog: * lex/rust-lex.cc (Lexer::build_token): Emit error code. * lex/rust-lex.h: Fix comment. Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
2024-08-28gccrs: Add typecheck for path patterns.Raiki Tamura6-28/+175
gcc/rust/ChangeLog: * 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. gcc/testsuite/ChangeLog: * rust/compile/issue-2324-2.rs: Fix error message. * rust/compile/match9.rs: New test. Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
2024-08-27rust: Add checking for union patternsRaiki Tamura2-25/+76
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Add check for union patterns. gcc/testsuite/ChangeLog: * rust/compile/match8.rs: New test. Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
2024-08-22feature-gate: Cleanup visitor and constructorArthur Cohen15-169/+90
This commit turns a few of the fields into `tl::optional<T>` and cleanups the constructor with a couple default parameters. We can also reuse the variable that we are `switch`ing on, instead of repeating the enum variants each time. Most importantly, the `FeatureGate` visitor now uses the `DefaultAstVisitor` correctly, and will now visit nested items. This means that we have to fix a bunch of the testsuite as some feature attributes were missing. gcc/rust/ChangeLog: * 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. gcc/testsuite/ChangeLog: * rust/compile/assume.rs: Add missing feature attribute. * rust/compile/issue-1901.rs: Likewise. * rust/compile/issue-1981.rs: Likewise. * rust/compile/sizeof-stray-infer-var-bug.rs: Likewise. * rust/compile/torture/intrinsics-8.rs: Likewise. * rust/compile/torture/transmute-size-check-1.rs: Likewise. * rust/compile/torture/transmute1.rs: Likewise. * rust/compile/torture/uninit-intrinsic-1.rs: Likewise. * rust/execute/torture/issue-1436.rs: Likewise. * rust/execute/torture/issue-2583.rs: Likewise.
2024-08-22attributes: Start handling prelude_import properlyArthur Cohen7-2/+29
This commit adds basic handling for the `#[prelude_import]` attribute, without doing anything functionality wise. gcc/rust/ChangeLog: * 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. gcc/testsuite/ChangeLog: * rust/compile/prelude_import.rs: New test.
2024-08-21Fix the disorder struct and class in inline asmbadumbatish2-2/+3
gcc/rust/ChangeLog: * 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
2024-08-19ast: Introduce class hierarchy for lang item pathsArthur Cohen13-42/+294
Create a base Path class which is derived into two children classes for regular paths and lang item paths. This allows it to hold either the segments of a fully formed path, or the node ID of a lang-item path. This is required in order to create these special paths which do not have segments, and do not necessarily have a canonical form - they only depend on where the item was defined. gcc/rust/ChangeLog: * 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.
2024-08-19ast: Remove PathExpr abstract classArthur Cohen2-7/+2
Inherit directly from ExprWithoutBlock instead. gcc/rust/ChangeLog: * ast/rust-ast.h (class PathExpr): Remove class. * ast/rust-path.h (class PathInExpression): Inherit from ExprWithoutBlock. (class QualifiedPathInExpression): Likewise.
2024-08-19ast: PathPattern: Remove `remove_all_segments` methodArthur Cohen1-11/+6
This method was used only for stripping PathPattern AST nodes during `cfg-strip`, which seems like a misnomer and makes it a good candidate for simplification. gcc/rust/ChangeLog: * ast/rust-path.h (class PathInExpression): Remove `remove_all_segments` method, add a `marked_for_strip` flag instead.
2024-08-16Attempted to access a nonexistent field [E0609]Muhammad Mahad2-2/+19
gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Add error code and update error message gcc/testsuite/ChangeLog: * rust/compile/nonexistent-field.rs: New test. Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-08-16Move errors with locationsKushal Pal3-10/+96
gcc/rust/ChangeLog: * checks/errors/borrowck/rust-borrow-checker-diagnostics.cc (BorrowCheckerDiagnostics::report_move_errors): Specify locations for code causing errors and related moves. gcc/testsuite/ChangeLog: * rust/borrowck/test_move.rs: Test rich-errors related to moves. * rust/borrowck/test_move_conditional.rs: Likewise. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>