Age | Commit message (Collapse) | Author | Files | Lines |
|
The compiler was still relying on NR1 for closure captures when using nr2
even though the resolver was not used and thus it's state empty.
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add environment
collection.
* resolve/rust-late-name-resolver-2.0.h: Add function prototype.
* resolve/rust-name-resolver.cc (Resolver::get_captures): Add assertion
to prevent NR2 usage with nr1 capture functions.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Use
nr2 captures.
* util/rust-hir-map.cc (Mappings::add_capture): Add function to
register capture for a given closure.
(Mappings::lookup_captures): Add a function to lookup all captures
available for a given closure.
* util/rust-hir-map.h: Add function prototypes.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
ChangeLog:
* .github/workflows/ccpp.yml: Update actions/upload-artifact
from v3 to v4, handle any artifact name conflicts.
* .github/workflows/ccpp32alpine.yml: Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Some of our tests only work with name resolution 2.0 because the latter
misinterprets type paths. This change should cause the compiler to error out
if it would otherwise misinterpret a type path. A fix for type path
resolution isn't included in this comment, since doing so would make it
harder to track the meaningfulness of test regressions.
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Error out if a type path has multiple segments,
as we currently ignore every segment except the last.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Add entries.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (check_match_scrutinee): Allow anything to be used as a
match scrutinee, not just ADTs.
|
|
gcc/rust/ChangeLog:
* util/rust-lang-item.h: Add handling for Result::Ok, Result::Err, Try, Try::into_result,
Try::from_ok, Try::from_err.
* util/rust-lang-item.cc: Likewise.
gcc/testsuite/ChangeLog:
* rust/compile/try-trait.rs: New test.
|
|
Nr2 did not emit the correct error message for break identifier "rust".
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add "rust"
identifier detection akin to nr1.
(funny_ice_finalizer): Copy ICE finalizer from nr1.
* resolve/rust-late-name-resolver-2.0.h: Add funny_error member
context state.
* Make-lang.in: Add new translation unit for new ice finalizer.
* resolve/rust-ast-resolve-expr.cc: Move ice
finalizer to it's own file.
* resolve/rust-ice-finalizer.cc: New file.
* resolve/rust-ice-finalizer.h: New file.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove break-rust3.rs from exclude list.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* expand/rust-derive-copy.cc: Always add an extra Copy bound on generic Copy impls.
|
|
gcc/rust/ChangeLog:
* expand/rust-derive-clone.cc (DeriveClone::visit_union): Use lang items for Copy and
Sized bounds.
gcc/testsuite/ChangeLog:
* rust/compile/derive_macro6.rs: Add lang item attribute to Copy trait.
|
|
gcc/rust/ChangeLog:
* expand/rust-derive-clone.cc: Add extra bound when deriving generic Clone
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-builder.cc (Builder::new_type_param): Add optional extra trait bounds.
* ast/rust-ast-builder.h: Likewise.
|
|
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::do_typepathsegment): Add handling for lang items.
|
|
Add and implement a lang item (receiver) in source code.
gcc/rust/ChangeLog:
* util/rust-lang-item.cc: Add receiver to map.
* util/rust-lang-item.h: Define LangItem::Kind::RECEIVER.
gcc/testsuite/ChangeLog:
* rust/compile/issue-2954.rs: New test.
Signed-off-by: lishin <lishin1008@gmail.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Register auto traits in mappings.
* util/rust-hir-map.cc (Mappings::insert_auto_trait): New.
(Mappings::get_auto_traits): New.
* util/rust-hir-map.h: Declare them.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Add auto trait bounds when
scanning.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Some parts of nr2.0 can't handle auto traits yet.
* rust/compile/auto_traits3.rs: Removed in favor of...
* rust/compile/auto_traits2.rs: ...this one.
* rust/compile/auto_traits4.rs: New test.
|
|
This paves the way for adding trait bounds that aren't necessarily Sized.
gcc/rust/ChangeLog:
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::add_trait_bound): New function.
* typecheck/rust-hir-type-bounds.h: Declare it.
(TypeBoundsProbe::assemble_builtin_candidate): Call into add_trait_bound.
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Improve formatting.
|
|
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Add failing lang item typepaths tests.
* rust/execute/torture/derive_macro4.rs: Mark Clone as lang item.
|
|
gcc/rust/ChangeLog:
* expand/rust-derive-clone.cc (DeriveClone::clone_enum_struct): New function for deriving
enum struct variants.
(DeriveClone::visit_enum): Call into the new function.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude:
* rust/compile/derive_clone_enum1.rs: New test.
* rust/compile/derive_clone_enum2.rs: New test.
* rust/compile/derive_clone_enum3.rs: New test.
* rust/execute/torture/derive_clone_enum1.rs: New test.
|
|
gcc/rust/ChangeLog:
* expand/rust-derive-clone.cc (DeriveClone::variant_match_path): New function.
(DeriveClone::clone_enum_identifier): Rename.
(DeriveClone::clone_enum_tuple): New function.
(DeriveClone::visit_enum): Visit tuple variants properly.
* expand/rust-derive-clone.h: Declare new functions.
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-builder.cc: Add new methods for constructing struct exprs.
* ast/rust-ast-builder.h: Mention how to build tuple expressions.
|
|
gcc/rust/ChangeLog:
* expand/rust-derive-clone.cc: Clone enum identifier variants properly
* expand/rust-derive-clone.h: Declare new functions used.
|
|
gcc/testsuite/ChangeLog:
* rust/compile/derive_macro4.rs: Mark Copy and Clone as lang items.
|
|
gcc/rust/ChangeLog:
* expand/rust-derive-clone.cc (DeriveClone::clone_call): Mention using `clone_fn`
lang item in the future.
|
|
gcc/rust/ChangeLog:
* expand/rust-derive-clone.cc (DeriveClone::visit_union): Create a lang item path
instead of a regular path.
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-builder.cc: New functions.
* ast/rust-ast-builder.h: Declare them.
|
|
gcc/rust/ChangeLog:
* expand/rust-derive-copy.cc: Use lang item path.
|
|
gcc/testsuite/ChangeLog:
* rust/compile/derive_macro4.rs: Make PhantomData a lang item.
|
|
gcc/rust/ChangeLog:
* expand/rust-derive-clone.cc (DeriveClone::visit_union): Manually generate
the struct used for asserting a union implements Copy.
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-builder.cc (Builder::struct_struct): New function.
* ast/rust-ast-builder.h (vec): New function.
|
|
gcc/testsuite/ChangeLog:
* rust/compile/derive_macro1.rs: Add #[lang = "clone"] to Clone trait.
* rust/compile/derive_macro3.rs: Likewise.
* rust/compile/derive_macro6.rs: Likewise.
* rust/execute/torture/derive_macro3.rs: Likewise.
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): Visit tuple pattern items as
separated by commas.
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): Fix collector to better
handle lang item type path segments.
|
|
This method errors out if the lang item has not been declared yet.
gcc/rust/ChangeLog:
* util/rust-hir-map.cc (Mappings::get_lang_item_node): New.
* util/rust-hir-map.h: New function.
|
|
Which formats a lang item as it appears in source code.
gcc/rust/ChangeLog:
* util/rust-lang-item.cc (LangItem::PrettyString): New.
* util/rust-lang-item.h: New.
|
|
gcc/rust/ChangeLog:
* ast/rust-collect-lang-items.cc (CollectLangItems::visit): New.
* ast/rust-collect-lang-items.h: New.
|
|
gcc/rust/ChangeLog:
* hir/rust-ast-lower-type.cc (ASTLowerTypePath::visit): Adapt code to lang item
type path segments.
|
|
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Adapt
code to handle lang item type paths.
|
|
Lang item typepaths were not handled properly, and required a complete overhaul.
All old classes that concerned lang item paths are now modified to use a simpler
version of `AST::LangItemPath`, which has been removed. TypePath segments can now
be lang items, as this is requied for having generic lang item paths such as
PhantomData<T>.
gcc/rust/ChangeLog:
* ast/rust-path.h: Rework how lang item paths are represented.
* ast/rust-path.cc: Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-ast.cc: Likewise.
* ast/rust-ast-collector.cc: Adapt to new lang item path system.
* ast/rust-ast-collector.h: Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast-visitor.h: Likewise.
* expand/rust-derive-copy.cc: Likewise.
* expand/rust-derive.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-type.cc (ASTLowerTypePath::translate): Likewise.
(ASTLowerTypePath::visit): Likewise.
* hir/rust-ast-lower-type.h: Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Likewise.
* resolve/rust-ast-resolve-type.h: Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Likewise.
* resolve/rust-late-name-resolver-2.0.h: Likewise.
* hir/tree/rust-hir-path.cc (TypePathSegment::TypePathSegment): Likewise.
(TypePathSegmentGeneric::TypePathSegmentGeneric): Likewise.
* hir/tree/rust-hir-path.h: Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path): Likewise.
* ast/rust-ast-builder.cc: Likewise.
* ast/rust-ast-builder.h: Likewise.
|
|
gcc/rust/ChangeLog:
* ast/rust-collect-lang-items.cc (get_lang_item_attr): Show unknown attribute upon error.
|
|
gcc/rust/ChangeLog:
* util/rust-attribute-values.h: Declare new attribute value.
* util/rust-attributes.cc: Use it.
|
|
gcc/rust/ChangeLog:
* ast/rust-ast.cc (BlockExpr::normalize_tail_expr): Remove overzealous
std::move
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc
(TokenCollector::visit): Remove visitor for NamedFunctionParam.
* ast/rust-ast-collector.h
(TokenCollector::visit): Likewise.
* ast/rust-ast-full-decls.h
(class NamedFunctionParam): Remove forward declaration.
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): Remove visitor for
NamedFunctionParam.
* ast/rust-ast-visitor.h
(DefaultASTVisitor::visit): Likewise.
* ast/rust-ast.cc
(NamedFunctionParam::as_string): Remove.
* ast/rust-item.h
(class NamedFunctionParam): Remove.
(class ExternalFunctionItem): Remove.
* parse/rust-parse-impl.h
(Parser::parse_named_function_param): Remove.
(Parser::parse_named_function_params): Remove.
* parse/rust-parse.h
(Parser::parse_named_function_param): Remove.
(Parser::parse_named_function_params): Remove.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc
(Early::visit): Resolve the pending eager invocations inside
builtin macro invocations.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove entries.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
We need to add name resolution and hir lowering for items as part of blocks
in order to typecheck and compile them correctly.
Fixes Rust-GCC#3350
gcc/rust/ChangeLog:
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): hir lowering
* hir/rust-ast-lower-stmt.h: likewise
* resolve/rust-ast-resolve-stmt.cc (ResolveStmt::visit): name resolution
* resolve/rust-ast-resolve-stmt.h: likewise
gcc/testsuite/ChangeLog:
* rust/compile/issue-3350.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
This reverts commit 600fd806b8821ea24103ea0f31d666077245c6b7.
|
|
gcc/testsuite/ChangeLog:
* rust/compile/macros/builtin/eager1.rs: Switch to scan-assembler directive as the
GIMPLE dump does not contain strings on LE.
* rust/compile/macros/builtin/recurse2.rs: Likewise.
|
|
Some failures occur in the testsuite because we
did not account for the little-endian case.
gcc/testsuite/ChangeLog:
* rust/compile/issue-1446.rs: Add swap_bytes function.
* rust/compile/iterators1.rs: Remove unused {to, from}_le functions.
|
|
ForeverStackStore is meant to partially unify the internal states of
per-namespace ForeverStack instances. This commit does not contain
modifications to ForeverStack which would allow it to rely on a
ForeverStackStore to store nodes, but a future commit should address
this.
gcc/rust/ChangeLog:
* Make-lang.in: Handle rust-forever-stack.cc.
* resolve/rust-forever-stack.h
(class ForeverStackStore): Add.
* resolve/rust-forever-stack.cc: New file, based on
rust-forever-stack.hxx.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
* ast/rust-collect-lang-items.cc (get_lang_item_attr): "removed checker fn"
* util/rust-attributes.cc (Attributes::is_lang_item): "added fn"
* util/rust-attributes.h: "added fn"
Signed-off-by: Om Swaroop Nayak <96killerat96@gmail.com>
|
|
This ensures that we handle var decls readonly checks much better
Addresses: Rust-GCC#807 Rust-GCC#3287
gcc/rust/ChangeLog:
* checks/errors/rust-readonly-check.cc (check_decl): improve mut check
(emit_error): helper
(check_modify_expr): likewise
(readonly_walk_fn): reuse helper
(ReadonlyCheck::Lint): cleanup context each run
gcc/testsuite/ChangeLog:
* rust/execute/torture/builtin_macro_include_bytes.rs: needs mut
* rust/compile/mutability_checks1.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): When visiting a TraitImpl, visit its
trait path.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove entries.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|