Skip to content

Resolve merge conflicts.#2

Open
braw-lee wants to merge 17 commits intojdupak:borrowck-wipfrom
braw-lee:fix_polonius_link
Open

Resolve merge conflicts.#2
braw-lee wants to merge 17 commits intojdupak:borrowck-wipfrom
braw-lee:fix_polonius_link

Conversation

@braw-lee
Copy link
Copy Markdown

Rebased from master branch.

gcc/rust/ChangeLog:

	* typecheck/rust-tyty-subst.cc (SubstitutionRef::get_arg_at):
	Add unified API.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog:

	* 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.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit):
	Collect variance info from types.

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/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/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.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog:

	* Make-lang.in: Link Polonius.
	* checks/errors/borrowck/rust-borrow-checker.cc: Run Polonius.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/ChangeLog:

	* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.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.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
@braw-lee
Copy link
Copy Markdown
Author

or you can merge master yourself, and I will rebase from you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants