Age | Commit message (Collapse) | Author | Files | Lines |
|
Addresses #2883.
contrib/
* gcc_update (files_and_dependencies): Update for
'libformat_parser' in libgrust.
gcc/rust/
* Make-lang.in (LIBFORMAT_PARSER): Point to 'libformat_parser'
build in libgrust.
(%.toml:, $(LIBFORMAT_PARSER):): Remove.
libgrust/
* libformat_parser/Makefile.am: New.
* Makefile.am [!TARGET_LIBRARY] (SUBDIRS): Add 'libformat_parser'.
* configure.ac: Handle it.
(TARGET_LIBRARY): New 'AM_CONDITIONAL'.
* libformat_parser/Makefile.in: Generate.
* Makefile.in: Regenerate.
* configure: Likewise.
|
|
Fixes #2883.
* .gitignore: Remove 'libgrust/*/target/'.
gcc/rust/
* Make-lang.in (LIBFORMAT_PARSER): Point to the GCC build
directory.
* ($(LIBFORMAT_PARSER)): Build in the GCC build directory.
|
|
gcc/rust/
* Make-lang.in (LIBFORMAT_PARSER): Point to the actual build artifact.
($(LIBFORMAT_PARSER)): Don't cache it.
|
|
gcc/rust/
* Make-lang.in (RUST_LIBDEPS): Inline into all users.
|
|
... to avoid verbatim repetition.
gcc/rust/
* Make-lang.in (LIBPROC_MACRO_INTERNAL): New.
(RUST_LIBDEPS, crab1$(exeext), rust/libformat_parser.a): Use it.
|
|
... to avoid verbatim repetition.
gcc/rust/
* Make-lang.in (LIBPROC_MACRO_INTERNAL): New.
(RUST_LIBDEPS, crab1$(exeext)): Use it.
|
|
Unused.
gcc/rust/
* Make-lang.in (RUST_LDFLAGS): Inline into all users.
|
|
'gcc/rust/Make-lang.in:RUST_LDFLAGS'
This isn't necessary, as the full path to 'libproc_macro_internal.a' is
specified.
gcc/rust/
* Make-lang.in (RUST_LDFLAGS): Remove
'libgrust/libproc_macro_internal'.
|
|
'gcc/rust/Make-lang.in:RUST_LDFLAGS'
That directory doesn't even exist.
gcc/rust/
* Make-lang.in (RUST_LDFLAGS): Remove
'libgrust/librustc_format_parser'.
|
|
gcc/rust/ChangeLog:
* Make-lang.in: Add --offline flag to cargo invocation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>
|
|
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>
|
|
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-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>
|
|
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-free-region.h: New file.
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-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>
|
|
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-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-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::visit):
Use callable API
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>
|
|
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>
|
|
Never can... never... exist, so it should always be coerced to the type
it is being matched against. This is useful for breaking off of a loop
from inside a match, or an if condition, for example.
gcc/rust/ChangeLog:
* typecheck/rust-unify.cc (UnifyRules::go): Always unify to `ltype` if
we are matching against a `Never` in `rtype`.
(UnifyRules::expect_never): Always unify to the expected type.
gcc/testsuite/ChangeLog:
* rust/compile/match-never-ltype.rs: New test.
* rust/compile/match-never-rtype.rs: New test.
|
|
The error is actually expected and uses the correct location.
gcc/testsuite/ChangeLog:
* rust/compile/raw-byte-string-loc.rs: Use dg-error instead of
dg-excess-error.
* rust/compile/raw-string-loc.rs: Likewise.
|
|
gcc/rust/ChangeLog:
* lex/rust-lex.cc
(Lexer::parse_raw_string):
Bring handling of edge cases to par with parse_raw_byte_string.
gcc/testsuite/ChangeLog:
* rust/compile/raw-string-loc.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h
(Parser::parse_vis_item):
Call parse_function instead of parse_async_item when finding
UNSAFE or EXTERN_KW during lookahead.
gcc/testsuite/ChangeLog:
* rust/compile/func-const-unsafe.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* util/rust-attribute-values.h
(Attributes::UNSTABLE): New.
* util/rust-attributes.cc
(__definitions): Add Attributes::UNSTABLE.
gcc/testsuite/ChangeLog:
* rust/compile/unstable-fn.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* util/rust-attribute-values.h
(Attributes::RUSTC_DEPRECATED): New.
* util/rust-attributes.cc
(__definitions): Add Attributes::RUSTC_DEPRECATED.
gcc/testsuite/ChangeLog:
* rust/compile/deprecated-fn.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* lex/rust-lex.cc
(Lexer::parse_raw_byte_string):
Bring handling of edge cases to par with parse_byte_string.
gcc/testsuite/ChangeLog:
* rust/compile/raw-byte-string-loc.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
GCC 4.8 does not handle pair with references correctly. We need to use a
properly typed struct instead.
gcc/rust/ChangeLog:
* resolve/rust-forever-stack.h: Change dfs function prototype and
declare dfs return type structure.
* resolve/rust-forever-stack.hxx: Adapt dfs function to the new return
type.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Add a few test for globbing to highlight function call ambiguities.
gcc/testsuite/ChangeLog:
* rust/compile/name_resolution23.rs: New test.
* rust/compile/name_resolution24.rs: New test.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/testsuite/ChangeLog:
* rust/compile/name_resolution13.rs: Add new module and remove compile
step.
* rust/compile/name_resolution14.rs: New test.
* rust/compile/name_resolution15.rs: New test.
* rust/compile/name_resolution16.rs: New test.
* rust/compile/name_resolution17.rs: New test.
* rust/compile/name_resolution18.rs: New test.
* rust/compile/name_resolution19.rs: New test.
* rust/compile/name_resolution20.rs: New test.
* rust/compile/name_resolution21.rs: New test.
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-resolve-path.cc: Attempt to resolve names
also using new name resolution context.
* backend/rust-compile-resolve-path.h: Add new declaration.
|
|
Name resolution for rebind were missing.
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_glob):
Change function prototype to use a reference instead.
(TopLevel::handle_use_dec): Likewise.
(TopLevel::handle_rebind): Add name resolution on rebind use
declarations.
(flatten_rebind): Change prototype to accept a pair of path/alias.
(flatten_list): Adapt call to flatten_rebind.
(flatten): Adapt call to flatten_rebind.
(flatten_glob): Remove unused part.
(TopLevel::visit): Add rebind resolution.
* resolve/rust-toplevel-name-resolver-2.0.h: Adapt function prototypes.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Definition/usage mapping during name resolution was missing.
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add mapping
implementation.
* resolve/rust-late-name-resolver-2.0.h: Add function visitor prototype
override.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
This format dialog triggered a warning.
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_dec):
Replace the string format %<%s%> with the proper %qs format.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Immutable name resolution context is not initialized when the classic
name resolution is in use. It can therefore not be used, the getter would
error out.
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
Only get immutable name resolution context when name resolution 2.0 is
used.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Crate number was not assigned with the other fields in the assignment
operator overload of a CannonicalPath.
gcc/rust/ChangeLog:
* util/rust-canonical-path.h: Also assign crate number.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
The old resolver injected a Self generic parameter in order to help the
trait solver. This is clearly sketchy at best and should be fixed in
the future.
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Add
Self generic parameter injection and a warning.
* resolve/rust-toplevel-name-resolver-2.0.h: Add function prototype.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Constant items were handled only by the old resolver, this lead to an
ICE when using the new resolver on some rust code containing a constant
item as the new and the old resolver cannot be used at the same time.
gcc/rust/ChangeLog:
* backend/rust-compile-item.cc (CompileItem::visit): Check the resolver
flag and use the new one when required.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|