Age | Commit message (Collapse) | Author | Files | Lines |
|
This patch adds support for raw references which enforce the pointer
type away from a reference type.
Fixes Rust-GCC#3667
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc (HIRCompileBase::address_expression): allow optional type
* backend/rust-compile-base.h: update prototype
* backend/rust-compile-expr.cc (CompileExpr::visit): update borrow expr
* backend/rust-compile-extern.h: remove unused debug
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): update usage
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): lower raw ref
* hir/tree/rust-hir-expr.cc (BorrowExpr::BorrowExpr): add flag for raw ref
* hir/tree/rust-hir-expr.h (class BorrowExpr): add new raw ref field
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): add handle for raw ref
gcc/testsuite/ChangeLog:
* rust/compile/issue-3667.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
We need to check for error_mark_node when doing adjustments from coercion
sites otherwise we hit assetions as part of the coercion. That fixes the
ICE but the reason for the error_mark_node is because the array element
value.
Fixes Rust-GCC#3567
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::array_value_expr): add value chk for array expr
gcc/testsuite/ChangeLog:
* rust/compile/issue-3567.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
When we have paths such as Try::from_error the Try references the Trait
and then from_error references the from_error trait item. So this resolves
directly to a trait implementation which has the type:
fn <Self> (v: placeholder) -> Self
Remember that a path such as: Try::from_error gets handled by doing a
clever substitution: <T? as Try>::from_error
The main piece here is that we resolve this function type and for
monomoprhization we know this is a trait call but we know that all trait's
have an implicit Self type param which in this case is Result<i32, i32>
so when it comes to knowing which impl block this is we got rid of the old
bad insert/lookup receiver hack and use the specified type to know which
impl block we are talking about to generate the function.
The hard part here is inside rust-compil-item.cc, where we have the
'concete' type which is the trait item fntype of:
fn <Result<i32, i32>> (v : i32) -> Result<i32,i32>
This does not really match the signiture of the impl item for Result
which is:
fn <T, E> (v: i32) -> Result<T, E>
So what we need to do is actually infer this by inputing inference
variables on the impl fntype then unify'ing the trait object to this to
compute the types of this to monomorphize this.
Fixes Rust-GCC#3381
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): remove receiver interface
* backend/rust-compile-item.cc (CompileItem::visit): monomorphize trait to impl item
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): use trait item Self
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): remove receiver interface
(TypeCheckExpr::resolve_fn_trait_call): likewise
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): likewise
(TypeCheckExpr::resolve_segments): likewise
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise
* typecheck/rust-hir-type-check.h: likewise
* typecheck/rust-typecheck-context.cc (TypeCheckContext::insert_receiver): remove
(TypeCheckContext::lookup_receiver): remove
gcc/testsuite/ChangeLog:
* rust/execute/torture/issue-3381.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc
(CompileExpr::generate_closure_function): Take
NameResolutionContext by reference instead of by value.
* backend/rust-compile-item.cc
(CompileItem::visit): Likewise.
* backend/rust-compile-resolve-path.cc
(ResolvePathRef::resolve): Likewise.
* checks/lints/rust-lint-marklive.cc
(MarkLive::find_ref_node_id): Likewise.
* typecheck/rust-hir-type-check-enumitem.cc
(TypeCheckEnumItem::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.cc
(TypeCheckImplItem::visit): Likewise.
* typecheck/rust-hir-type-check-item.cc
(TypeCheckItem::visit): Likewise.
* typecheck/rust-hir-type-check-path.cc
(TypeCheckExpr::resolve_root_path): Likewise.
* typecheck/rust-hir-type-check-type.cc
(TypeCheckType::resolve_root_path): Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This will be crucial for more complex gimple debugging to make it easier
to follow the code vs the original rust code.
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): disable overflow checks
* lang.opt: new flag
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (check_match_scrutinee): Allow anything to be used as a
match scrutinee, not just ADTs.
|
|
Unify rules are not the same as coercion rules. The coercion of ! is
allowed to any type but not for a unify site which is different.
Match arms are another least upper bound coercion.
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): implement coercion
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): this is an LUB
* typecheck/rust-unify.cc (UnifyRules::go): remove unify ! coercion
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
This changes our enum type layout so for example:
enum Foo {
A,
B,
C(char),
D { x: i32, y: i32 },
}
Used to get layed out like this in gccrs:
union {
struct A { int RUST$ENUM$DISR; };
struct B { int RUST$ENUM$DISR; };
struct C { int RUST$ENUM$DISR; char __0; };
struct D { int RUST$ENUM$DISR; i64 x; i64 y; };
}
This has some issues notably with the constexpr because this is just a
giant union it means its not simple to constify what enum variant we are
looking at because the discriminant is a mess.
This now gets layed out as:
struct {
int RUST$ENUM$DISR;
union {
struct A { };
struct B { };
struct C { char __0; };
struct D { i64 x; i64 y; };
} payload;
}
This layout is much cleaner and allows for our constexpr to work properly.
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): new layout
* backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit): likewise
(CompilePatternBindings::visit): likewise
* backend/rust-compile-resolve-path.cc: likewise
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): implement new layout
* rust-gcc.cc (constructor_expression): get rid of useless assert
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
The Eq and Partial Ord are very similar to the operator overloads
we support for add/sub/etc... but they differ in that usually the
function call name matches the name of the lang item. This time
we need to have support to send in a new path for the method call
on the lang item we want instead of just the name of the lang item.
NOTE: this test case doesnt work correctly yet we need to support
the derive of partial eq on enums to generate the correct comparison
code for that.
Fixes Rust-GCC#3302
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): handle partial_eq possible call
* backend/rust-compile-expr.h: handle case where lang item calls differ from name
* hir/tree/rust-hir-expr.cc (OperatorExprMeta::OperatorExprMeta): new helper
* hir/tree/rust-hir-expr.h: likewise
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): handle partial_eq
(TypeCheckExpr::resolve_operator_overload): likewise
* typecheck/rust-hir-type-check-expr.h: likewise
* util/rust-lang-item.cc (LangItem::ComparisonToLangItem): map comparison to lang item
(LangItem::ComparisonToSegment): likewise
* util/rust-lang-item.h: new lang items PartialOrd and Eq
* util/rust-operators.h (enum class): likewise
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: nr2 cant handle this
* rust/compile/cmp1.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
This is a special case in Rust and the ! type can unify with pretty much
anything its almost a inference variable and a unit-type for special cases.
Fixes Rust-GCC/gccrs#3231
Fixes Rust-GCC/gccrs#2567
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (check_match_scrutinee): check for empty match
(CompileExpr::visit): fix assertion
* checks/errors/rust-hir-pattern-analysis.cc (check_match_usefulness): check for empty
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): resolve to !
gcc/testsuite/ChangeLog:
* rust/compile/exhaustiveness1.rs: remove bad check
* rust/compile/issue-2567-1.rs: New test.
* rust/compile/issue-2567-2.rs: New test.
* rust/compile/issue-2567-3.rs: New test.
* rust/compile/issue-3231.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
System includes shall use rust-system header instead.
gcc/rust/ChangeLog:
* ast/rust-stmt.h: Remove stdlib include and use rust-system instead.
* backend/rust-compile-expr.cc: Likewise.
* backend/rust-mangle-legacy.cc: Likewise.
* backend/rust-mangle-v0.cc: Likewise.
* hir/rust-hir-dump.cc: Likewise.
* typecheck/rust-hir-type-check-type.cc: Likewise.
* typecheck/rust-tyty.cc: Likewise.
* typecheck/rust-tyty.h: Likewise.
* util/rust-common.h: Likewise.
* util/rust-token-converter.cc: Likewise.
* util/rust-token-converter.h: Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): Change call.
(CompileExpr::resolve_operator_overload): Update function arguments.
* backend/rust-compile-expr.h: Change the function's prototype to use
a reference wrapper instead of a reference within the optional.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
A variant being moved lead to a null being created and a segfault later
down the line.
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): Call getter
instead of size function.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit):
Only check privacy if the type is present.
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Use an optional.
* hir/tree/rust-hir-generic-param.h: Assert type before getting it.
* hir/tree/rust-hir-item.h: Assert pointers before dereference, fix
has_type condition.
* hir/tree/rust-hir-path.h: Add more assertions.
* hir/tree/rust-hir-stmt.cc: Change constructor with optionals.
* hir/tree/rust-hir-stmt.h: Use optionals over smart pointers to
emphasize these fields might be missing.
* hir/tree/rust-hir.cc (LetStmt::as_string): Use getters.
* typecheck/rust-hir-type-check-expr.cc: Clone structures to prevent
parent's fields from being nulled by the move operation.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Use
optionals.
* typecheck/rust-tyty.cc: Likewise.
* typecheck/rust-tyty.h: Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
The HIR made heavy use of pair and other unamed types which can be
difficult to read.
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc: Use FnParam getter.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* backend/rust-compile-intrinsic.cc: Likewise.
* backend/rust-compile-type.cc: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit):
Only visit childrens if not missing.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Use
a reference instead of a raw pointer.
* hir/tree/rust-hir-expr.h: Add presence function for return
expression.
* hir/tree/rust-hir-item.h: Remove take_param_name.
* hir/tree/rust-hir.h: Make mapping getter const.
* typecheck/rust-hir-dot-operator.cc (MethodResolver::Select): Use
getter.
* typecheck/rust-hir-type-check-expr.cc: Likewise.
* typecheck/rust-hir-type-check-implitem.cc: Use FnParam vector instead
of std::pair of Pattern and BaseType.
* typecheck/rust-hir-type-check-item.cc: Likewise.
* typecheck/rust-hir-type-check.cc: Likewise.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Use getters.
(TypeCheckMethodCallExpr::check): Likewise.
* typecheck/rust-tyty-cmp.h: Likewise.
* typecheck/rust-tyty.cc: Use FnParam.
* typecheck/rust-tyty.h (class FnParam): Add FnParam to handle function
parameters instead of handling std::pairs.
* typecheck/rust-unify.cc (UnifyRules::expect_fndef): Use getters.
(UnifyRules::expect_fnptr): Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Attempt to use references and smart pointers whenever possible.
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc (HIRCompileBase::compile_function_body):
Remove usage of get function to retrieve a raw pointer.
* backend/rust-compile-base.h:
Change API usage from raw pointer to a reference.
* backend/rust-compile-block.cc (CompileBlock::compile): Likewise.
(CompileBlock::visit): Likewise.
(CompileConditionalBlocks::visit): Likewise.
* backend/rust-compile-block.h: Likewise.
* backend/rust-compile-expr.cc (CompileExpr::Compile): Likewise.
(CompileExpr::visit): Likewise.
(check_match_scrutinee): Likewise.
(CompileExpr::array_value_expr): Likewise.
(CompileExpr::array_copied_expr): Likewise.
(CompileExpr::generate_closure_function): Likewise.
(CompileExpr::generate_possible_fn_trait_call): Likewise.
* backend/rust-compile-expr.h: Likewise.
* backend/rust-compile-fnparam.cc (CompileFnParam::compile): Likewise.
(CompileFnParam::visit): Likewise.
* backend/rust-compile-fnparam.h: Likewise.
* backend/rust-compile-implitem.cc (CompileTraitItem::visit): Likewise.
* backend/rust-compile-intrinsic.cc (compile_fn_params): Likewise.
* backend/rust-compile-item.cc (CompileItem::visit): Likewise.
* backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit):
Likewise.
(compile_range_pattern_bound): Likewise.
(CompilePatternBindings::visit): Likewise.
(CompilePatternLet::visit): Likewise.
* backend/rust-compile-pattern.h: Likewise.
* backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve):
Likewise.
(HIRCompileBase::query_compile): Likewise.
* backend/rust-compile-stmt.cc (CompileStmt::visit): Likewise.
* backend/rust-compile-struct-field-expr.cc (CompileStructExprField::Compile):
Likewise.
(CompileStructExprField::visit): Likewise.
* backend/rust-compile-struct-field-expr.h: Likewise.
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Likewise.
* backend/rust-compile-var-decl.h: Likewise.
* backend/rust-compile.cc: Likewise.
* backend/rust-mangle-v0.cc (v0_inherent_or_trait_impl_path): Likewise.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
Likewise.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-pattern.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-struct.h: Likewise.
* checks/errors/borrowck/rust-bir-builder.h: Likewise.
* checks/errors/borrowck/rust-function-collector.h: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_type_privacy):
Likewise.
(PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* checks/errors/privacy/rust-reachability.cc (ReachabilityVisitor::visit):
Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit):
Likewise.
* checks/lints/rust-lint-marklive.cc (MarkLive::visit): Likewise.
* checks/lints/rust-lint-marklive.h: Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
* hir/tree/rust-hir-item.h: Likewise.
* hir/tree/rust-hir-path.h: Likewise.
* hir/tree/rust-hir-pattern.h: Likewise.
* hir/tree/rust-hir-stmt.h: Likewise.
* hir/tree/rust-hir-type.h: Likewise.
* hir/tree/rust-hir.h: Likewise.
* typecheck/rust-autoderef.cc: Likewise.
* typecheck/rust-hir-dot-operator.cc (MethodResolver::select):
Likewise.
* typecheck/rust-hir-inherent-impl-overlap.h: Likewise.
* typecheck/rust-hir-path-probe.cc (PathProbeType::process_impl_item_candidate):
Likewise.
(PathProbeImplTrait::process_trait_impl_items_for_candidates): Likewise.
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait):
Likewise.
(TraitItemReference::resolve_item): Likewise.
* typecheck/rust-hir-type-check-base.cc: Likewise.
* typecheck/rust-hir-type-check-base.h: Likewise.
* typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::Resolve):
Likewise.
(TypeCheckEnumItem::visit): Likewise.
* typecheck/rust-hir-type-check-enumitem.h: Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::Resolve):
Likewise.
(TypeCheckExpr::visit): Likewise.
(TypeCheckExpr::resolve_fn_trait_call): Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::Resolve):
Likewise.
(TypeCheckTopLevelExternItem::visit): Likewise.
(TypeCheckImplItem::visit): Likewise.
(TypeCheckImplItemWithTrait::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.h: Likewise.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Likewise.
(TypeCheckItem::resolve_impl_item): Likewise.
(TypeCheckItem::resolve_impl_block_substitutions): Likewise.
(TypeCheckItem::resolve_impl_block_self): Likewise.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit): Likewise.
(TypeCheckExpr::resolve_segments): Likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::Resolve):
Likewise.
(TypeCheckPattern::visit): Likewise.
(ClosureParamInfer::Resolve): Likewise.
(ClosureParamInfer::visit): Likewise.
* typecheck/rust-hir-type-check-pattern.h: Likewise.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::Resolve):
Likewise.
(TypeCheckStmt::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.h: Likewise.
* typecheck/rust-hir-type-check-struct-field.h: Likewise.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::TypeCheckStructExpr):
Likewise.
(TypeCheckStructExpr::Resolve): Likewise.
(TypeCheckStructExpr::resolve): Likewise.
(TypeCheckStructExpr::visit): Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckResolveGenericArguments::resolve):
Likewise.
(TypeCheckType::Resolve): Likewise.
(TypeCheckType::visit): Likewise.
(TypeCheckType::resolve_root_path): Likewise.
(TypeResolveGenericParam::Resolve): Likewise.
(TypeResolveGenericParam::visit): Likewise.
(ResolveWhereClauseItem::visit): Likewise.
* typecheck/rust-hir-type-check-type.h: Likewise.
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn):
Likewise.
* typecheck/rust-hir-type-check.h: Likewise.
* typecheck/rust-type-util.cc (query_type): Likewise.
* typecheck/rust-typecheck-context.cc (TypeCheckContextItem::TypeCheckContextItem):
Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Likewise.
(TypeCheckBase::get_predicate_from_bound): Likewise.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise.
(TypeCheckMethodCallExpr::go): Likewise.
(TypeCheckMethodCallExpr::check): Likewise.
* typecheck/rust-tyty-subst.cc: Likewise.
* typecheck/rust-tyty.cc (BaseType::monomorphized_clone): Likewise.
(VariantDef::VariantDef): Remove copy constructor.
(VariantDef::operator=): Change to move operator.
(VariantDef::get_discriminant): Replace return type to a reference
instead of a reference to a unique pointer.
(VariantDef::clone): Change to references.
(VariantDef::monomorphized_clone): Likewise.
(FnType::as_string): Likewise.
(FnType::clone): Likewise.
* typecheck/rust-tyty.h: Likewise.
* util/rust-hir-map.cc (Mappings::insert_hir_impl_block): Likewise.
* backend/rust-compile-asm.cc: Use a reference instead of the raw
pointer value.
* checks/errors/borrowck/rust-bir-builder-pattern.cc: Use references.
* checks/errors/rust-hir-pattern-analysis.cc: Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc
(CompileExpr::visit): Use name resolver 2.0 to lookup label
definitions for break and continue statements when name
resolution 2.0 is enabled.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
early
Fixes gccrs#3141.
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc
Signed-off-by: Joan Vilardaga <github-91yu@joanvc.cat>
|
|
Fixes gccrs#3141.
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc: Fix range checking for both integers and floats.
* hir/tree/rust-hir-expr.h: Add "negative_number" boolean to LiteralExpr class.
gcc/testsuite/ChangeLog:
* rust/compile/issue-3141.rs: New test.
Signed-off-by: Joan Vilardaga <github-91yu@joanvc.cat>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-asm.cc (CompileAsm::visit):
Change API, public/private, comments, formatting from code
review
(CompileAsm::asm_build_expr): Likewise.
(CompileAsm::tree_codegen_asm): Likewise.
* backend/rust-compile-asm.h (class CompileAsm): Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise.
* expand/rust-macro-builtins-asm.cc (strip_double_quotes): Likewise.
(parse_options): Likewise.
(parse_asm_arg): Likewise.
(expand_inline_asm_strings): Likewise.
(parse_asm): Likewise.
* expand/rust-macro-builtins-asm.h (strip_double_quotes): Likewise.
(expand_inline_asm_strings): Likewise.
(expand_inline_asm_string): Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
gcc/testsuite/ChangeLog:
* rust/compile/inline_asm_typecheck.rs: Change comments
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-asm.cc (CompileAsm::add_stmt):
Deleted
(CompileAsm::CompileAsm):
Successfully produce pseudo-nop
(CompileAsm::visit): Likewise
(CompileAsm::asm_build_asm_stmt): Likewise
(CompileAsm::asm_construct_string_tree): Likewise
(CompileAsm::asm_is_inline): Likewise
* backend/rust-compile-asm.h (class CompileAsm): Likewise
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-asm.cc (CompileAsm::add_stmt):
Scaffolding code.
(CompileAsm::asm_build_asm_stmt): Likewise.
(CompileAsm::asm_build_expr): Likewise.
(CompileAsm::asm_construct_string_tree): Likewise.
* backend/rust-compile-asm.h: Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
|
|
gcc/rust/ChangeLog:
* Make-lang.in:
Scaffolding new compile-asm files
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise
* hir/tree/rust-hir-expr.h: Likewise
* backend/rust-compile-asm.cc: New file. Likewise
* backend/rust-compile-asm.h: New file. Likewise
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit):
Setting up interfaces for codegen
* hir/tree/rust-hir-expr.h: Likewise.
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit):
Local testing for build_string and debug()
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-block.h:
Scaffolding asm codegen
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* backend/rust-compile-expr.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Likewise.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
|
|
Optional are more convenient to use and avoid uninitialized data.
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::generate_closure_function):
Adapt code for new optional return type.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_base_type_privacy):
Likewise.
* util/rust-hir-map.cc (Mappings::lookup_hir_to_node): Change return
type to an optional.
* util/rust-hir-map.h: Adapt function prototype with the new return
type.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Previous API was using a boolean and a pointer, this was not practical
and could be replaced with an optional.
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): Change call to use
the returned optional.
(CompileExpr::generate_closure_function): Likewise.
* backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve):
Likewise.
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Likewise.
* backend/rust-mangle-v0.cc (v0_path): Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc:
Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit):
Likewise.
* checks/lints/rust-lint-marklive.cc (MarkLive::visit): Likewise.
(MarkLive::visit_path_segment): Likewise.
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait):
Likewise.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
Likewise.
(ResolveWhereClauseItem::visit): Likewise.
* util/rust-hir-map.cc (Mappings::lookup_node_to_hir): Return an
optional instead of a boolean.
* util/rust-hir-map.h: Change function prototype to match the new
return type.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc
(check_match_scrutinee): Add assertion.
* backend/rust-compile-pattern.cc
(CompilePatternCheckExpr::visit):
Handle HIR::PathInExpression matching a non-enum.
gcc/testsuite/ChangeLog:
* rust/compile/match-struct-path.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (check_match_scrutinee): Handle structs
Signed-off-by: Nobel Singh <nobel2073@gmail.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc
(HIRCompileBase::compile_function_body):
Adjust unit_expression calls.
(HIRCompileBase::unit_expression):
Remove unused Context parameter.
* backend/rust-compile-base.h
(HIRCompileBase::unit_expression): Likewise.
* backend/rust-compile-block.cc
(CompileBlock::visit): Adjust unit_expression calls.
* backend/rust-compile-expr.cc
(CompileExpr::visit): Likewise.
* backend/rust-compile-pattern.cc
(CompilePatternLet::visit): Likewise.
* backend/rust-compile-resolve-path.cc
(ResolvePathRef::attempt_constructor_expression_lookup):
Likewise.
* backend/rust-compile-type.cc
(TyTyResolveCompile::get_implicit_enumeral_node_type):
Remove unused Context parameter.
(TyTyResolveCompile::get_unit_type):
Likewise.
(TyTyResolveCompile::visit):
Adjust get_implicit_enumeral_node_type and get_unit_type calls.
* backend/rust-compile-type.h
(TyTyResolveCompile::get_implicit_enumeral_node_type):
Remove unused Context parameter.
(TyTyResolveCompile::get_unit_type):
Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
We do not need a raw pointer for this singleton,
nor we need having it on the heap through a
smart pointer.
gcc/rust/ChangeLog:
* ast/rust-ast.h: Change dereference from a pointer to a reference
accessor.
* ast/rust-expr.h: Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.h: Likewise.
* ast/rust-pattern.h: Likewise.
* ast/rust-type.h: Likewise.
* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address):
Likewise.
* backend/rust-compile-context.h: Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
(CompileExpr::generate_closure_function): Likewise.
* backend/rust-compile-extern.h: Likewise.
* backend/rust-compile-implitem.cc (CompileTraitItem::visit): Likewise.
* backend/rust-compile-intrinsic.cc (Intrinsics::compile): Likewise.
* backend/rust-compile-item.cc (CompileItem::visit): Likewise.
* backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve):
Likewise.
(HIRCompileBase::query_compile): Likewise.
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Likewise.
(TyTyResolveCompile::create_dyn_obj_record): Likewise.
* backend/rust-compile.cc (HIRCompileBase::coerce_to_dyn_object):
Likewise.
* backend/rust-mangle-v0.cc (v0_path): Likewise.
(v0_mangle_item): Likewise.
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
Likewise.
* checks/errors/privacy/rust-privacy-check.cc (Resolver::resolve):
Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::ConstChecker):
Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::UnsafeChecker):
Likewise.
* checks/lints/rust-lint-marklive-base.h: Likewise.
* checks/lints/rust-lint-marklive.cc (MarkLive::go): Likewise.
(MarkLive::visit): Likewise.
(MarkLive::visit_path_segment): Likewise.
* checks/lints/rust-lint-marklive.h: Likewise.
* checks/lints/rust-lint-scan-deadcode.h: Likewise.
* expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Likewise.
* expand/rust-macro-expand.h (struct MacroExpander): Change mapping
from pointer to a reference.
* expand/rust-proc-macro.cc (BangProcMacro::BangProcMacro): Replace
pointer accessor with reference accessor.
(AttributeProcMacro::AttributeProcMacro): Likewise.
(CustomDeriveProcMacro::CustomDeriveProcMacro): Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_lifetime):
Likewise.
(ASTLoweringBase::lower_loop_label): Likewise.
(ASTLoweringBase::lower_path_expr_seg): Likewise.
(ASTLoweringBase::lower_self): Likewise.
(ASTLoweringBase::handle_lang_item_attribute): Likewise.
(ASTLoweringBase::lower_extern_block): Likewise.
(ASTLoweringBase::lower_macro_definition): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-block.h: Likewise.
* hir/rust-ast-lower-enumitem.h: Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::translate): Likewise.
(ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-extern.h: Likewise.
* hir/rust-ast-lower-implitem.cc (ASTLowerImplItem::translate):
Likewise.
(ASTLowerImplItem::visit): Likewise.
(ASTLowerTraitItem::translate): Likewise.
(ASTLowerTraitItem::visit): Likewise.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::translate): Likewise.
(ASTLoweringItem::visit): Likewise.
(ASTLoweringSimplePath::lower): Likewise.
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::translate):
Likewise.
(ASTLoweringPattern::visit): Likewise.
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::translate): Likewise.
(ASTLoweringStmt::visit): Likewise.
* hir/rust-ast-lower-struct-field-expr.h: Likewise.
* hir/rust-ast-lower-type.cc (ASTLowerTypePath::visit): Likewise.
(ASTLowerQualifiedPathInType::visit): Likewise.
(ASTLoweringType::translate): Likewise.
(ASTLoweringType::visit): Likewise.
(ASTLowerGenericParam::translate): Likewise.
(ASTLowerGenericParam::visit): Likewise.
(ASTLoweringTypeBounds::translate): Likewise.
(ASTLoweringTypeBounds::visit): Likewise.
(ASTLowerWhereClauseItem::translate): Likewise.
(ASTLowerWhereClauseItem::visit): Likewise.
* hir/rust-ast-lower.cc (ASTLowering::go): Likewise.
(ASTLoweringBlock::visit): Likewise.
(ASTLoweringIfBlock::visit): Likewise.
(ASTLoweringIfLetBlock::visit): Likewise.
(ASTLowerStructExprField::visit): Likewise.
(ASTLoweringExprWithBlock::visit): Likewise.
(ASTLowerPathInExpression::visit): Likewise.
(ASTLoweringBase::lower_qual_path_type): Likewise.
(ASTLowerQualPathInExpression::visit): Likewise.
* metadata/rust-export-metadata.cc (ExportContext::emit_trait):
Likewise.
(ExportContext::emit_function): Likewise.
(ExportContext::emit_macro): Likewise.
(PublicInterface::PublicInterface): Likewise.
(PublicInterface::expected_metadata_filename): Likewise.
* metadata/rust-export-metadata.h: Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit):
Likewise.
(ResolveItem::visit): Likewise.
(ResolveExternItem::visit): Likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path):
Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go):
Likewise.
(ResolveTypeToCanonicalPath::visit): Likewise.
* resolve/rust-ast-resolve-type.h: Likewise.
* resolve/rust-ast-resolve.cc (NameResolution::NameResolution):
Likewise.
(NameResolution::go): Likewise.
* resolve/rust-ast-resolve.h: Likewise.
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes):
Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::EarlyNameResolver):
Likewise.
* resolve/rust-late-name-resolver-2.0.cc (next_node_id): Likewise.
(next_hir_id): Likewise.
* resolve/rust-name-resolution-context.cc (NameResolutionContext::NameResolutionContext):
Likewise.
* resolve/rust-name-resolver.cc (Resolver::Resolver): Likewise.
(Resolver::generate_builtins): Likewise.
(Resolver::setup_builtin): Likewise.
* resolve/rust-name-resolver.h: Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Likewise.
(TopLevel::handle_use_glob): Likewise.
* rust-session-manager.cc (Session::get_instance): Likewise.
(Session::handle_input_files): Likewise.
(Session::handle_crate_name): Likewise.
(Session::compile_crate): Likewise.
(Session::load_extern_crate): Likewise.
* rust-session-manager.h: Likewise.
* typecheck/rust-autoderef.cc (Adjuster::try_unsize_type): Likewise.
* typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion):
Likewise.
(TypeCoercionRules::coerce_unsafe_ptr): Likewise.
(TypeCoercionRules::coerce_borrowed_pointer): Likewise.
(TypeCoercionRules::coerce_unsized): Likewise.
* typecheck/rust-coercion.h: Likewise.
* typecheck/rust-hir-dot-operator.cc (MethodResolver::select):
Likewise.
* typecheck/rust-hir-inherent-impl-overlap.h: Likewise.
* typecheck/rust-hir-path-probe.cc (PathProbeType::process_enum_item_for_candiates):
Likewise.
(PathProbeType::process_impl_items_for_candidates): Likewise.
(PathProbeImplTrait::process_trait_impl_items_for_candidates):
Likewise.
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_path_to_trait):
Likewise.
(TraitItemReference::get_parent_trait_mappings): Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal):
Likewise.
(TypeCheckBase::get_marker_predicate): Likewise.
* typecheck/rust-hir-type-check-base.h: Likewise.
* typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit):
Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise.
(TypeCheckExpr::resolve_operator_overload): Likewise.
(TypeCheckExpr::resolve_fn_trait_call): Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit):
Likewise.
(TypeCheckImplItem::visit): Likewise.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit):
Likewise.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
Likewise.
(TypeCheckExpr::resolve_segments): Likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::emit_pattern_size_error):
Likewise.
(ClosureParamInfer::Resolve): Likewise.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve):
Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): Likewise.
(TypeCheckType::resolve_root_path): Likewise.
(TypeResolveGenericParam::visit): Likewise.
(ResolveWhereClauseItem::visit): Likewise.
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn):
Likewise.
* typecheck/rust-type-util.cc (query_type): Likewise.
* typecheck/rust-typecheck-context.cc (TypeCheckContext::compute_inference_variables):
Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::scan): Likewise.
(TypeBoundsProbe::assemble_builtin_candidate): Likewise.
(TypeCheckBase::get_predicate_from_bound): Likewise.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise.
(TypeCheckMethodCallExpr::check): Likewise.
* typecheck/rust-tyty-call.h: Likewise.
* typecheck/rust-tyty-cmp.h: Likewise.
* typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::override_context):
Likewise.
(SubstitutionRef::monomorphize): Likewise.
* typecheck/rust-tyty-util.cc (TyVar::get_implicit_infer_var):
Likewise.
(TyVar::monomorphized_clone): Likewise.
(TyWithLocation::TyWithLocation): Likewise.
* typecheck/rust-tyty.cc (BaseType::satisfies_bound): Likewise.
(InferType::clone): Likewise.
(ADTType::handle_substitions): Likewise.
(TupleType::handle_substitions): Likewise.
(FnType::handle_substitions): Likewise.
(ClosureType::setup_fn_once_output): Likewise.
(ArrayType::handle_substitions): Likewise.
(SliceType::handle_substitions): Likewise.
(ReferenceType::handle_substitions): Likewise.
(PointerType::handle_substitions): Likewise.
(ParamType::handle_substitions): Likewise.
* typecheck/rust-tyty.h: Likewise.
* typecheck/rust-unify.cc (UnifyRules::UnifyRules): Likewise.
(UnifyRules::commit): Likewise.
* util/rust-hir-map.cc: Change getter return type to a reference.
* util/rust-hir-map.h: Update function's prototype.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): Lines
removed as the objects are unused.
Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
|
|
|
|
No functional change intended.
gcc/analyzer/ChangeLog:
PR c/104896
* sm-malloc.cc: Replace "%<%s%>" with "%qs" in message wording.
gcc/c-family/ChangeLog:
PR c/104896
* c-lex.cc (c_common_lex_availability_macro): Replace "%<%s%>"
with "%qs" in message wording.
* c-opts.cc (c_common_handle_option): Likewise.
* c-warn.cc (warn_parm_array_mismatch): Likewise.
gcc/ChangeLog:
PR c/104896
* common/config/ia64/ia64-common.cc (ia64_handle_option): Replace
"%<%s%>" with "%qs" in message wording.
* common/config/rs6000/rs6000-common.cc (rs6000_handle_option):
Likewise.
* config/aarch64/aarch64.cc (aarch64_validate_sls_mitigation):
Likewise.
(aarch64_override_options): Likewise.
(aarch64_process_target_attr): Likewise.
* config/arm/aarch-common.cc (aarch_validate_mbranch_protection):
Likewise.
* config/pru/pru.cc (pru_insert_attributes): Likewise.
* config/riscv/riscv-target-attr.cc
(riscv_target_attr_parser::parse_arch): Likewise.
* omp-general.cc (oacc_verify_routine_clauses): Likewise.
* tree-ssa-uninit.cc (maybe_warn_read_write_only): Likewise.
(maybe_warn_pass_by_reference): Likewise.
gcc/cp/ChangeLog:
PR c/104896
* cvt.cc (maybe_warn_nodiscard): Replace "%<%s%>" with "%qs" in
message wording.
gcc/fortran/ChangeLog:
PR c/104896
* resolve.cc (resolve_operator): Replace "%<%s%>" with "%qs" in
message wording.
gcc/go/ChangeLog:
PR c/104896
* gofrontend/embed.cc (Gogo::initializer_for_embeds): Replace
"%<%s%>" with "%qs" in message wording.
* gofrontend/expressions.cc
(Selector_expression::lower_method_expression): Likewise.
* gofrontend/gogo.cc (Gogo::set_package_name): Likewise.
(Named_object::export_named_object): Likewise.
* gofrontend/parse.cc (Parse::struct_type): Likewise.
(Parse::parameter_list): Likewise.
gcc/rust/ChangeLog:
PR c/104896
* backend/rust-compile-expr.cc
(CompileExpr::compile_integer_literal): Replace "%<%s%>" with
"%qs" in message wording.
(CompileExpr::compile_float_literal): Likewise.
* backend/rust-compile-intrinsic.cc (Intrinsics::compile):
Likewise.
* backend/rust-tree.cc (maybe_warn_nodiscard): Likewise.
* checks/lints/rust-lint-scan-deadcode.h: Likewise.
* lex/rust-lex.cc (Lexer::parse_partial_unicode_escape): Likewise.
(Lexer::parse_raw_byte_string): Likewise.
* lex/rust-token.cc (Token::get_str): Likewise.
* metadata/rust-export-metadata.cc
(PublicInterface::write_to_path): Likewise.
* parse/rust-parse.cc
(peculiar_fragment_match_compatible_fragment): Likewise.
(peculiar_fragment_match_compatible): Likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path):
Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go):
Likewise.
* rust-session-manager.cc (validate_crate_name): Likewise.
(Session::load_extern_crate): Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise.
(TypeCheckExpr::resolve_fn_trait_call): Likewise.
* typecheck/rust-hir-type-check-implitem.cc
(TypeCheckImplItemWithTrait::visit): Likewise.
* typecheck/rust-hir-type-check-item.cc
(TypeCheckItem::validate_trait_impl_block): Likewise.
* typecheck/rust-hir-type-check-struct.cc
(TypeCheckStructExpr::visit): Likewise.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit):
Likewise.
* typecheck/rust-tyty.cc (BaseType::bounds_compatible): Likewise.
* typecheck/rust-unify.cc (UnifyRules::emit_abi_mismatch):
Likewise.
* util/rust-attributes.cc (AttributeChecker::visit): Likewise.
libcpp/ChangeLog:
PR c/104896
* pch.cc (cpp_valid_state): Replace "%<%s%>" with "%qs" in message
wording.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc: Use new ImmutableNrCtx.
* backend/rust-compile-context.h: Likewise.
* backend/rust-compile-expr.cc: Likewise.
* backend/rust-compile-item.cc: Likewise.
|
|
gcc/rust/ChangeLog:
* util/rust-lang-item.h (class RustLangItem): Renamed to...
(class LangItem): ...this. Rename ItemType enum to Kind
* util/rust-lang-item.cc: Rename methods to use new class name.
* backend/rust-compile-expr.cc (CompileExpr::visit): Use new lang-item API.
(CompileExpr::resolve_operator_overload): Likewise.
* backend/rust-compile-expr.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_lang_item_attribute): Likewise.
* typecheck/rust-autoderef.cc (Adjuster::try_deref_type): Likewise.
(AutoderefCycle::cycle): Likewise.
* typecheck/rust-autoderef.h: Likewise.
* typecheck/rust-hir-type-bounds.h: Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): Likewise.
* typecheck/rust-hir-type-check-base.h: Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::visit): Likewise.
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): Likewise.
(TypeBoundsProbe::assemble_builtin_candidate): Likewise.
(TypeCheckBase::get_predicate_from_bound): Likewise.
* typecheck/rust-tyty.cc (ClosureType::setup_fn_once_output): Likewise.
* util/rust-hir-map.cc (Mappings::get_lang_item): Likewise.
(Mappings::lookup_trait_item_lang_item): Likewise.
* util/rust-hir-map.h: Likewise.
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): Use new API.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Use new API.
* typecheck/rust-tyty-cmp.h: Remove old API.
* typecheck/rust-tyty.cc (FnPtr::is_equal): Use new API.
* typecheck/rust-tyty.h: Remove old API.
* typecheck/rust-unify.cc (UnifyRules::expect_fnptr): Use new API.
Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
|
|
When making more desugaring for the HIR we can need to add new Let bindings
which will require namesolution information but also rib information for
which block the let binding is associated which was very unnessecary. This
patch simply updates the BLOCK_CONTEXT of the current scope as we are
compiling and encounter HIR::LetStmts instead of trying to do it all
upfront which lots of wierd checks
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc (HIRCompileBase::compile_locals_for_block): removed
* backend/rust-compile-base.h: update header
* backend/rust-compile-block.cc (CompileBlock::visit): remove old logic
* backend/rust-compile-expr.cc (CompileExpr::generate_closure_function): likewise
* backend/rust-compile-stmt.cc (CompileStmt::visit): likewise
* backend/rust-compile-var-decl.h: ensure we setup tuple bindings correctly
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::generate_closure_function):
Fix reference to node.
* backend/rust-mangle.cc (struct V0Path): Modified to accept closures.
(v0_crate_path): Modified to accept closures.
(v0_closure): New function to mangle closures.
(v0_path): Modified to accept closures
* util/rust-mapping-common.h (UNKNOWN_NODEID): Change to UINT32_MAX.
(UNKNOWN_HIRID): Change to UINT32_MAX.
gcc/testsuite/ChangeLog:
* rust/compile/v0-mangle2.rs: New test.
Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc
(patterns_mergeable): Remove.
(struct PatternMerge): Remove.
(sort_tuple_patterns): Remove.
(simplify_tuple_match): Remove.
(CompileExpr::visit): Modify compilation of MatchExpr.
* backend/rust-compile-pattern.cc
(CompilePatternCaseLabelExpr::visit): Replace with...
(CompilePatternCheckExpr::visit): ...this.
* backend/rust-compile-pattern.h
(class CompilePatternCaseLabelExpr): Replace with...
(class CompilePatternCheckExpr): ...this.
* backend/rust-compile-type.cc
(TyTyResolveCompile::get_implicit_enumeral_node_type):
Make enumeral type equivalent to isize.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Use more a consistent name.
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): Rename method.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Rename method.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Rename method.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Rename method.
* hir/rust-hir-dump.cc (Dump::visit): Rename method.
* hir/tree/rust-hir-expr.h: Rename method.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Rename method.
* typecheck/rust-tyty.h: Rename method.
|
|
Unify with the name used in Expr to allow convenient template over
everything that has mappings.
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc: Rename method.
* backend/rust-compile-expr.cc (sort_tuple_patterns): Rename method.
* backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Rename method.
(CompilePatternBindings::visit): Rename method.
(CompilePatternLet::visit): Rename method.
* backend/rust-compile-stmt.cc (CompileStmt::visit): Rename method.
* backend/rust-compile-var-decl.h: Rename method.
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::translate): Rename method.
* hir/rust-hir-dump.cc (Dump::visit): Rename method.
* hir/tree/rust-hir-path.h: Rename method.
* hir/tree/rust-hir-pattern.h: Rename method.
* hir/tree/rust-hir.h: Rename method.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::Resolve): Rename method.
(TypeCheckPattern::visit): Rename method.
(ClosureParamInfer::visit): Rename method.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Rename method.
* util/rust-hir-map.cc (Mappings::insert_hir_pattern): Rename method.
Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): Bail on labelled block.
Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
|
|
gcc/rust/ChangeLog:
* hir/tree/rust-hir-pattern.h
(TuplePatternItems::get_pattern_type): Rename to...
(TuplePatternItems::get_item_type): ...here.
(TuplePatternItemsMultiple::get_pattern_type): Rename to...
(TuplePatternItemsMultiple::get_item_type): ...here.
(TuplePatternItemsRanged::get_pattern_type): Rename to...
(TuplePatternItemsRanged::get_item_type): ...here.
* backend/rust-compile-expr.cc: Adjust calls to renamed methods.
* backend/rust-compile-pattern.cc: Likewise.
* typecheck/rust-hir-type-check-pattern.cc: Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Fix a typo and merge 2 if clauses using the same condition.
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): Merge 2 if clauses.
* backend/rust-compile-extern.h: Fix typo in comment.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
|
|
gcc/rust/ChangeLog:
* ast/rust-expr.h: Fix spelling of "doesn't".
* backend/rust-compile-expr.cc: Fix spelling of "accessors".
* backend/rust-compile-implitem.h: Fix spelling of "normal".
* backend/rust-constexpr.cc: Fix spelling of "actual".
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Fix varadic -> variadic
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): Fix typo in varIadic.
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Likewise.
* rust-backend.h (function_type_varadic): Rename into ...
(function_type_variadic): ... this.
* rust-gcc.cc (function_type_varadic): Rename into ...
(function_type_variadic): ... this.
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise.
* typecheck/rust-tyty.h (is_varadic): Renamed into ...
(is_variadic): ... this.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
|
|
gcc/rust/ChangeLog:
* rust-backend.h
(class Backend): Convert to ...
(namespace Backend): ... namespace.
* rust-gcc.cc
(Backend::Backend): Rename to ...
(Backend::init): ... here.
(rust_get_backend): Remove.
* rust-session-manager.cc
(rust_get_backend): Remove.
(Session::init): Use Backend::init instead of rust_get_backend.
(Session::compile_crate):
Initialize Context without pointer to Backend.
* rust-session-manager.h
(Session::backend): Remove.
* backend/rust-compile-context.cc
(Context::Context): Remove pointer to Backend.
* backend/rust-compile-context.h
(class Context): Remove pointer to Backend, update function calls.
* backend/rust-compile-base.cc: Update function calls.
* backend/rust-compile-block.cc: Likewise.
* backend/rust-compile-expr.cc: Likewise.
* backend/rust-compile-extern.h: Likewise.
* backend/rust-compile-fnparam.cc: Likewise.
* backend/rust-compile-intrinsic.cc: Likewise.
* backend/rust-compile-item.cc: Likewise.
* backend/rust-compile-pattern.cc: Likewise.
* backend/rust-compile-resolve-path.cc: Likewise.
* backend/rust-compile-type.cc: Likewise.
* backend/rust-compile-var-decl.h: Likewise.
* backend/rust-compile.cc: Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
We were massing the match scruitinee expression as a way to access the
result of the expression. This is wrong and needs to be stored in a
temporary otherwise it will cause the code to be regnerated for each time
it is used. This is not an issue in the case where the expression is only
used once.
Fixes #1895
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): use a temp for the value
gcc/testsuite/ChangeLog:
* rust/execute/torture/iter1.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc: Replace Location with location_t.
* backend/rust-compile-base.h: Likewise.
* backend/rust-compile-expr.cc: Likewise.
* lex/rust-token.h: Likewise.
* metadata/rust-import-archive.cc: Likewise.
* metadata/rust-imports.cc: Likewise.
* metadata/rust-imports.h: Likewise.
* rust-backend.h: Likewise.
* rust-diagnostics.cc: Likewise.
* rust-diagnostics.h: Likewise.
* rust-gcc.cc: Likewise.
* rust-linemap.cc: Likewise.
* util/rust-token-converter.cc: Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|