forked from Rust-GCC/gccrs
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Polonius investigation #16
Draft
jdupak
wants to merge
5,590
commits into
CohenArthur:polonius-investigation
Choose a base branch
from
jdupak:polonius-investigation
base: polonius-investigation
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Polonius investigation #16
jdupak
wants to merge
5,590
commits into
CohenArthur:polonius-investigation
from
jdupak:polonius-investigation
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remove the NodeId member from identifiers. This member did not make sense and was solely used for procedural macros. gcc/rust/ChangeLog: * ast/rust-ast.h: Remove NodeId from identifiers. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
An error should be emitted when a proc_macro, proc_macro_attribute or proc_macro_derive attribute is met on any non function item. Those attribute shall be placed only on bare functions. gcc/rust/ChangeLog: * 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. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Add a bunch of test cases to avoid regressions on attribute error message. gcc/testsuite/ChangeLog: * rust/compile/proc_macro_non_function.rs: New test. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Add a bunch of test case to avoid regressions on proc_macro_attribute attribute error messages. gcc/testsuite/ChangeLog: * rust/compile/proc_macro_attribute_non_function.rs: New test. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Add a bunch of test cases to avoid regressions on proc_macro_derive attribute errors when placed on any non function item. gcc/testsuite/ChangeLog: * rust/compile/proc_macro_derive_non_function.rs: New test. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Proc macro crates cannot have any public function but proc macros. Proc macros should be public. gcc/rust/ChangeLog: * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::go): Add visibility verification. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Add some tests to prevent regression on private procedural macros error messages. gcc/testsuite/ChangeLog: * rust/compile/proc_macro_attribute_private.rs: New test. * rust/compile/proc_macro_derive_private.rs: New test. * rust/compile/proc_macro_private.rs: New test. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Some test were using dg-excess-errors instead of dg-error, this is now fixed. gcc/testsuite/ChangeLog: * rust/compile/proc_macro_attribute_crate_type.rs: Replace dg-excess-errors with dg-error and fix the line so the test can pass. * rust/compile/proc_macro_crate_type.rs: Likewise. * rust/compile/proc_macro_derive_crate_type.rs: Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Crates of type 'proc-macro' should not have any other pub member than procedural macros. These new test will avoid regression on error messages in such sitation. gcc/testsuite/ChangeLog: * rust/compile/proc_macro_pub_function.rs: New test. * rust/compile/proc_macro_pub_module.rs: New test. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Refactor proc macro specific privacy check in multiple shorter functions. gcc/rust/ChangeLog: * 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. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Refactor attribute search with early return. Also fix the optional building an object with it's default empty constructor by explicitely using tl::null_opt. gcc/rust/ChangeLog: * checks/errors/privacy/rust-privacy-reporter.cc (find_proc_macro_attribute): Refactor the function to be safer and more efficient. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
The symbol had a different convention from rust standard naming convention (?) hence the change before adding new callback. gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (load_macros_array): Symbol rename. ChangeLog: * libgrust/libproc_macro/proc_macro.cc (Procmacro::make_bang): Change symbol name. * libgrust/libproc_macro/registration.h: Likewise. * libgrust/libproc_macro/tokenstream.cc (TokenStream::make_tokenstream): Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Add a callback from gcc to determine wether the bridge is available or not. gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (available): Add symbol registration. (load_macros_array): Likewise. ChangeLog: * libgrust/libproc_macro/proc_macro.cc (not_available): Add a function to express bridge unavailability. * libgrust/libproc_macro/proc_macro.h (not_available): Likewise. * libgrust/libproc_macro/registration.h: Add symbol type. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Add is_available function to the C++ library. ChangeLog: * libgrust/libproc_macro/proc_macro.cc (bridge_is_available): Add bridge function. * libgrust/libproc_macro/proc_macro.h (bridge_is_available): Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
There was no need to register a function when the value could be registered directly. gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (available): Remove function. (load_macros_array): There was no need for an indirection here. ChangeLog: * libgrust/libproc_macro/proc_macro.cc (not_available): Remove function. * libgrust/libproc_macro/proc_macro.h (not_available): Remove function prototype. * libgrust/libproc_macro/registration.h: Change symbol type. * libgrust/libproc_macro/bridge.h: New file. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
This function prototype was forgotten when the function was deleted. ChangeLog: * libgrust/libproc_macro/proc_macro.h (proc_macro_register_from_str): Remove rogue function prototype. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Initially a typedef was used to easily get the callback function pointer type. Since this type has changed to a simpler well defined type, this using declaration has no more purpose. ChangeLog: * libgrust/libproc_macro/proc_macro.cc: Remove type alias. * libgrust/libproc_macro/registration.h: Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
ChangeLog: * .github/workflows/bootstrap.yml: Run a bootstrap build nightly. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Check proc_macro, proc_macro_attribute and proc_macro_derive attributes on non root functions, emit an error when one is found. gcc/rust/ChangeLog: * 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. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Add multiple tests to prevent regressions on procedural macros errors when one is declared outside of the crate's top level. gcc/testsuite/ChangeLog: * rust/compile/proc_macro_attribute_non_root_function.rs: New test. * rust/compile/proc_macro_attribute_non_root_method.rs: New test. * rust/compile/proc_macro_attribute_non_root_module.rs: New test. * rust/compile/proc_macro_derive_non_root_function.rs: New test. * rust/compile/proc_macro_derive_non_root_method.rs: New test. * rust/compile/proc_macro_derive_non_root_module.rs: New test. * rust/compile/proc_macro_non_root_function.rs: New test. * rust/compile/proc_macro_non_root_method.rs: New test. * rust/compile/proc_macro_non_root_module.rs: New test. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Updated ErrorCode struct to enum class to enforce proper error codes, similiar to rustc. For converting the enum to the respective error code, I used a map and updated make_description & make_url function accordingly and also removes the memory leak from the previous frame- work. Also, added macro to safely convert the enum number to string. gcc/rust/ChangeLog: * 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. Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
Move the function registered as a callback in a new anonymous namespace in order to group every callback in the future under the same namespace. gcc/rust/ChangeLog: * expand/rust-proc-macro.cc: Remove static modifier and move to an anonymous namespace. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
The literal conversion code could be used for the literal_from_string callback, this means we should move it out of the function in it's own function. This involves a new switch, which is quite sad but we're not yet at a performance profiling phase, there may be lower hanging fruits. gcc/rust/ChangeLog: * 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. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
The function to get a literal from a string missed an implementation. It did require a conversion function to achieve it, now that callback system has been merged this function can be easily implemented. gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (literal_from_string): Add callback function. (load_macros_array): Likewise. ChangeLog: * libgrust/libproc_macro/literal.cc (Literal__from_string): Add implementation with call to constructor. (Literal::make_literal): Add new constructor which calls the callback. * libgrust/libproc_macro/literal.h: Add new constructor's prototype. * libgrust/libproc_macro/proc_macro.cc (bridge_is_available): Change symbol name to match convention. * libgrust/libproc_macro/registration.h: Add lit_from_str symbol. * libgrust/libproc_macro/tokenstream.cc (TokenStream::make_tokenstream): Change symbol name to disambiguate with literal from string. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Refactored error message similiar to rustc & called error function. gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): refactored error message & called error function. gcc/testsuite/ChangeLog: * rust/compile/break2.rs: Modified file to pass test case. * rust/compile/break_with_value_inside_loop.rs: New test. Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
gcc/rust/ChangeLog: * 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.
gcc/rust/ChangeLog: * 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. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/ChangeLog: * 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.
gcc/rust/ChangeLog: * 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. Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
Add a new test to highlight fix for Rust-GCC#2648. gcc/testsuite/ChangeLog: * rust/compile/parse_pub_unit_type.rs: New test. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Add a comma as an expr delimiter, this will allow correct parsing of match arm expressions. gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_expr): Add comma delimiter. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
This new test highlight the fix for issue Rust-GCC#2657. gcc/testsuite/ChangeLog: * rust/compile/match_break.rs: New test. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
When a token was identified as bit left shift it slipped through the parser and resulted in an error. gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_path_expr_segment): Accept left shift tokens in order to let generic parsing function split the token. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
New regression test to highlight behavior of Rust-GCC#2652. gcc/testsuite/ChangeLog: * rust/compile/parse_generic_path_expr.rs: New test. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
The parser was too agressive and did reject any line beginning with default even if this was a macro call. gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_item): Relax constraints around default identifier at item scope to accept "default" macros. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
This test highlight the fix required for Rust-GCC#2655. gcc/testsuite/ChangeLog: * rust/compile/parse_item_default_macro.rs: New test. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Implement for tuple pat. * resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): Implement for tupple pat. gcc/testsuite/ChangeLog: * rust/compile/tupple_struct_pattern_tuple.rs: New test. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * hir/tree/rust-hir-expr.h: Add getter for name. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
Unify with the name used in Expr to allow convenient template over everything that has mappings. gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
Use more a consistent name. gcc/rust/ChangeLog: * 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.
gcc/rust/ChangeLog: * hir/tree/rust-hir-path.h: Avoid copy in getter. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-dump.cc (Dump::go): Use new print. (print_comma_separated): Comma separation print. (Dump::visit): Use new print. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
Add option to simplify cfg for better readability. Off by default. gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-dump.cc (get_place_name): Removed. (renumber_places): Renumber logic. (Dump::go): Renumber places. (Dump::visit): Use renumbered places. (Dump::visit_place): Use renumbered places. * checks/errors/borrowck/rust-bir-dump.h (class Dump): Use renumbered places. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Continue. (ExprStmtBuilder::setup_loop): Continue. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * checks/errors/borrowck/bir-design-notes.md: New file. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
jdupak
force-pushed
the
polonius-investigation
branch
from
October 18, 2023 21:29
2353bff
to
88a09ab
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thank you for making Rust GCC better!
If your PR fixes an issue, you can add "Fixes #issue_number" into this
PR description and the git commit message. This way the issue will be
automatically closed when your PR is merged. If your change addresses
an issue but does not fully fix it please mark it as "Addresses #issue_number"
in the git commit message.
Here is a checklist to help you with your PR.
make check-rust
passes locallyclang-format
gcc/testsuite/rust/
Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.
*Please write a comment explaining your change. This is the message
that will be part of the merge commit.