Age | Commit message (Collapse) | Author | Files | Lines |
|
Fixes Rust-GCC#3615
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): check has type
* hir/tree/rust-hir-type.cc (BareFunctionType::BareFunctionType): likewise
gcc/testsuite/ChangeLog:
* rust/compile/issue-3615.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Fixes Rust-GCC#3552
gcc/rust/ChangeLog:
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): check for Expr trait
* hir/rust-hir-dump.cc (Dump::visit): expr is optional
gcc/testsuite/ChangeLog:
* rust/compile/issue-3552.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc: Check unique_ptr members are present before
visiting them.
* hir/tree/rust-hir-path.h: Add `has_{type, trait}` methods to
QualifiedPathInType.
|
|
Our AST has ImplTraitType for multiple bounds and a singular
ImplTraitTypeOneBound, this patch desugars these into a simple
HIR::ImplTraitType. It also does the name resolution for this.
gcc/rust/ChangeLog:
* checks/errors/borrowck/rust-bir-builder-struct.h: remove HIR::ImplTraitTypeOneBound
* checks/errors/borrowck/rust-function-collector.h: likewise
* checks/errors/rust-const-checker.cc (ConstChecker::visit): likewise
* checks/errors/rust-const-checker.h: likewise
* checks/errors/rust-hir-pattern-analysis.cc (PatternChecker::visit): likewise
* checks/errors/rust-hir-pattern-analysis.h: likewise
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): likewise
* checks/errors/rust-unsafe-checker.h: likewise
* hir/rust-ast-lower-type.cc (ASTLoweringType::translate): likewise
(ASTLoweringType::visit): likewise
* hir/rust-ast-lower-type.h: cleanup
* hir/rust-hir-dump.cc (Dump::visit): remove ImplTraitTypeOneBound
* hir/rust-hir-dump.h: likewise
* hir/tree/rust-hir-full-decls.h (class ImplTraitTypeOneBound): likewise
* hir/tree/rust-hir-type.h (class ImplTraitTypeOneBound): likewise
* hir/tree/rust-hir-visitor.h: likewise
* hir/tree/rust-hir.cc (ImplTraitTypeOneBound::as_string): likewise
(ImplTraitTypeOneBound::accept_vis): likewise
* resolve/rust-ast-resolve-type.cc (ResolveType::go): likewise
(ResolveType::visit): likewise
* resolve/rust-ast-resolve-type.h: add name resolution
* typecheck/rust-hir-type-check-type.h: likewise
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::do_typepathsegment): Add handling for lang items.
|
|
Return type and parameter types are optional on closures.
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): add null guard
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
These hir nodes have optional expressions which need guarded
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::do_qualifiedpathtype): add guard
(Dump::do_traitfunctiondecl): likewise
(Dump::visit): likewise
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): add missing check for no return value
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): add missing null checks
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): add guards
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>
|
|
Refactor the hir tree files to remove raw pointer usage and most forward
declarations. Move implementation out of headers and split headers into
smaller and more manageable units.
gcc/rust/ChangeLog:
* Make-lang.in: Add new files.
* hir/tree/rust-hir-item.h: Move Item definition and remove
implementations to their corresponding cc file.
* hir/tree/rust-hir-expr.h: Move implementation to the corresponding
cc file.
* 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-visitor.h: Likewise.
* hir/tree/rust-hir.h: Likewise.
* hir/tree/rust-hir.cc (Crate::Crate): Add implementations from Crate
and remove ConstGenericParam implementations to move them to their
own file.
* hir/tree/rust-hir-attrs.h: New file.
* hir/tree/rust-hir-bound-abstract.h: New file.
* hir/tree/rust-hir-bound.h: New file.
* hir/tree/rust-hir-expr-abstract.h: New file.
* hir/tree/rust-hir-expr.cc: New file.
* hir/tree/rust-hir-generic-param.cc: New file.
* hir/tree/rust-hir-generic-param.h: New file.
* hir/tree/rust-hir-item.cc: New file.
* hir/tree/rust-hir-literal.h: New file.
* hir/tree/rust-hir-node.h: New file.
* hir/tree/rust-hir-path.cc: New file.
* hir/tree/rust-hir-pattern-abstract.h: New file.
* hir/tree/rust-hir-simple-path.h: New file.
* hir/tree/rust-hir-stmt.cc: New file.
* hir/tree/rust-hir-trait-bound.h: New file.
* hir/tree/rust-hir-type-abstract.cc: New file.
* hir/tree/rust-hir-type-abstract.h: New file.
* hir/tree/rust-hir-type-no-bounds.h: New file.
* hir/tree/rust-hir-type.cc: New file.
* hir/tree/rust-hir-visibility.h: New file.
* hir/tree/rust-hir-visitable.h: New file.
* checks/lints/rust-lint-marklive.h: Use References.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Reformat
vectors.
* hir/rust-hir-dump.cc (Dump::visit): Use reference.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve):
Use references.
* typecheck/rust-tyty-bounds.cc: 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>
|
|
Replace the "regular" AST->HIR lowering for IfLet* with a desugaring
into a MatchExpr.
Desugar a simple if let:
if let Some(y) = some_value {
bar();
}
into:
match some_value {
Some(y) => {bar();},
_ => ()
}
Same applies for IfLetExprConseqElse (if let with an else block).
Desugar:
if let Some(y) = some_value {
bar();
} else {
baz();
}
into:
match some_value {
Some(y) => {bar();},
_ => {baz();}
}
Fixes https://github.com/Rust-GCC/gccrs/issues/1177
gcc/rust/ChangeLog:
* backend/rust-compile-block.h: Adjust after removal of
HIR::IfLetExpr and HIR::IfLetExprConseqElse.
* 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/borrowck/rust-bir-builder-struct.h: Likewise.
* checks/errors/borrowck/rust-function-collector.h: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit):
Likewise.
* checks/errors/rust-const-checker.h: Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit):
Likewise.
* checks/errors/rust-unsafe-checker.h: Likewise.
* hir/rust-ast-lower-block.h (ASTLoweringIfLetBlock::translate):
Change return type.
* hir/rust-ast-lower.cc (ASTLoweringIfLetBlock::desugar_iflet):
New.
(ASTLoweringIfLetBlock::visit(AST::IfLetExpr &)): Adjust and use
desugar_iflet.
* hir/rust-ast-lower.h: Add comment.
* hir/rust-hir-dump.cc (Dump::do_ifletexpr): Remove.
(Dump::visit(IfLetExpr&)): Remove.
(Dump::visit(IfLetExprConseqElse&)): Remove.
* hir/rust-hir-dump.h (Dump::do_ifletexpr): Remove.
(Dump::visit(IfLetExpr&)): Remove.
(Dump::visit(IfLetExprConseqElse&)): Remove.
* hir/tree/rust-hir-expr.h (class IfLetExpr): Remove.
(class IfLetExprConseqElse): Remove.
* hir/tree/rust-hir-full-decls.h (class IfLetExpr): Remove.
(class IfLetExprConseqElse): Remove.
* hir/tree/rust-hir-visitor.h: Adjust after removal of
HIR::IfLetExpr and HIR::IfLetExprConseqElse.
* hir/tree/rust-hir.cc (IfLetExpr::as_string): Remove.
(IfLetExprConseqElse::as_string): Remove.
(IfLetExpr::accept_vis): Remove.
(IfLetExprConseqElse::accept_vis): Remove.
* hir/tree/rust-hir.h: Adjust after removal of HIR::IfLetExpr and
HIR::IfLetExprConseqElse.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* checks/errors/rust-hir-pattern-analysis.cc
(PatternChecker::visit (IfLetExpr &)): Remove.
(PatternChecker::visit (IfLetExprConseqElse &)): Remove.
* checks/errors/rust-hir-pattern-analysis.h (visit(IfLetExpr &)): Remove.
(visit(IfLetExprConseqElse &)): Remove.
gcc/testsuite/ChangeLog:
* rust/compile/if_let_expr.rs: Adjust.
* rust/compile/if_let_expr_simple.rs: New test.
* rust/compile/iflet.rs: New test.
* rust/execute/torture/iflet.rs: New test.
* rust/compile/nr2/exclude: Add iflet.rs and if_let_expr_simple.rs
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
|
|
Add tail_reachable and label fields to the dump.
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): Add missing fields.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast.cc:
Fix Attribute constructors to copy inner_attribute
* checks/errors/rust-unsafe-checker.cc:
Add pass for #[may_dangle] in safe impl's
* hir/rust-ast-lower-item.cc:
Add support for unsafe impl's
* hir/rust-ast-lower-type.cc:
Lower attributes in impl's from AST to HIR
* hir/rust-hir-dump.cc:
Change single attribute to AttrVec
* hir/tree/rust-hir-item.h:
Add unsafe support to Impl blocks in HIR
* hir/tree/rust-hir.cc:
Change single attribute to AttrVec
* hir/tree/rust-hir.h:
Add has/get_outer_attribute to GenericParam
gcc/testsuite/ChangeLog:
* rust/compile/issue-3045-1.rs:
Add test for #[may_dangle] Generic Type triggering error
* rust/compile/issue-3045-2.rs:
Add test for #[may_dangle] Lifetime triggering error
Signed-off-by: Liam Naddell <liam.naddell@mail.utoronto.ca>
|
|
The visitor was still using the as_string() method.
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::do_matcharm): New.
(Dump::do_matchcase): New.
(Dump::visit(MatchExpr)): Adjust, don't use as_string.
* hir/rust-hir-dump.h (Dump::do_matcharm, Dump::do_matchcase): New.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit):
Fix visitor-related warnings
* ast/rust-ast-collector.h: Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast-visitor.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-struct.h: Likewise.
* checks/errors/borrowck/rust-function-collector.h: Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-const-checker.h: Likewise.
* expand/rust-derive.h: Likewise.
* expand/rust-macro-builtins-asm.cc (parse_reg_operand): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/rust-hir-dump.h: Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
|
|
|
|
gcc/rust/ChangeLog:
* hir/tree/rust-hir-item.h (class ExternalTypeItem): New class.
* hir/tree/rust-hir.cc (ExternalTypeItem::as_string): Likewise.
* backend/rust-compile-extern.h: Add base for handling HIR::ExternalTypeItem
node.
* checks/errors/borrowck/rust-bir-builder-struct.h: Likewise.
* checks/errors/borrowck/rust-function-collector.h: Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-const-checker.h: Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.h: Likewise.
* hir/rust-ast-lower-extern.h: Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/rust-hir-dump.h: Likewise.
* hir/tree/rust-hir-full-decls.h (class ExternalTypeItem): Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
(ExternalTypeItem::accept_vis): Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.h: Likewise.
|
|
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): Remove obsolete member.
* hir/tree/rust-hir-expr.h (class BorrowExpr): Remove obsolete member.
* hir/tree/rust-hir.cc (BorrowExpr::as_string): Remove obsolete member.
Signed-off-by: Jakub Dupak <dev@jakubdupak.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>
|
|
Add simple debug wrapper to dump HIR nodes on stderr.
Similar to what we already have for AST.
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::debug): New.
(debug): New.
* hir/rust-hir-dump.h (debug): New.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
|
|
This will end up getting desugared into a LoopExpr with a MatchExpr body.
gcc/rust/ChangeLog:
* backend/rust-compile-block.h: remove HIR::ForLoopExpr
* backend/rust-compile-expr.h: likewise
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): likewise
* checks/errors/privacy/rust-privacy-reporter.h: likewise
* checks/errors/rust-const-checker.cc (ConstChecker::visit): likewise
* checks/errors/rust-const-checker.h: likewise
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): likewise
* checks/errors/rust-unsafe-checker.h: likewise
* checks/lints/rust-lint-marklive.h: likewise
* hir/rust-ast-lower.cc (ASTLoweringExprWithBlock::visit): likewise
* hir/rust-hir-dump.cc (Dump::visit): likewise
* hir/rust-hir-dump.h: likewise
* hir/tree/rust-hir-expr.h (class ForLoopExpr): likewise
* hir/tree/rust-hir-full-decls.h (class ForLoopExpr): likewise
* hir/tree/rust-hir-visitor.h: likewise
* hir/tree/rust-hir.cc (ForLoopExpr::as_string): likewise
(ForLoopExpr::accept_vis): likewise
* typecheck/rust-hir-type-check-expr.h: likewise
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Attribute values were used as raw string, this is error prone and
makes renaming harder. Using a constexpr instead will leverage the power
of the compiler and emit an error when an incorrect builtin attribute
value is used.
gcc/rust/ChangeLog:
* ast/rust-ast.cc (Attribute::check_cfg_predicate): Change raw
string to constexpr call.
(Attribute::separate_cfg_attrs): Likewise.
* backend/rust-compile-base.cc (should_mangle_item): Likewise.
(HIRCompileBase::setup_fndecl): Likewise.
(HIRCompileBase::handle_cold_attribute_on_fndecl): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (find_proc_macro_attribute):
Likewise.
* checks/errors/rust-unsafe-checker.cc (check_target_attr):
Likewise.
* expand/rust-cfg-strip.cc (fails_cfg): Likewise.
(fails_cfg_with_expand): Likewise.
(expand_cfg_attrs): Likewise.
* expand/rust-macro-builtins.cc: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_outer_attributes): Likewise.
(ASTLoweringBase::lower_macro_definition): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* parse/rust-parse-impl.h (Parser::parse_doc_comment): Likewise.
* parse/rust-parse.cc (extract_module_path): Likewise.
* resolve/rust-early-name-resolver.cc (is_macro_use_module):
Likewise.
(EarlyNameResolver::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (is_macro_export):
Likwise.
* rust-session-manager.cc (Session::injection): Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::parse_repr_options): Likewise.
* util/rust-attributes.cc (is_proc_macro_type): Likewise.
(AttributeChecker::check_attribute): Likewise.
(AttributeChecker::visit): Likewise.
* util/rust-hir-map.cc (Mappings::insert_macro_def): Likewise.
* util/rust-attribute-values.h: New file.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
visit_field() correctly handles empty unique_ptr<> and displays "none".
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): Remove useless if/else
already handled by visit_field.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
|
|
Adjust the HIR dump for IfExpr and IfExprConseqElse
to use visit_field() and factor common part.
gcc/rust/ChangeLog:
* hir/rust-hir-dump.h (do_ifexpr): New.
* hir/rust-hir-dump.cc (Dump::do_ifexpr): New.
(Dump::visit): Use do_ifexpr and visit_field
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
|
|
Trait bounds can have three forms in Rust the regular trait bound, '!' the
negative trait bound to enforice that this trait must not be implmented and
'?' the anti trait bound to remove this bound. This patch extends our
Polarity enum to include the Anti trait bound and updates the HIR lowering
code to track this properly.
Addresses #2443
gcc/rust/ChangeLog:
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): use new BoundPolarity enum
* hir/rust-ast-lower-type.cc (ASTLoweringTypeBounds::visit): likewise
* hir/rust-hir-dump.cc (BoundPolarityString): new helper
(Dump::visit): update hir dump
* hir/tree/rust-hir-item.h (class ImplBlock): likewise
* hir/tree/rust-hir-type.h (class TraitBound): likewise
* hir/tree/rust-hir.cc (TraitBound::as_string): fix as string
* util/rust-common.h (enum Polarity): add new anti bound
(enum BoundPolarity): likewise
* util/rust-hir-map.cc (Mappings::Mappings): update naming
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Nearly complete rewrite of the HIR dump pass.
fixes #693
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (convert_param_kind_to_str): New.
(convert_new_bind_type_to_str): New.
(convert_mut_to_str): New.
(Dump::go): New.
(Dump::put): New.
(Dump::begin): New.
(Dump::end): New.
(Dump::begin_field): New.
(Dump::end_field): New.
(Dump::put_field): New.
(Dump::visit_field): New.
(Dump::visit): Refactor.
(Dump::visit_collection): New.
(Dump::do_traititem): New.
(Dump::do_vis_item): New.
(Dump::do_functionparam): New.
(Dump::do_pathpattern): New.
(Dump::do_structexprstruct): New.
(Dump::do_expr): New.
(Dump::do_pathexpr): New.
(Dump::do_typepathsegment): New.
(Dump::do_typepathfunction): New.
(Dump::do_qualifiedpathtype): New.
(Dump::do_operatorexpr): New.
(Dump::do_mappings): New.
(Dump::do_inner_attrs): New.
(Dump::do_outer_attrs): New.
(Dump::do_baseloopexpr): New.
(Dump::do_ifletexpr): New.
(Dump::do_struct): New.
(Dump::do_enumitem): New.
(Dump::do_traitfunctiondecl): New.
(Dump::do_externalitem): New.
(Dump::do_namefunctionparam): New.
(Dump::do_stmt): New.
(Dump::do_type): New.
(Dump::do_item): New.
(Dump::do_tuplefield): New.
(Dump::do_structfield): New.
(Dump::do_genericargs): New.
(Dump::do_maybenamedparam): New.
* hir/rust-hir-dump.h: Refactor.
* hir/tree/rust-hir-item.h (enum_to_str): New.
* hir/tree/rust-hir-type.h (enum_to_str): New.
* hir/tree/rust-hir.cc (enum_to_str): New.
* util/rust-common.h (enum_to_str): New.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
|
|
As discussed during the community call, rust_unreachable() should
always trigger an internal compiler error and should not offer
the behavior of __builtin_unreachable when asserts are disabled, unlike
gcc_unreachable().
gcc/rust/ChangeLog:
* rust-system.h (rust_unreachable): Change definition to fancy_abort
* ast/rust-ast-collector.cc (TokenCollector::visit): Use rust_unreachable
instead of gcc_unreachable.
(get_delimiters): Likewise.
* ast/rust-ast-dump.h: Likewise.
* ast/rust-ast-formatting.cc (get_string_in_delims): Likewise.
(get_mode_dump_desc): Likewise.
* ast/rust-ast.cc (Visibility::as_string): Likewise.
(UseTreeGlob::as_string): Likewise.
* ast/rust-ast.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.h: Likewise.
* backend/rust-compile-expr.cc (sort_tuple_patterns): Likewise.
(CompileExpr::visit): Likewise.
(CompileExpr::generate_closure_fntype): Likewise.
* backend/rust-compile-intrinsic.cc (op_with_overflow_inner): Likewise.
* backend/rust-compile-pattern.cc (CompilePatternBindings::visit): Likewise.
(CompilePatternLet::visit): Likewise.
* backend/rust-constexpr.cc (base_field_constructor_elt): Likewise.
(eval_array_reference): Likewise.
(label_matches): Likewise.
(eval_store_expression): Likewise.
(eval_call_expression): Likewise.
(build_data_member_initialization): Likewise.
(array_index_cmp): Likewise.
(get_array_or_vector_nelts): Likewise.
(eval_bit_field_ref): Likewise.
(eval_loop_expr): Likewise.
(potential_constant_expression_1): Likewise.
* backend/rust-mangle.cc (v0_simple_type_prefix): Likewise.
(v0_type_prefix): Likewise.
(v0_mangle_item): Likewise.
(Mangler::mangle_item): Likewise.
* backend/rust-tree.cc (convert_to_void): Likewise.
(type_memfn_quals): Likewise.
(rs_tree_equal): Likewise.
(fold_offsetof): Likewise.
(fold_builtin_source_location): Likewise.
(lvalue_error): Likewise.
* backend/rust-tree.h (struct named_decl_hash): Likewise.
(struct named_label_hash): Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc
(VisibilityResolver::resolve_visibility): Likewise.
(VisibilityResolver::visit): Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::ctx_to_str): Likewise.
* checks/errors/rust-feature.cc (Feature::create): Likewise.
* expand/rust-expand-visitor.cc (get_traits_to_derive): Likewise.
(derive_item): Likewise.
(expand_item_attribute): Likewise.
(expand_stmt_attribute): Likewise.
* expand/rust-macro-expand.cc (MacroExpander::match_matcher): Likewise.
(MacroExpander::match_repetition): Likewise.
(transcribe_context): Likewise.
(MacroExpander::import_proc_macros): Likewise.
(MacroExpander::parse_proc_macro_output): Likewise.
* expand/rust-macro-expand.h: Likewise.
* expand/rust-macro-invoc-lexer.h: Likewise.
* expand/rust-macro-substitute-ctx.cc (SubstituteCtx::substitute_token): Likewise.
* expand/rust-proc-macro-invoc-lexer.h: Likewise.
* expand/rust-proc-macro.cc (load_macros): Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_generic_args): Likewise.
(ASTLoweringBase::lower_literal): Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Likewise.
* hir/rust-ast-lower-type.cc (ASTLoweringType::visit): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/tree/rust-hir.cc (get_string_in_delims): Likewise.
(Visibility::as_string): Likewise.
(UseTreeGlob::as_string): Likewise.
(CompoundAssignmentExpr::as_string): Likewise.
(ArithmeticOrLogicalExpr::as_string): Likewise.
* lex/rust-lex.cc (Lexer::parse_byte_string): Likewise.
(Lexer::parse_string): Likewise.
* lex/rust-token.cc (RS_TOKEN): Likewise.
* parse/rust-parse-impl.h (Parser::parse_simple_path_segment): Likewise.
(Parser::parse_path_ident_segment): Likewise.
(Parser::parse_attr_input): Likewise.
(Parser::parse_inherent_impl_item): Likewise.
(Parser::parse_trait_impl_item): Likewise.
(Parser::parse_type_path_segment): Likewise.
(Parser::parse_reference_type): Likewise.
(get_lbp_for_comparison_expr): Likewise.
* parse/rust-parse.cc (peculiar_fragment_match_compatible): Likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise.
(ResolveTypeToCanonicalPath::visit): Likewise.
(ResolveGenericArgs::resolve_disambiguated_generic): Likewise.
* rust-gcc.cc (operator_to_tree_code): Likewise.
(fetch_overflow_builtins): Likewise.
(Gcc_backend::non_zero_size_type): Likewise.
(Gcc_backend::convert_tree): Likewise.
* rust-lang.cc (grs_langhook_type_for_mode): Likewise.
(grs_langhook_global_bindings_p): Likewise.
(grs_langhook_pushdecl): Likewise.
(grs_langhook_getdecls): Likewise.
(convert): Likewise.
* typecheck/rust-autoderef.h: Likewise.
* typecheck/rust-hir-path-probe.cc: Likewise.
* typecheck/rust-hir-trait-reference.cc (TraitItemReference::get_tyty): Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): Likewise.
* typecheck/rust-hir-type-check-expr.cc: Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit): Likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.h: Likewise.
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): Likewise.
* typecheck/rust-substitution-mapper.h: Likewise.
* typecheck/rust-typecheck-context.cc (TypeCheckContextItem::get_context_type): Likewise.
* typecheck/rust-tyty-call.h: Likewise.
* typecheck/rust-tyty.cc (TypeKindFormat::to_string): Likewise.
(BaseType::monomorphized_clone): Likewise.
(VariantDef::variant_type_string): Likewise.
(ClosureType::handle_substitions): Likewise.
(IntType::as_string): Likewise.
(UintType::as_string): Likewise.
(FloatType::as_string): Likewise.
* typecheck/rust-unify.cc (UnifyRules::expect_projection): Likewise.
* util/rust-token-converter.cc (convert): Likewise.
(from_literal): Likewise.
(from_group): Likewise.
(from_tokentree): Likewise.
|
|
Some more HIR cleanup.
gcc/rust/ChangeLog:
* hir/tree/rust-hir-expr.h (BorrowExpr::is_double_borrow): New.
(ArrayElemsCopied::get_elem_to_copy)
(ArrayElemsCopied::get_num_copies_expr): Return unique_ptr.
(CallExpr::get_fnexpr): Likewise.
(ReturnExpr::get_expr): Likewise.
(StructExprStructFields::get_struct_base): New.
(MethodCallExpr::has_params): New.
(ClosureExpr::has_params): New.
(BlockExpr::get_inner_attrs): New.
(WhileLoopExpr::get_patterns): New.
(ForLoopExpr::get_pattern): New.
(IfLetExpr::get_if_block): Return ref to unique_ptr.
(IfLetExprConseqElse::get_else_block): Likewise.
(MatchExpr::get_inner_attrs): New.
* hir/tree/rust-hir-item.h (Module::get_module_name): New.
(ExternCrate::get_referenced_crate)
(ExternCrate::get_as_clause_name): New.
(UseTreeGlob::get_glob_type, UseTreeGlob::get_path): New.
(UseTreeList::get_path_type, UseTreeList::get_path)
(UseTreeList::get_trees): New.
(TraitItemKind::get_expr): Remove assert. unique_ptr can
be "empty". Must be checked in caller.
* hir/tree/rust-hir-pattern.h (IdentifierPattern::get_is_ref)
(IdentifierPattern::get_to_bind): New.
(RangePatternBoundType::get_has_minus): New.
(RangePattern::get_has_ellipsis_syntax): New.
(StructPatternField::get_outer_attrs): New.
(StructPatternFieldTuplePat::get_index)
(StructPatternFieldTuplePat::get_tuple_pattern): New.
(StructPatternFieldIdent::get_has_ref): New.
* hir/tree/rust-hir-stmt.h (LetStmt::get_outer_attrs): New.
(LetStmt::get_type)
(LetStmt::get_init_expr, LetStmt::get_pattern): Return unique_ptr.
(ExprStmt::get_expr): Likewise.
* hir/tree/rust-hir-type.h (TraitBound::get_for_lifetimes): New.
(TraitBound::get_in_params): New.
(TraitBound::get_opening_question_mark): New.
(ImplTraitType::get_type_param_bounds): New.
(TraitObjectType::get_has_dyn): New.
(TraitBound::get_type_in_parens): New.
(ImplTraitTypeOneBound::get_trait_bound): New.
(BareFunctionType::get_for_lifetimes)
(BareFunctionType::get_is_variadic)
(BareFunctionType::get_function_qualifiers): New.
* hir/tree/rust-hir.h (class Expr): Virtual inherit from FullVisitable.
(class Pattern): Likewise.
(ConstGenericParam::get_name): New.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Adjust call.
(TypeCheckExpr::resolve_fn_trait_call): Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Adjust call.
(CompileExpr::array_copied_expr): Likewise.
(CompileExpr::generate_possible_fn_trait_call): Likewise.
* backend/rust-compile-stmt.cc (CompileStmt::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
|
|
Introduce Crate::get_items () and fixup all callers.
gcc/rust/ChangeLog:
* hir/tree/rust-hir.h (struct Crate): Rename struct into ...
(class Crate): ... class, and add get_items.
* backend/rust-compile.cc (CompileCrate::go): Adapt to visibility change of items.
* checks/errors/privacy/rust-privacy-check.cc (Resolver::resolve): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::go): Likewise.
* checks/errors/privacy/rust-pub-restricted-visitor.cc (PubRestrictedVisitor::go): Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::go): Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::go): Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::go): Likewise.
* checks/lints/rust-lint-marklive.cc (FindEntryPoint::find): Likewise.
* checks/lints/rust-lint-scan-deadcode.h (ScanDeadCode::Scan): Likewise.
* metadata/rust-export-metadata.cc (PublicInterface::gather_export_data): Likewise.
* typecheck/rust-hir-type-check.cc (TypeResolution::Resolve): Likewise.
* hir/rust-hir-dump.cc (CompileCrate::go): Likewise.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
|
|
Introduce WithInnerAttrs class that can be inherited instead of
duplicating the same data/method in all HIR classes.
gcc/rust/ChangeLog:
* hir/tree/rust-hir.h (class WithInnerAttrs): New.
(class Item): Adjust to new WithInnerAttrs class.
(struct Crate): Likewise.
* hir/rust-hir-dump.cc (Dump::go): Likewise.
(Dump::visit): Likewise.
* hir/tree/rust-hir-expr.h (class GroupedExpr): Likewise.
(class ArrayExpr): Likewise.
(class TupleExpr): Likewise.
(class StructExprStruct): Likewise.
(class BlockExpr): Likewise.
(class MatchExpr): Likewise.
* hir/tree/rust-hir-item.h (TypeParam::get_outer_attribute): New.
(class Module): Adjust to new WithInnerAttrs class.
(struct StructField): change struct to...
(class StructField): ... a class.
(class ImplBlock): Adjust to new WithInnerAttrs class.
(class ExternBlock): Likewise.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
|
|
Change Identifier type definition from a simple typedef to a whole class
with it's own node id.
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): Change with
call to getter.
* ast/rust-ast.cc (Module::as_string): Likewise.
(StaticItem::as_string): Likewise.
(TupleStruct::as_string): Likewise.
(Method::as_string): Likewise.
(StructStruct::as_string): Likewise.
(UseTreeRebind::as_string): Likewise.
(Enum::as_string): Likewise.
(Trait::as_string): Likewise.
(Union::as_string): Likewise.
(Function::as_string): Likewise.
(TypeAlias::as_string): Likewise.
(MacroRulesDefinition::as_string): Likewise.
(FieldAccessExpr::as_string): Likewise.
(MacroMatchFragment::as_string): Likewise.
(TypeParam::as_string): Likewise.
(StructExprFieldIdentifierValue::as_string): Likewise.
(EnumItem::as_string): Likewise.
(StructField::as_string): Likewise.
(ExternalTypeItem::as_string): Likewise.
(ExternalStaticItem::as_string): Likewise.
(ExternalFunctionItem::as_string): Likewise.
(TraitFunctionDecl::as_string): Likewise.
(TraitMethodDecl::as_string): Likewise.
(TraitItemConst::as_string): Likewise.
(TraitItemType::as_string): Likewise.
(MaybeNamedParam::as_string): Likewise.
(MetaListPaths::as_string): Likewise.
(MetaListNameValueStr::as_string): Likewise.
(Module::process_file_path): Likewise.
(MetaListNameValueStr::check_cfg_predicate): Likewise.
(MetaListPaths::check_cfg_predicate): Likewise.
(MetaWord::check_cfg_predicate): Likewise.
(MetaNameValueStr::check_cfg_predicate): Likewise.
(MetaNameValueStr::to_attribute): Likewise.
(MetaWord::to_attribute): Likewise.
(MetaListPaths::to_attribute): Likewise.
(MetaListNameValueStr::to_attribute): Likewise.
(operator<<): Change Identifier class <<
operator overload for standard output stream.
* ast/rust-ast.h (class Identifier): Change typedef to proper
class definition.
(operator<<): Add prototype for operator overload.
(class Token): Change getter identifier.
(class MetaListNameValueStr): Likewise.
(class PathExpr): Likewise.
* ast/rust-expr.h: Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.cc (GenericArg::disambiguate_to_type): Likewise.
(GenericArgsBinding::as_string): Likewise.
(ConstGenericParam::as_string): Likewise.
* ast/rust-path.h: Likewise.
* ast/rust-pattern.cc (IdentifierPattern::as_string): Likewise.
(StructPatternFieldIdentPat::as_string): Likewise.
(StructPatternFieldIdent::as_string): Likewise.
* ast/rust-type.h: Likewise.
* backend/rust-compile-base.cc: Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* backend/rust-compile-extern.h: Likewise.
* backend/rust-compile-fnparam.cc (CompileFnParam::visit):
Likewise.
* backend/rust-compile-implitem.cc (CompileTraitItem::visit):
Likewise.
* backend/rust-compile-item.cc (CompileItem::visit): Likewise.
* backend/rust-compile-pattern.cc (CompilePatternBindings::visit): Likewise.
* backend/rust-compile-struct-field-expr.cc (CompileStructExprField::visit):
Likewise.
* backend/rust-compile-var-decl.h: Likewise.
* backend/rust-compile.cc: Likewise.
* checks/errors/rust-unsafe-checker.cc (check_extern_call):
Likewise.
* checks/lints/rust-lint-marklive.cc (MarkLive::visit):
Likewise.
* checks/lints/rust-lint-scan-deadcode.h: Likewise.
* expand/rust-derive-clone.cc (DeriveClone::clone_fn): Likewise.
(DeriveClone::visit_tuple): Likewise.
(DeriveClone::visit_struct): Likewise.
(DeriveClone::visit_union): Likewise.
* expand/rust-derive-copy.cc (DeriveCopy::visit_struct):
Likewise.
(DeriveCopy::visit_tuple): Likewise.
(DeriveCopy::visit_enum): Likewise.
(DeriveCopy::visit_union): Likewise.
* expand/rust-macro-expand.cc (MacroExpander::match_matcher):
Likewise.
(MacroExpander::match_n_matches): Likewise.
(MacroExpander::match_repetition): Likewise.
(MacroExpander::match_repetition_skipped_metavars): Likewise.
* hir/rust-ast-lower-base.cc (struct_field_name_exists):
Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit):
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-type.h: Likewise.
* hir/tree/rust-hir.cc (Module::as_string): Likewise.
(StaticItem::as_string): Likewise.
(TupleStruct::as_string): Likewise.
(ConstantItem::as_string): Likewise.
(StructStruct::as_string): Likewise.
(UseTreeRebind::as_string): Likewise.
(Enum::as_string): Likewise.
(Trait::as_string): Likewise.
(Union::as_string): Likewise.
(Function::as_string): Likewise.
(TypeAlias::as_string): Likewise.
(FieldAccessExpr::as_string): Likewise.
(TypeParam::as_string): Likewise.
(GenericArgsBinding::as_string): Likewise.
(StructPatternFieldIdent::as_string): Likewise.
(StructPatternFieldIdentPat::as_string): Likewise.
(IdentifierPattern::as_string): Likewise.
(StructExprFieldIdentifierValue::as_string): Likewise.
(EnumItem::as_string): Likewise.
(StructField::as_string): Likewise.
(ExternalStaticItem::as_string): Likewise.
(ExternalFunctionItem::as_string): Likewise.
(NamedFunctionParam::as_string): Likewise.
(TraitFunctionDecl::as_string): Likewise.
(TraitItemConst::as_string): Likewise.
(TraitItemType::as_string): Likewise.
(MaybeNamedParam::as_string): Likewise.
* hir/tree/rust-hir.h: Likewise.
* parse/rust-parse-impl.h (Parser::parse_macro_match_fragment):
Likewise.
(Parser::parse_module): Likewise.
(Parser::parse_use_tree): Likewise.
(Parser::parse_maybe_named_param): Likewise.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit):
Likewise.
(ResolveItem::visit): Likewise.
(flatten_rebind): Likewise.
(ResolveExternItem::visit): Likewise.
(rust_flatten_rebind): Likewise.
(rust_flatten_rebind_nested): Likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::go):
Likewise.
(PatternDeclaration::visit): Likewise.
(PatternDeclaration::add_new_binding): Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* resolve/rust-ast-resolve-type.h: Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise.
* typecheck/rust-autoderef.cc: Likewise.
* typecheck/rust-hir-dot-operator.cc (MethodResolver::select):
Likewise.
* typecheck/rust-hir-path-probe.cc (PathProbeType::visit):
Likewise.
* typecheck/rust-hir-trait-reference.cc (TraitReference::get_name): Likewise.
* typecheck/rust-hir-trait-resolve.cc (ResolveTraitItemToRef::visit): Likewise.
(TraitResolver::resolve_trait): Likewise.
(TraitItemReference::resolve_item): Likewise.
(AssociatedImplTrait::setup_raw_associated_types): Likewise.
* typecheck/rust-hir-type-check-enumitem.cc (TypeCheckEnumItem::visit): Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Likewise.
(TypeCheckImplItem::visit): Likewise.
(TypeCheckImplItemWithTrait::visit): Likewise.
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit):
Likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::visit): Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::visit): Likewise.
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): Likewise.
* typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args): Likewise.
* util/rust-attributes.cc (check_doc_attribute): Likewise.
* util/rust-hir-map.cc (Mappings::insert_macro_def): Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-stmt.cc
(CompileStmt::visit): Unify ExprStmtWith{,out}Block visitors.
* backend/rust-compile-stmt.h
(CompileStmt::visit): Likewise.
* backend/rust-compile-item.h
(CompileItem::visit): Likewise.
* hir/rust-hir-dump.cc
(Dump::visit): Likewise.
* hir/rust-hir-dump.h
(Dump::visit): Likewise.
* hir/tree/rust-hir-stmt.h
(ExprStmt::accept_vis): Add.
(ExprStmtWithoutBlock::accept_vis): Remove.
(ExprStmtWithBlock::accept_vis): Remove.
* hir/tree/rust-hir.cc
(ExprStmt::accept_vis): Add.
(ExprStmtWithoutBlock::accept_vis): Remove.
(ExprStmtWithBlock::accept_vis): Remove.
* hir/tree/rust-hir-visitor.h
(HIRFullVisitor::visit): Likewise.
(HIRFullVisitorBase::visit): Likewise.
(HIRStmtVisitor::visit): Likewise.
* checks/errors/rust-const-checker.cc
(ConstChecker::visit): Likewise.
* checks/errors/rust-const-checker.h
(ConstChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.cc
(UnsafeChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.h
(UnsafeChecker::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h
(PrivacyReporter::visit): Likewise.
* checks/lints/rust-lint-marklive.h
(MarkLive::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.cc
(TypeCheckStmt::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.h
(TypeCheckStmt::visit): Likewise.
* typecheck/rust-tycheck-dump.h
(TypeResolverDump::visit): Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This reverts commit a1f940d193c6cdb13483690a4f4a7d501ad7040e. It is easier
and cleaner to store exported macros' NodeIds into our mappings rather than
create a new HIR kind of node.
gcc/rust/ChangeLog:
* backend/rust-compile-item.h: Revert 1c946687239b86a92839d57dfbc928ad7ce35eae.
* backend/rust-compile-stmt.h: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* checks/errors/privacy/rust-pub-restricted-visitor.cc
(PubRestrictedVisitor::visit): Likewise.
* checks/errors/privacy/rust-pub-restricted-visitor.h: Likewise.
* checks/errors/privacy/rust-reachability.cc
(ReachabilityVisitor::visit): Likewise.
* checks/errors/privacy/rust-reachability.h: Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc
(VisibilityResolver::visit): Likewise.
* checks/errors/privacy/rust-visibility-resolver.h: Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-const-checker.h: Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.h: Likewise.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Likewise.
* hir/rust-ast-lower-item.h: Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/rust-hir-dump.h: Likewise.
* hir/tree/rust-hir-full-decls.h (class ExportedMacro): Likewise.
* hir/tree/rust-hir-item.h (class ExportedMacro): Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
* hir/tree/rust-hir.cc (ExportedMacro::accept_vis): Likewise.
(ExportedMacro::get_locus): Likewise.
(ExportedMacro::get_item_kind): Likewise.
(ExportedMacro::clone_item_impl): Likewise.
* hir/tree/rust-hir.h: Likewise.
* metadata/rust-export-metadata.cc: Likewise.
* typecheck/rust-hir-type-check-item.h: Likewise.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.h: Likewise.
* typecheck/rust-tycheck-dump.h: Likewise.
* util/rust-attributes.cc: Likewise.
|
|
Refer to `BlockExpr::as_string ()`, dump inner attrs for `Dump::visit`.
Add visit (AST::Attribute &).
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::go): fix format
(Dump::visit): impl `visit (AST::Attribute &)`, dump inner attrs and
`visit (Lifetime &)`
* hir/rust-hir-dump.h:add `visit (AST::Attribute &)`
Signed-off-by: Jiakun Fan <120090316@link.cuhk.edu.cn>
|
|
This should allow for 'if let' expressions to be lowered more easily.
gcc/rust/ChangeLog:
* backend/rust-compile-block.h
(CompileConditionalBlocks::visit): Remove IfLetExprConseqIf{,Let} visitors.
(CompileExprWithBlock::visit): Remove IfLetExprConseqIf{,Let} visitors.
* backend/rust-compile-expr.h
(CompileExpr::visit): Remove IfLetExprConseqIf{,Let} visitors.
* checks/errors/rust-unsafe-checker.cc
(UnsafeChecker::visit): Remove IfLetExprConseqIf{,Let} visitors.
* checks/errors/rust-unsafe-checker.h
(UnsafeChecker::visit): Remove IfLetExprConseqIf{,Let} visitors.
* checks/errors/rust-const-checker.cc
(ConstChecker::visit): Remove IfLetExprConseqIf{,Let} visitors.
* checks/errors/rust-const-checker.h
(ConstChecker::visit): Remove IfLetExprConseqIf{,Let} visitors.
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::visit): Remove IfLetExprConseqIf{,Let} visitors.
* checks/errors/privacy/rust-privacy-reporter.h
(PrivacyReporter::visit): Remove IfLetExprConseqIf{,Let} visitors.
* hir/tree/rust-hir-expr.h
(class IfLetExprConseqElse): Make else_block ExprWithBlock.
(class IfLetExprConseqIf): Remove.
(class IfLetExprConseqIfLet): Remove.
* hir/tree/rust-hir-full-decls.h
(class IfLetExprConseqIf): Remove.
(class IfLetExprConseqIfLet): Remove.
* hir/tree/rust-hir.cc
(IfLetExprConseqElse::as_string): Adjust output.
(IfLetExprConseqIf::as_string): Remove.
(IfLetExprConseqIfLet::as_string): Remove.
(IfLetExprConseqIf::accept_vis): Remove.
(IfLetExprConseqIfLet::accept_vis): Remove.
* hir/tree/rust-hir-visitor.h
(HIRFullVisitor::visit): Remove IfLetExprConseqIf{,Let} visitors.
(HIRFullVisitorBase::visit): Remove IfLetExprConseqIf{,Let} visitors.
(HIRExpressionVisitor::visit): Remove IfLetExprConseqIf{,Let} visitors.
* hir/rust-hir-dump.cc
(Dump::visit): Remove IfLetExprConseqIf{,Let} visitors.
* hir/rust-hir-dump.h
(Dump::visit): Remove IfLetExprConseqIf{,Let} visitors.
* typecheck/rust-hir-type-check-expr.h
(TypeCheckExpr::visit): Remove IfLetExprConseqIf{,Let} visitors.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This should simplify 'if' expression handling to match
future simplifications to 'if let' expression handling.
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-expr.cc
(TypeCheckExpr::visit): Remove IfExprConseqIf visitor.
* typecheck/rust-hir-type-check-expr.h
(TypeCheckExpr::visit): Remove IfExprConseqIf{,Let} visitor.
* backend/rust-compile-block.cc
(CompileConditionalBlocks::visit): Remove IfExprConseqIf visitor.
* backend/rust-compile-block.h
(CompileConditionalBlocks::visit): Remove IfExprConseqIf{,Let} visitors.
(CompileExprWithBlock::visit):
Remove IfExprConseqIf{,Let} visitors, implement BlockExpr visitor.
* backend/rust-compile-expr.cc
(CompileExpr::visit): Remove IfExprConseqIf visitor.
* backend/rust-compile-expr.h
(CompileExpr::visit): Remove IfExprConseqIf{,Let} visitors.
* checks/lints/rust-lint-marklive.h
(MarkLive::visit): Remove IfExprConseqIf visitor.
* checks/errors/rust-const-checker.cc
(ConstChecker::visit): Remove IfExprConseqIf{,Let} visitors.
* checks/errors/rust-const-checker.h
(ConstChecker::visit): Remove IfExprConseqIf{,Let} visitors.
* checks/errors/rust-unsafe-checker.cc
(UnsafeChecker::visit): Remove IfExprConseqIf{,Let} visitors.
* checks/errors/rust-unsafe-checker.h
(UnsafeChecker::visit): Remove IfExprConseqIf{,Let} visitors.
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::visit): Remove IfExprConseqIf{,Let} visitors.
* checks/errors/privacy/rust-privacy-reporter.h
(PrivacyReporter::visit): Remove IfExprConseqIf{,Let} visitors.
* hir/tree/rust-hir-expr.h
(class IfExprConseqElse): Make else_block ExprWithBlock.
(class IfExprConseqIf): Remove.
(class IfExprConseqIfLet): Remove.
* hir/tree/rust-hir-full-decls.h
(class IfExprConseqIf): Remove.
(class IfExprConseqIfLet): Remove.
* hir/tree/rust-hir.cc
(IfExprConseqElse::as_string): Adjust output.
(IfExprConseqIf::as_string): Remove.
(IfExprConseqIfLet::as_string): Remove.
(IfExprConseqIf::accept_vis): Remove.
(IfExprConseqIfLet::accept_vis): Remove.
* hir/tree/rust-hir-visitor.h
(HIRFullVisitor::visit): Remove IfExprConseqIf{,Let} visitors.
(HIRFullVisitorBase::visit): Remove IfExprConseqIf{,Let} visitors.
(HIRExpressionVisitor::visit): Remove IfExprConseqIf{,Let} visitors.
* hir/rust-hir-dump.cc
(Dump::visit): Remove IfExprConseqIf{,Let} visitors.
* hir/rust-hir-dump.h
(Dump::visit): Remove IfExprConseqIf{,Let} visitors.
* hir/rust-ast-lower.cc
(ASTLoweringIfBlock::visit): Replace HIR::IfExprConseqIf with HIR::IfExprConseqElse.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This HIR node represents macros which should be exported into the final
Rust metadata files. Because our metadata exporter operates on the HIR,
while macros are inherently tied to the AST, we need a way to propagate
exported macros up until the metadata export pass on the HIR. Hence the
existence of this class, whose sole purpose is to keep enough information
for the metadata exporter to retrieve the original AST::MacroRulesDefinition.
Handling for actually exporting these macros will come later.
gcc/rust/ChangeLog:
* hir/tree/rust-hir-item.h (class ExportedMacro): Add new ExportedMacro class.
* hir/tree/rust-hir.cc (ExportedMacro::accept_vis): New function.
(ExportedMacro::get_locus): Likewise.
(ExportedMacro::get_item_kind): Likewise.
(ExportedMacro::clone_item_impl): Likewise.
* hir/tree/rust-hir-full-decls.h (class ExportedMacro): Forward declare class.
* backend/rust-compile-item.h: Add visitor for ExportedMacro.
* backend/rust-compile-stmt.h: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* checks/errors/privacy/rust-pub-restricted-visitor.cc (PubRestrictedVisitor::visit):
Likewise.
* checks/errors/privacy/rust-pub-restricted-visitor.h: Likewise.
* checks/errors/privacy/rust-reachability.cc (ReachabilityVisitor::visit): Likewise.
* checks/errors/privacy/rust-reachability.h: Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::visit): Likewise.
* checks/errors/privacy/rust-visibility-resolver.h: Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-const-checker.h: Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.h: Likewise.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Likewise.
* hir/rust-ast-lower-item.h: Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/rust-hir-dump.h: Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
* metadata/rust-export-metadata.cc: Likewise.
* typecheck/rust-hir-type-check-item.h: Likewise.
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise.
* typecheck/rust-hir-type-check-stmt.h: Likewise.
* typecheck/rust-tycheck-dump.h: Likewise.
* hir/tree/rust-hir.h: Add new ItemKind::MacroExport variant.
* util/rust-attributes.cc: Add #[macro_export] attribute.
|
|
Improves readability by better corresponding to resulting output.
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): Simplify indentation dump to single line.
Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-dump.cc (Indent::Indent): Move to separate file.
(operator<<): Move to separate file.
(Indent::increment): Move to separate file.
(Indent::decrement): Move to separate file.
* ast/rust-ast-dump.h (class Indent): Move to separate file.
* hir/rust-hir-dump.cc (Dump::Dump): Use new indentation object.
(Dump::go): Use new indentation object.
(Dump::visit): Use new indention object.
* hir/rust-hir-dump.h: Use new indentation object.
* util/rust-dump.h: New file. Moved Indentation from rust-ast-dump.cc
Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
|
|
Example:
match x {
0 | 1 => true,
_ => false
}
gcc/rust/ChangeLog:
* backend/rust-compile-fnparam.h:
(CompileFnParam::visit): Add AltPattern visitor.
* backend/rust-compile-pattern.h:
(CompilePatternCaseLabelExpr::visit): Add AltPattern visitor.
(CompilePatternBindings::visit): Add AltPattern visitor.
(CompilePatternLet::visit): Add AltPattern visitor.
* backend/rust-compile-resolve-path.h:
(ResolvePathRef::visit): Add AltPattern visitor.
* backend/rust-compile-var-decl.h:
(CompileVarDecl::visit): Add AltPattern visitor.
* checks/errors/rust-const-checker.cc
(ConstChecker::visit): Add AltPattern visitor.
* checks/errors/rust-const-checker.h:
(ConstChecker::visit): Add AltPattern visitor.
* checks/errors/rust-unsafe-checker.cc
(UnsafeChecker::visit): Add AltPattern visitor.
* checks/errors/rust-unsafe-checker.h:
(UnsafeChecker::visit): Add AltPattern visitor.
* hir/rust-hir-dump.cc
(Dump::visit): Add AltPattern visitor.
* hir/rust-hir-dump.h:
(Dump::visit): Add AltPattern visitor.
* hir/tree/rust-hir-full-decls.h
(class AltPattern): Add forward declaration.
* hir/tree/rust-hir-pattern.h
(class AltPattern): New class.
* hir/tree/rust-hir-visitor.h:
(HIRFullVisitor::visit): Add AltPattern visitor.
(HIRFullVisitorBase::visit): Add AltPattern visitor.
(HIRPatternVisitor::visit): Add AltPattern visitor.
* hir/tree/rust-hir.h:
(Pattern::PatternType::ALT): New enumerator.
* typecheck/rust-hir-type-check-pattern.cc
(TypeCheckPattern::visit): Add AltPattern visitor.
* typecheck/rust-hir-type-check-pattern.h:
(TypeCheckPattern::visit): Add AltPattern visitor.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
arithematic/logical expressions and literals.
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::go): support inner attrs, crate items and node mappings
(Dump::visit): support functions, arith/logical exprs, let stmts and literals
Signed-off-by: Abdul Rafey <abdulrafeyq@gmail.com>
|
|
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-fnparam.h
(CompileFnParam::visit): Remove HIR::GroupedPattern visitor.
* backend/rust-compile-pattern.cc
(CompilePatternCaseLabelExpr::visit): Remove HIR::GroupedPattern visitor.
(CompilePatternBindings::visit): Remove HIR::GroupedPattern visitor.
* backend/rust-compile-pattern.h
(CompilePatternCaseLabelExpr::visit): Remove HIR::GroupedPattern visitor.
(CompilePatternBindings::visit): Remove HIR::GroupedPattern visitor.
(CompilePatternLet::visit): Remove HIR::GroupedPattern visitor.
* backend/rust-compile-resolve-path.h
(ResolvePathRef::visit): Remove HIR::GroupedPattern visitor.
* backend/rust-compile-var-decl.h
(CompileVarDecl::visit): Remove HIR::GroupedPattern visitor.
* checks/errors/rust-const-checker.cc
(ConstChecker::visit): Remove HIR::GroupedPattern visitor.
* checks/errors/rust-const-checker.h
(ConstChecker::visit): Remove HIR::GroupedPattern visitor.
* checks/errors/rust-unsafe-checker.cc
(UnsafeChecker::visit): Remove HIR::GroupedPattern visitor.
* checks/errors/rust-unsafe-checker.h
(UnsafeChecker::visit): Remove HIR::GroupedPattern visitor.
* hir/rust-hir-dump.cc (Dump::visit): Remove HIR::GroupedPattern visitor.
* hir/rust-hir-dump.h (Dump::visit): Remove HIR::GroupedPattern visitor.
* hir/tree/rust-hir-full-decls.h (class GroupedPattern): Remove class.
* hir/tree/rust-hir-full-test.cc (GroupedPattern::accept_vis): Remove method.
* hir/tree/rust-hir-pattern.h (class GroupedPattern): Remove class.
* hir/tree/rust-hir-visitor.h
(HIRFullVisitor::visit): Remove HIR::GroupedPattern visitor.
(HIRFullVisitorBase::visit): Remove HIR::GroupedPattern visitor.
(HIRPatternVisitor::visit): Remove HIR::GroupedPattern visitor.
* typecheck/rust-hir-type-check-pattern.cc
(TypeCheckPattern::visit): Remove HIR::GroupedPattern visitor.
* typecheck/rust-hir-type-check-pattern.h
(TypeCheckPattern::visit): Remove HIR::GroupedPattern visitor.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): Remove unused parameters.
* backend/rust-constexpr.cc (constant_value_1): Likewise.
(fold_non_dependent_init): Likewise.
* backend/rust-tree.cc (publicly_uniquely_derived_p): Likewise.
(instantiation_dependent_expression_p): Likewise.
(type_has_nontrivial_copy_init): Likewise.
(is_normal_capture_proxy): Likewise.
(resolve_nondeduced_context): Likewise.
(undeduced_auto_decl): Likewise.
(require_deduced_type): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-reachability.cc (ReachabilityVisitor::visit): Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::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::go): Likewise.
* checks/lints/rust-lint-unused-var.cc (unused_var_walk_fn): Likewise.
* expand/rust-macro-builtins.cc (try_expand_single_string_literal): Likewise.
(try_expand_many_expr): Likewise.
(parse_single_string_literal): Likewise.
(MacroBuiltin::assert_handler): Likewise.
(MacroBuiltin::file_handler): Likewise.
(MacroBuiltin::column_handler): Likewise.
(MacroBuiltin::concat_handler): Likewise.
(MacroBuiltin::env_handler): Likewise.
(MacroBuiltin::line_handler): Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
(ASTLoweringBase::handle_doc_item_attribute): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/tree/rust-hir-full-test.cc (ConstGenericParam::accept_vis): Likewise.
* lex/rust-lex.cc (Lexer::parse_utf8_escape): Likewise.
(Lexer::parse_string): Likewise.
(Lexer::parse_char_or_lifetime): Likewise.
* lex/rust-lex.h: Likewise.
* metadata/rust-export-metadata.cc: Likewise.
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveType::visit): Likewise.
(ResolveTypeToCanonicalPath::visit): Likewise.
* resolve/rust-ast-verify-assignee.h: Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* typecheck/rust-hir-type-check-item.h: Likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise.
* typecheck/rust-tyty-rules.h: Likewise.
* util/rust-attributes.cc (AttributeChecker::visit): Likewise.
|
|
gcc/rust/ChangeLog:
* Make-lang.in: Add new object file for expression lowering.
* ast/rust-expr.h: Move implementation of expr lowering to source file.
* backend/rust-compile-block.h: Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* backend/rust-compile-expr.h: Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-const-checker.h: Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.h: Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-expr.h (RUST_AST_LOWER_EXPR): Likewise.
* hir/rust-ast-lower.cc (ASTLoweringBase::lower_closure_param): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/rust-hir-dump.h: Likewise.
* hir/tree/rust-hir-expr.h (class ClosureExpr): Likewise.
(class ClosureExprInner): Likewise.
(class ClosureExprInnerTyped): Likewise.
* hir/tree/rust-hir-full-decls.h (class ClosureExprInner): Likewise.
(class ClosureExprInnerTyped): Likewise.
* hir/tree/rust-hir-full-test.cc (ClosureExprInnerTyped::as_string): Likewise.
(ClosureExprInner::as_string): Likewise.
(ClosureExprInner::accept_vis): Likewise.
(ClosureExpr::accept_vis): Likewise.
(ClosureExprInnerTyped::accept_vis): Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
* hir/tree/rust-hir.h (class Expr): Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
* typecheck/rust-hir-type-check-expr.h: Likewise.
* hir/rust-ast-lower-expr.cc: New file.
|
|
|