- Feb 21, 2023
-
-
Richard Biener authored
When computing the number of iterations until wrap types are mixed up, eventually leading to checking ICEs with a pointer bitwise inversion. The following uses niter_type for the calculation. PR tree-optimization/108793 * tree-ssa-loop-niter.cc (number_of_iterations_until_wrap): Use convert operands to niter_type when computing num. * gcc.dg/torture/pr108793.c: New testcase.
-
Thomas Schwinge authored
... which accidentally had gotten reverted in recent commit r13-6156-g1e8eb102200902e12c1b00e867e338be0a92c292 "gccrs: dump: Emit visibility when dumping items".
-
Raiki Tamura authored
gcc/rust/ChangeLog: * backend/rust-builtins.cc (BuiltinsContext::setup_math_fns): New functions. gcc/testsuite/ChangeLog: * rust/compile/torture/intrinsics-math.rs: New test.
-
Arthur Cohen authored
We only used one path of the C++ folder's get_nth_callarg function: CALL_EXPR_ARG. Replace all calls to get_nth_callarg by macro calls to CALL_EXPR_ARG gcc/rust/ChangeLog: * backend/rust-constexpr.cc (get_nth_callarg): Remove function. (rs_bind_parameters_in_call): Use CALL_EXPR_ARG instead. (potential_constant_expression_1): Likewise.
-
Thomas Schwinge authored
... lost in #1527 commit 138a6260124740208b8f3aff2e38617f43b05fe8 "rust: Add -frust-compile-until option". gcc/rust/ChangeLog: * lang.opt: Fix ordering of file.
-
Philip Herron authored
gcc/rust/ChangeLog: * 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.
-
Philip Herron authored
gccrs: Skip this debug test case which is failing on the latest mac-os devtools and its only for debug info gcc/testsuite/ChangeLog: * rust/debug/chartype.rs: Skip testcases on Darwin architectures.
-
Philip Herron authored
This adds missing copy constructors to HIR::PathExprSegment which were wrongly defaulting to empty vectors when apply specified generic arguments to method calls. gcc/rust/ChangeLog: * 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`.
-
Philip Herron authored
When we have a closure expression that captures a parent function's variable we must setup the closure data to contain this. Ignoring moveability and mutability requires for now, this patch creates the closure structure with fields for each of the captured variables. When it comes to compilation of the closure expression in order to support nested closures we must setup a context of implicit mappings so that for all path resolution we hit this implicit closure mappings lookups code before any lookup_var_decl as this decl will not exist so the order here is important during path resolution which is a similar problem to match expression destructuring. Fixes #195 gcc/rust/ChangeLog: * 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. gcc/testsuite/ChangeLog: * rust/execute/torture/closure3.rs: New test.
-
Philip Herron authored
gcc/rust/ChangeLog: * 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.
-
Philip Herron authored
When we have a closure block referencing variables in a parent function, we must track what these are. We do this by having a context of closures so if we have a variable reference and its declared in a rib whose node id is less than the node id of the closure's node id we know it must be a captured variable. We also need to iterate all possible closure contexts as we might be in the case of a nested closure. Addresses #195 gcc/rust/ChangeLog: * 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.
-
Philip Herron authored
This allows us to track the type of declaration that is stored within a Rib. gcc/rust/ChangeLog: * 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.
-
Philip Herron authored
This macro is a mess and a helper method is much better for this case. gcc/rust/ChangeLog: * 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.
-
Raiki Tamura authored
gcc/rust/ChangeLog: * 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. Signed-off-by:
Raiki Tamura <tamaron1203@gmail.com>
-
Dave authored
gcc/rust/ChangeLog: * ast/rust-item.h: Remoe default location for Visibility class. * parse/rust-parse-impl.h (Parser::parse_visibility): Pass proper location when instantiating visibilities.
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Fix dumping of fn params. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Remove extraneous string when dumping statements. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc: Remove unused include. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. * ast/rust-ast-dump.h: Likewise. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
+ Return FunctionQualifiers as ref to work in ast dump gcc/rust/ChangeLog: * 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. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing tuple type visitor. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing never type visitor. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing RawPointer visitor. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing array visitor Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing slice visitor. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
This is currently needed for lifetimes to use the existing infrastructure. gcc/rust/ChangeLog: * 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. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
This is currently needed for lifetimes to use the existing infrastructure. gcc/rust/ChangeLog: * 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. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Arthur Cohen authored
gcc/rust/ChangeLog: * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Fix extra call to `delete`.
-
Dave authored
gcc/rust/ChangeLog: * 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.
-
Raiki Tamura authored
gcc/rust/ChangeLog: * util/rust-lang-item.h: Add handling for `phantom_data` lang item. gcc/testsuite/ChangeLog: * rust/compile/torture/phantom_data.rs: New test.
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add handling for unit structures. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * ast/rust-ast-dump.h: Fix documentation. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-
Jakub Dupak authored
gcc/rust/ChangeLog: * 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. Signed-off-by:
Jakub Dupak <dev@jakubdupak.com>
-