Age | Commit message (Collapse) | Author | Files | Lines |
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): Add a catch for const/static.
gcc/testsuite/ChangeLog:
* rust/compile/loop_constant_context.rs: New test.
* rust/compile/issue-3618.rs:
Signed-off-by: lishin <lishin1008@gmail.com>
|
|
scrutinee
Example GIMPLE output from compiling testsuite/rust/compile/match-pattern-array.rs:
...
a[0] = 0;
a[1] = 1;
RUSTTMP.3 = a;
_1 = RUSTTMP.3[0];
_2 = _1 == 0;
_3 = RUSTTMP.3[1];
_4 = _3 == 1;
_5 = _2 & _4;
if (_5 != 0) goto <D.122>; else goto <D.123>;
<D.122>:
{
{
}
}
goto <D.117>;
}
<D.123>:
...
gcc/rust/ChangeLog:
* rust-backend.h: New size_constant_expression function.
* rust-gcc.cc: Implementation of size_constant_expression function to generate tree node
for array access.
* backend/rust-compile-pattern.h: Remove empty visits for SlicePattern.
* backend/rust-compile-pattern.cc: Implement SlicePattern check expression & binding
compilation against ArrayType scrutinee.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-pattern.cc(TypeCheckPattern::visit(SlicePattern)):
Implement size checking for SlicePattern when type checking against array parent
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
We have more complex test cases already but this will close out this issue.
Fixes Rust-GCC#2005
gcc/testsuite/ChangeLog:
* rust/execute/torture/issue-2005.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* util/rust-attribute-values.h: Add declarations for them.
* util/rust-attributes.cc: Add definitions.
|
|
Fixes Rust-GCC#1048
gcc/testsuite/ChangeLog:
* rust/compile/issue-1048.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Fixes Rust-GCC#3144
gcc/testsuite/ChangeLog:
* rust/compile/issue-3144.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Fixes Rust-GCC#3599
gcc/testsuite/ChangeLog:
* rust/compile/issue-3599.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
We just had a typo returning ok true when it should have been false.
Fixes Rust-GCC#3876
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::visit): fix typo
gcc/testsuite/ChangeLog:
* rust/compile/issue-3876.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
This case:
let i = 1;
let j = i as i64;
'i' is meant to default to i32 but the inference was making both of these
i64 because the code was prefering coercion logic which can end up with a
default unify which causes the ?integer to unify with i64 making them both
i64.
But all we need to do is allow the simple cast rules to run first then
fallback to coercions but special consideration has to be made to ensure
that if there are dyn objects needed then this needs a unsize coercion, but
also we need to ensure the underlying types are a valid simple cast too
otherwise these also need to fallback to the coercion code.
Fixes Rust-GCC#2680
gcc/rust/ChangeLog:
* typecheck/rust-casts.cc (TypeCastRules::resolve): optional emit_error flag
(TypeCastRules::check): try the simple cast rules then fallback to coercions
(TypeCastRules::check_ptr_ptr_cast): ensure the underlying's
(TypeCastRules::emit_cast_error): make this a static helper
* typecheck/rust-casts.h: new emit_error prototype
gcc/testsuite/ChangeLog:
* rust/compile/issue-2680.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Check for a label
before visiting it.
|
|
This was a nasty issue to debug, the issue was very eager type bounds
checking. So for example:
pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs>
The super trait of PartialEq<Rhs> is a generic substitution and we reuse
our bounds code here for normal generic bounds and generics an invalid
bounds check was occuring when PartialEq<Rhs> was getting substituted becase
this is a trait doing proper bounds checking is not valid here because this
is telling us about the bounds in this case.
Fixes Rust-GCC#3836
gcc/rust/ChangeLog:
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): track is super trait
* typecheck/rust-hir-type-bounds.h: refactor bounds scan
* typecheck/rust-hir-type-check-base.h: track from super trait
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::is_bound_satisfied_for_type): refactor
(TypeBoundsProbe::scan): likewise
(TypeBoundPredicate::apply_generic_arguments): likewise
* typecheck/rust-tyty-subst.cc: optional bounds checking on parm subst
* typecheck/rust-tyty-subst.h: likewise
* typecheck/rust-tyty.h: likewise
gcc/testsuite/ChangeLog:
* rust/compile/derive_partial_ord1.rs: this is now fully supported
* rust/execute/torture/basic_partial_ord1.rs: add missing i32 impl
* rust/execute/torture/basic_partial_ord2.rs: likewise
* rust/compile/issue-3836.rs: New test.
* rust/execute/torture/issue-3836.rs: New test.
* rust/execute/torture/partial-ord-6.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Fix narrowing:
-../../gcc/rust/checks/errors/borrowck/rust-borrow-checker-diagnostics.cc:145:46:
warning: narrowing conversion of ‘loan’ from ‘Rust::Polonius::Loan’ {aka
‘long unsigned int’} to ‘uint32_t’ {aka ‘unsigned int’} [-Wnarrowing]
gcc/rust/ChangeLog:
* checks/errors/borrowck/rust-bir-place.h (LoanId::value): Make
it size_t to match Loan's base type.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
|
|
This change is made to ensure that LiteralPatterns in SlicePattern are type-checked
against the scrutinee array/slice's element type properly.
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-pattern.cc(TypeCheckPattern::visit(LiteralPattern)):
Check LiteralPattern's type against its parent.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
This commit implements basic type checking support for SlicePattern, based on rustc's
check_pat_slice function.
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit(SlicePattern)):
Implement initial type checking for SlicePattern.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
This is an invalid test case but we just need a guard for the missing
borrow expression.
Fixes Rust-GCC#3874
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): check for missing borrow
* ast/rust-expr.h: add helper
gcc/testsuite/ChangeLog:
* rust/compile/issue-3874.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
This patch adds proper folding to the const expression for array capacity we
already have the const folding mechanics and the query system needed to handle cases
where the capacity is a function call in a const context. This leverages and pulls the
gcc tree capacity into the TyTy::ArrayType so it can be used for more typechecking and
eventually doing more const generics work.
Addresses Rust-GCC#3885
Fixes Rust-GCC#3882
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc (HIRCompileBase::query_compile_const_expr): new wrapper
* backend/rust-compile-base.h: add prototype
* backend/rust-compile-context.cc (Context::get): singleton helper
* backend/rust-compile-context.h: likewise
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): handle infer's that can default
* rust-session-manager.cc (Session::compile_crate): create the gcc context earlier for tychk
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): const fold it
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise
* typecheck/rust-tyty.cc (BaseType::monomorphized_clone): fix constructor call
(ArrayType::as_string): print capacity
(ArrayType::clone): fix constructor call
* typecheck/rust-tyty.h: track capacity
* typecheck/rust-unify.cc (UnifyRules::expect_array): check the capacities
gcc/testsuite/ChangeLog:
* rust/compile/all-cast.rs: shows array capacity now
* rust/compile/arrays2.rs: likewise
* rust/compile/const3.rs: fix error message
* rust/compile/const_generics_3.rs: disable until typecheck we get proper errors now!
* rust/compile/usize1.rs: proper capacity error message
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): New visitor.
* resolve/rust-late-name-resolver-2.0.h: Declare it.
* resolve/rust-name-resolution-context.h (enum class): New binding context.
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Check that the WhileLet has a label
before visiting it.
gcc/testsuite/ChangeLog:
* rust/compile/while_let_without_label.rs: New test.
|
|
This doesn't do anything beyond creating TryExpr and parsing them, so
try expressions shouldn't be able to make it past AST lowering yet.
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): Add visitor
for TryExpr.
* ast/rust-ast-collector.h (TokenCollector::visit): Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast-visitor.h (ASTVisitor::visit): Likewise.
(DefaultASTVisitor::visit): Likewise.
* expand/rust-derive.h (DeriveVisitor::visit): Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h (ASTLoweringBase::visit): Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit):
Likewise.
* resolve/rust-ast-resolve-base.h (ResolverBase::visit):
Likewise.
* ast/rust-ast-full-decls.h (class TryExpr): New forward class
declaration.
* ast/rust-ast.cc (TryExpr::as_string): New function.
(TryExpr::accept_vis): Likewise.
* ast/rust-expr.h (class TryExpr): New class.
* parse/rust-parse.h (Parser::parse_try_expr): New function.
* parse/rust-parse-impl.h (Parser::parse_try_expr): Likewise.
(Parser::null_denotation_not_path): Use parse_try_expr to parse
try expressions.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* expand/rust-macro-builtins-format-args.cc
(format_args_parse_arguments): Accept a RAW_STRING_LITERAL token
as the first argument.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h: Add enum prefix.
* parse/rust-parse.h (enum ParseSelfError): Change from enum...
(enum class): To enum class.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Replace
usages of reinterpret_cast with static_cast.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
DefaultResolver already handles StructStruct in a more correct fashion.
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Remove
override for StructStruct visitor.
* resolve/rust-late-name-resolver-2.0.h (Late::visit): Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This is the first patch in a set intended to fully remove name
resolution 1.0. As such, it should leave name resolution 1.0 technically
available but broken.
gcc/rust/ChangeLog:
* backend/rust-compile-context.cc (Context::Context): Remove
initialization of resolver field.
* backend/rust-compile-context.h (Context::get_resolver): Remove
function.
(Context::resolver): Remove field.
* backend/rust-compile-expr.cc (CompileExpr::visit): Assume name
resolution 2.0 is always enabled.
(CompileExpr::generate_closure_function): Likewise.
* backend/rust-compile-implitem.cc (CompileTraitItem::visit):
Likewise.
* backend/rust-compile-item.cc (CompileItem::visit): Likewise.
* backend/rust-compile-resolve-path.cc
(ResolvePathRef::resolve): Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/testsuite/ChangeLog:
* rust/compile/additional-trait-bounds2nr2.rs: Remove
-frust-name-resolution-2.0 usage.
* rust/compile/const_generics_3.rs: Likewise.
* rust/compile/enum_variant_name.rs: Likewise.
* rust/compile/generics9.rs: Likewise.
* rust/compile/invalid_label_name.rs: Likewise.
* rust/compile/issue-3304.rs: Likewise.
* rust/compile/macros/mbe/macro-issue3708.rs: Likewise.
* rust/compile/macros/mbe/macro-issue3709-2.rs: Likewise.
* rust/compile/name_resolution10.rs: Likewise.
* rust/compile/name_resolution11.rs: Likewise.
* rust/compile/name_resolution12.rs: Likewise.
* rust/compile/name_resolution13.rs: Likewise.
* rust/compile/name_resolution14.rs: Likewise.
* rust/compile/name_resolution15.rs: Likewise.
* rust/compile/name_resolution16.rs: Likewise.
* rust/compile/name_resolution17.rs: Likewise.
* rust/compile/name_resolution18.rs: Likewise.
* rust/compile/name_resolution20.rs: Likewise.
* rust/compile/name_resolution22.rs: Likewise.
* rust/compile/name_resolution23.rs: Likewise.
* rust/compile/name_resolution24.rs: Likewise.
* rust/compile/name_resolution25.rs: Likewise.
* rust/compile/name_resolution6.rs: Likewise.
* rust/compile/name_resolution7.rs: Likewise.
* rust/compile/name_resolution8.rs: Likewise.
* rust/compile/name_resolution9.rs: Likewise.
* rust/compile/nested_macro_definition.rs: Likewise.
* rust/compile/pub_restricted_1.rs: Likewise.
* rust/compile/pub_restricted_2.rs: Likewise.
* rust/compile/self-in-impl.rs: Likewise.
* rust/compile/self_import_namespace.rs: Likewise.
* rust/compile/use_1.rs: Likewise.
* rust/compile/xfail/name_resolution21.rs: Likewise.
* rust/execute/torture/name_resolution.rs: Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* lang.opt (frust-name-resolution-2.0): Enable by default.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/compile.exp: Removed.
* rust/compile/nr2/exclude: Removed.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Example GIMPLE output of the match statement for match-restpattern-tuple-1.rs:
...
RUSTTMP.2 = x;
_1 = RUSTTMP.2.__0;
_2 = _1 == 1;
_3 = RUSTTMP.2.__3;
_4 = _3 == 4;
_5 = _2 & _4;
if (_5 != 0) goto <D.109>; else goto <D.110>;
<D.109>:
{
{
}
goto <D.104>;
}
<D.110>:
if (1 != 0) goto <D.111>; else goto <D.112>;
<D.111>:
{
{
}
goto <D.104>;
}
<D.112>:
<D.104>:
...
gcc/rust/ChangeLog:
* backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit(TuplePattern)):
Implement check expression compilation for TuplePatternItems::RANGED.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-pattern.cc (visit(TuplePattern)): Fix
incorrect logic for field size checking.
gcc/testsuite/ChangeLog:
* rust/compile/tuple_mismatch.rs: Include RestPattern in test.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-builder.cc: Remove extra include, fix new formatting.
|
|
gcc/rust/ChangeLog:
* ast/rust-ast.h (reconstruct_vec): Pre-allocate size of vector.
|
|
gcc/rust/ChangeLog:
* Make-lang.in: Remove object file for ASTTypeBuilder.
* ast/rust-ast-builder.h: Remove function.
* ast/rust-ast-builder.cc (Builder::new_type): Likewise.
(Builder::new_const_param): Use reconstruct_type() instead.
(Builder::new_generic_args): Likewise.
* expand/rust-derive-default.cc (DeriveDefault::visit_struct): Likewise.
(DeriveDefault::visit_tuple): Likewise.
* expand/rust-derive-eq.cc (DeriveEq::visit_tuple): Likewise.
(DeriveEq::visit_struct): Likewise.
(DeriveEq::visit_enum): Likewise.
(DeriveEq::visit_union): Likewise.
* ast/rust-ast-builder-type.cc: Removed.
* ast/rust-ast-builder-type.h: Removed.
|
|
gcc/rust/ChangeLog:
* ast/rust-ast.h: Add reconstruct() and reconstruct_impl() for Type nodes.
* ast/rust-type.h: Implement them.
* ast/rust-macro.h: Likewise.
* ast/rust-path.h: Likewise.
|
|
gcc/rust/ChangeLog:
* ast/rust-ast.h (reconstruct): New function for calling the `reconstruct_*_impl` method
and asserting that the new NodeId is different, and then wrap it in a unique_ptr<T>.
(reconstruct_vec): Likewise, but for vectors of unique_ptr<T>
|
|
This prioritizes resolution in the language prelude over resolution as a
module.
gcc/rust/ChangeLog:
* resolve/rust-forever-stack.hxx (ForeverStack::resolve_path):
Resolve final segments which point to modules.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Avoid inserting module names into ribs in the type namespace.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove issue-3315-2.rs.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc
(visit_identifier_as_pattern): Handle is_ref and is_mut.
(Late::visit): Likewise.
* resolve/rust-name-resolution-context.cc
(BindingLayer::insert_ident): Likewise.
(BindingLayer::bind_test): Handle changes to BindingLayer
fields.
(BindingLayer::merge): Likewise and emit more error messages.
* resolve/rust-name-resolution-context.h
(struct IdentifierMode): New.
(Binding::has_expected_bindings): New field.
(Binding::set): Rename field to...
(Binding::idents): ...here and convert from a set to a map.
(Binding::Binding): Initialize has_expected_bindings.
(BindingLayer::insert_ident): Adjust parameters.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove torture/alt_patterns1.rs.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-expr.h: Add getter to locus field.
* ast/rust-pattern.h (tokenid_to_rangekind): Likewise.
* hir/tree/rust-hir-item.h: Likewise.
* hir/tree/rust-hir-visibility.h: Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
This ensures Session::load_extern_crate doesn't try to use the old name
resolver when nr2.0 is enabled, while also ensuring that nr2.0 handles
external crates.
gcc/rust/ChangeLog:
* resolve/rust-default-resolver.cc
(DefaultResolver::visit_extern_crate): New function.
(DefaultResolver::visit): New visitor function for ExternCrate.
* resolve/rust-default-resolver.h
(DefaultResolver::visit_extern_crate): New function.
(DefaultResolver::visit): New visitor function for ExternCrate.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Adjust ExternCrate visitor and rename to...
(TopLevel::visit_extern_crate): ...here.
* resolve/rust-toplevel-name-resolver-2.0.h (TopLevel::visit):
Remove ExternCrate visitor override.
(TopLevel::visit_extern_crate): New function.
* rust-session-manager.cc (Session::load_extern_crate): Only run
name resolution 1.0 if name resolution 2.0 is disabled.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This patch implements the previously unimplemented type checking for RANGED item
type for TuplePattern, which serves as the start for implementing compilation of
RestPattern.
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit(TuplePattern)):
Implement type checking for ItemType::RANGED.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
gcc/rust/ChangeLog:
* rust-lang.cc: Move version check from C++11 to C++14.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* Make-lang.in: Scaffolding new rust-hir-visitor files
* hir/tree/rust-hir-visitor.h (DefaultHIRVisitor): Declare default HIR visitor
* hir/tree/rust-hir-visitor.cc (DefaultHIRVisitor): Define default HIR visitor
Signed-off-by: Ryutaro Okada <1015ryu88@gmail.com>
|
|
This should make it easier for us to hand identifiers off to the
back end.
gcc/rust/ChangeLog:
* Make-lang.in (GRS_OBJS): Add rust-ggc.o.
* backend/rust-compile-base.cc
(HIRCompileBase::compile_function): Adjust call to
Backend::function.
(HIRCompileBase::compile_constant_item): Likewise and adjust
initialization of Backend::typed_identifier.
* backend/rust-compile-expr.cc (CompileExpr::visit): Adjust call
to Backend::label.
* backend/rust-compile-type.cc (TyTyResolveCompile::visit):
Adjust initialization of Backend::typed_identifier.
* rust-backend.h: Add includes.
(Backend::GGC::Ident): Use Rust::GGC::Ident.
(struct typed_identifier): Store name as a GGC::Ident rather
than a std::string and adjust constructors.
(named_type): Take GGC::Ident/tl::optional<GGC::Ident> rather
than std::string.
(global_variable): Likewise.
(local_variable): Likewise.
(parameter_variable): Likewise.
(static_chain_variable): Likewise.
(label): Likewise.
(function): Likewise.
* rust-gcc.cc (named_type): Likewise.
(global_variable): Likewise.
(local_variable): Likewise.
(parameter_variable): Likewise.
(static_chain_variable): Likewise.
(label): Likewise.
(function): Likewise.
(function_defer_statement): Adjust call to Backend::label.
(get_identifier_from_string): Remove function.
(fill_in_fields): Handle adjustments to typed_identifier.
* util/rust-ggc.cc: New file.
* util/rust-ggc.h: New file.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* hir/tree/rust-hir-item.h (SelfParam::get_lifetime): Add getter
for non const lifetime object
Signed-off-by: Ryutaro Okada <1015ryu88@gmail.com>
|
|
gcc/rust/ChangeLog:
* hir/tree/rust-hir-expr.h (MatchArm::get_outer_attrs): Add getter for outer attributions
Signed-off-by: Ryutaro Okada <1015ryu88@gmail.com>
|
|
gcc/testsuite/ChangeLog:
* rust/compile/macros/builtin/recurse2.rs: Match "abheyho\0" as
well as "abheyho", to handle slight differences in assembly
output for null-terminated strings.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
There was a sily bug where if you reorder this test case to declare A before B
this test would work but its meant to work in any order. So this fixes the bug
during code gen to fall back to our query compile system if this is needed.
Fixes Rust-GCC#3525
gcc/rust/ChangeLog:
* backend/rust-compile-resolve-path.cc: if this fails fall back to query compile
gcc/testsuite/ChangeLog:
* rust/compile/issue-3525.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Closure calls are not const so this is invalid. This patch fixes two bugs
1. Make the look at the parent context optional for generics
2. Ensure we look for non const calls during call expr code-gen
Fixes Rust-GCC#3551
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): add const call check
* backend/rust-compile-item.cc (CompileItem::visit): ensure we upfront compile types where
possible
* backend/rust-compile-item.h: update header
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): make parent ctx optional
gcc/testsuite/ChangeLog:
* rust/compile/issue-3551.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Code for TupleStructPattern compilation previously only assumes that it is derived from
an enum. This commit adds a check for that, and compiles non-enum TupleStructPatterns
similarly to TuplePatterns if it is not an enum.
gcc/rust/ChangeLog:
* backend/rust-compile-pattern.cc(CompilePatternCheckExpr::visit(TupleStructPattern)):
Fix error thrown when compiling non-enum TupleStructPattern.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-default-resolver.cc (DefaultResolver::visit):
Call DefaultASTVisitor::visit even on ConstantItem instances
without expressions.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove issue-3642.rs.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Its valid to unify a closure to an fnptr as we are working on the
fn traits. There are still other issues but this is part of the patch set.
gcc/rust/ChangeLog:
* typecheck/rust-unify.cc (UnifyRules::expect_fnptr): add unify rules
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|