-
Notifications
You must be signed in to change notification settings - Fork 173
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
Borrowck stage2 #2885
Borrowck stage2 #2885
Conversation
Eh, bad gcc4. :( Anyway you can look at it, those will be only technical fixes. |
10fa70d
to
2611b4e
Compare
2611b4e
to
abfe3ac
Compare
abfe3ac
to
709dc70
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will finish reviewing later today but I have something else I need to work on for now. I'll get all your PRs reviewed before the end of the day
709dc70
to
8e639f5
Compare
All requested changes done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't much to say beside nits. Great work!
970ad72
to
7a99582
Compare
@P-E-P I just added one more commit removing all the block with single statement (more that just those you commented on). |
@CohenArthur all comments resolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Replace direct usage of system headers. gcc/rust/ChangeLog: * 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 Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Use callable API Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-place.h: Create place tree traverse API. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * 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 Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
Rust part is not build and not invoked at this point. gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-free-region.h: New file. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
Biggybag on variance analysis to extract regions of fields from ADT regions. gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
This is the main Polonius based logic which creates the information Polonius needs from BIR. It is largly guessed and rever engineered, so some aspects are probably wrong. gcc/rust/ChangeLog: * checks/errors/borrowck/rust-bir-fact-collector.h: New file. * checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go): Enable fact collection. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog: * 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. Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
00030ad
to
2c10c40
Compare
@CohenArthur all comments resolved again :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
well done @jdupak, amazing work :D |
All changes except those Polonius crate dependant.
All tested for the format, change log, compile, and tests.
Depends on #2823
@CohenArthur
@braw-lee