Age | Commit message (Collapse) | Author | Files | Lines |
|
gcc/rust/ChangeLog:
* ast/rust-ast.cc (AttributeParser::parse_path_meta_item): Parse
expression instead of literal. Update variant name.
(MetaItemPathLit::to_attribute): Remove function.
(AttributeParser::parse_path_meta_item): Update name.
(MetaItemPathLit::check_cfg_predicate): Likewise.
(MetaItemPathExpr::check_cfg_predicate): Likewise.
(MetaItemPathLit::accept_vis): Likewise.
(MetaItemPathExpr::accept_vis): Likewise.
* ast/rust-ast-collector.h: Update prototype and adapt code to new
expression.
* ast/rust-ast-collector.cc: Update code to expr.
* ast/rust-ast-full-decls.h (class MetaItemPathLit): Likewise.
(class MetaItemPathExpr): Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast-visitor.h: Likewise.
* ast/rust-ast.h (class MetaItemPathLit): Rename class from here...
(class MetaItemPathExpr): ... to here.
* ast/rust-expr.h (class MetaItemPathLit): Rename class from here...
(class MetaItemPathExpr): ...to here.
* expand/rust-derive.h: Update class name.
* expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise.
* expand/rust-expand-visitor.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
Likewise.
* resolve/rust-early-name-resolver.h: Likewise.
* util/rust-attributes.cc (AttributeChecker::visit): Likewise.
* util/rust-attributes.h: Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
The main change can be found in ast/rust-pattern.h, which introduces 2 item types for
AST::SlicePattern - one without rest pattern (SlicePatternItemsNoRest) & the other with
it (SlicePatternItemsHasRest). This led to a number of cascading changes as seen in the
changelog.
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc: Add support for the 2 new classes.
* ast/rust-ast-collector.h: Header file update for above.
* ast/rust-ast-full-decls.h: Add forward decls for the 2 new classes.
* ast/rust-ast-visitor.cc: Add visit support for the 2 new classes.
* ast/rust-ast-visitor.h: Header file update for above.
* ast/rust-pattern.cc: Implementation of certain methods for the 2 new classes.
* ast/rust-pattern.h: Define the 2 new classes. Update SlicePattern to be able to hold
2 kinds of items - SlicePatternItemsNoRest or SlicePatternItemsRest.
* expand/rust-cfg-strip.cc: Add support for the 2 new classes.
* expand/rust-cfg-strip.h: Header file update for above.
* expand/rust-derive.h: Add visits for the 2 new classes.
* hir/rust-ast-lower-base.cc: Add visits for the 2 new classes.
* hir/rust-ast-lower-base.h: Header file update for above.
* hir/rust-ast-lower-pattern.cc: Update lowering of SlicePattern to support
SlicePatternItemsNoRest.
* parse/rust-parse-impl.h (parse_slice_pattern()): Add support for parsing DOT_DOT into
respective SlicePatternItems.
* resolve/rust-ast-resolve-base.cc: Add visits for the 2 new classes.
* resolve/rust-ast-resolve-base.h: Header file update for above.
* resolve/rust-ast-resolve-pattern.cc: Update SlicePattern resolution to support new
classes.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
gcc/rust/ChangeLog:
* Make-lang.in: Compile the offset_of handler.
* lang.opt: Add -frust-assume-builtin-offset-of option.
* ast/rust-ast.h: Add has_str() for const_TokenPtr.
* expand/rust-macro-builtins.cc: Map offset_of as builtin.
* expand/rust-macro-builtins.h: Declare it.
* expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Add hack for calling builtin
offset_of!().
* resolve/rust-early-name-resolver-2.0.cc (Early::visit): Likewise.
* expand/rust-macro-builtins-offset-of.cc: New file.
gcc/testsuite/ChangeLog:
* rust/compile/offset_of1.rs: New test.
|
|
gcc/rust/ChangeLog:
* ast/rust-ast.h: Add OffsetOf expression kind.
* ast/rust-builtin-ast-nodes.h (class OffsetOf): Add node.
* ast/rust-ast.cc: Define it.
* ast/rust-ast-collector.cc: Add visitor for OffsetOf.
* ast/rust-ast-collector.h: Likewise.
* ast/rust-ast-visitor.cc: Likewise.
* ast/rust-ast-visitor.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-expr.h: Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
* resolve/rust-early-name-resolver-2.0.cc: Likewise.
* expand/rust-derive.h:
|
|
This relies on the DefaultASTVisitor visitor for IfLetExprConseqElse
performing a virtual call of the visitor for IfLetExpr, which doesn't
hold when DefaultASTVisitor is generated by the X-macro-DSL-system I
have in another patch.
gcc/rust/ChangeLog:
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Add
visitor for IfLetExprConseqElse.
* resolve/rust-default-resolver.h (DefaultResolver::visit):
Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::resolve_glob_import): Adapt for enums.
(Early::finalize_glob_import): Likewise.
* resolve/rust-early-name-resolver-2.0.h: Likewise.
* resolve/rust-finalize-imports-2.0.cc (GlobbingVisitor::go): Likewise.
(GlobbingVisitor::visit_module_container): New function.
(GlobbingVisitor::visit_enum_container): New function.
* resolve/rust-finalize-imports-2.0.h: Declare them.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Insert enums as potential
containers.
gcc/testsuite/ChangeLog:
* rust/compile/glob_import_enum.rs: New test.
|
|
TopLevel would ignore just-loaded modules but Early and ExpandVisitor
wouldn't. The latter would produce errors when it hit attributes which
should have been indirectly CfgStrip'd away.
gcc/rust/ChangeLog:
* expand/rust-cfg-strip.cc (CfgStrip::visit): Load unloaded
modules.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Assume modules have been loaded by CfgStrip.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Check for a label
before visiting it.
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): New visitor.
* resolve/rust-late-name-resolver-2.0.h: Declare it.
* resolve/rust-name-resolution-context.h (enum class): New binding context.
|
|
This doesn't do anything beyond creating TryExpr and parsing them, so
try expressions shouldn't be able to make it past AST lowering yet.
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): Add visitor
for TryExpr.
* ast/rust-ast-collector.h (TokenCollector::visit): Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast-visitor.h (ASTVisitor::visit): Likewise.
(DefaultASTVisitor::visit): Likewise.
* expand/rust-derive.h (DeriveVisitor::visit): Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h (ASTLoweringBase::visit): Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit):
Likewise.
* resolve/rust-ast-resolve-base.h (ResolverBase::visit):
Likewise.
* ast/rust-ast-full-decls.h (class TryExpr): New forward class
declaration.
* ast/rust-ast.cc (TryExpr::as_string): New function.
(TryExpr::accept_vis): Likewise.
* ast/rust-expr.h (class TryExpr): New class.
* parse/rust-parse.h (Parser::parse_try_expr): New function.
* parse/rust-parse-impl.h (Parser::parse_try_expr): Likewise.
(Parser::null_denotation_not_path): Use parse_try_expr to parse
try expressions.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
DefaultResolver already handles StructStruct in a more correct fashion.
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Remove
override for StructStruct visitor.
* resolve/rust-late-name-resolver-2.0.h (Late::visit): Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This prioritizes resolution in the language prelude over resolution as a
module.
gcc/rust/ChangeLog:
* resolve/rust-forever-stack.hxx (ForeverStack::resolve_path):
Resolve final segments which point to modules.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Avoid inserting module names into ribs in the type namespace.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove issue-3315-2.rs.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc
(visit_identifier_as_pattern): Handle is_ref and is_mut.
(Late::visit): Likewise.
* resolve/rust-name-resolution-context.cc
(BindingLayer::insert_ident): Likewise.
(BindingLayer::bind_test): Handle changes to BindingLayer
fields.
(BindingLayer::merge): Likewise and emit more error messages.
* resolve/rust-name-resolution-context.h
(struct IdentifierMode): New.
(Binding::has_expected_bindings): New field.
(Binding::set): Rename field to...
(Binding::idents): ...here and convert from a set to a map.
(Binding::Binding): Initialize has_expected_bindings.
(BindingLayer::insert_ident): Adjust parameters.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove torture/alt_patterns1.rs.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This ensures Session::load_extern_crate doesn't try to use the old name
resolver when nr2.0 is enabled, while also ensuring that nr2.0 handles
external crates.
gcc/rust/ChangeLog:
* resolve/rust-default-resolver.cc
(DefaultResolver::visit_extern_crate): New function.
(DefaultResolver::visit): New visitor function for ExternCrate.
* resolve/rust-default-resolver.h
(DefaultResolver::visit_extern_crate): New function.
(DefaultResolver::visit): New visitor function for ExternCrate.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Adjust ExternCrate visitor and rename to...
(TopLevel::visit_extern_crate): ...here.
* resolve/rust-toplevel-name-resolver-2.0.h (TopLevel::visit):
Remove ExternCrate visitor override.
(TopLevel::visit_extern_crate): New function.
* rust-session-manager.cc (Session::load_extern_crate): Only run
name resolution 1.0 if name resolution 2.0 is disabled.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-default-resolver.cc (DefaultResolver::visit):
Call DefaultASTVisitor::visit even on ConstantItem instances
without expressions.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove issue-3642.rs.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This is an invalid test case and doesnt work with rustc, we dont fully pick
up the errors. Nr2 does handle this and puts out an extra good diagnostic
but the old NR doesnt so for now i added this to the exclude list and then
when we remove old name resolver this issue goes away.
Fixes Rust-GCC#3642
gcc/rust/ChangeLog:
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): check for has_expr
* hir/rust-hir-dump.cc (Dump::visit): likewise
* hir/tree/rust-hir-item.h: add has_expr helper
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): check for has_expr
* resolve/rust-ast-resolve-stmt.h: likewise
* typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): likewise
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: nr2 puts out an extra error
* rust/compile/issue-3642.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit(IdentifierPattern)):
Remove redundant subpattern check.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-ast-resolve-pattern.cc: Implement name resolution for
IdentifierPattern's subpattern.
* resolve/rust-late-name-resolver-2.0.cc: Ditto, but for nr2.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-default-resolver.cc (DefaultResolver::visit):
Adjust scoping of trait definitions and their generic
parameters.
* resolve/rust-forever-stack.hxx (ForeverStack::get): Prevent
lookups inside TraitOrImpl ribs.
(ForeverStack::resolve_segments): Prevent lookups of the first
segment inside TraitOrImpl ribs.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove entries.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-rib.h: Add missing switch cases.
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc
(visit_identifier_as_pattern): Make sure to map identifiers
inside or-bindings to prior identifiers.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-default-resolver.cc
(DefaultResolver::visit_closure_params): New member function
definition.
(DefaultResolver::visit): New visiting function definition for
ClosureExpr called from visiting functions for ClosureExprInner
and ClosureExprInnerTyped.
* resolve/rust-default-resolver.h
(DefaultResolver::visit_closure_params): New member function
declaration.
(DefaultResolver::visit): New visiting function declaration for
ClosureExpr.
* resolve/rust-late-name-resolver-2.0.cc (add_captures): Remove
function.
(Late::visit): New visiting function definition for ClosureExpr,
remove visiting function definitions for ClosureExprInner and
ClosureExprInnerTyped.
(Late::visit_closure_params): New member function definition.
* resolve/rust-late-name-resolver-2.0.h (Late::visit): New
visiting function declaration for ClosureExpr, remove visiting
function declarations for ClosureExprInner and
ClosureExprInnerTyped.
(Late::visit_closure_params): New member function declaration.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-forever-stack.hxx (ForeverStack::resolve_path):
Handle single segment paths "crate", "self", and "super".
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove entries.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Use
visit_identifier_as_pattern to handle IdentifierPattern and
StructPatternFieldIdent.
(visit_identifier_as_pattern): New function.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-expr.h (ClosureExpr::get_definition_expr): New
virtual member function.
(ClosureExprInner::get_definition_expr): Add override specifier.
(ClosureExprInnerTyped::get_definition_block): Rename to...
(ClosureExprInnerTyped::get_definition_expr): ...here and add
override specifier.
* ast/rust-ast-collector.cc (TokenCollector::visit): Handle
rename of ClosureExprInnerTyped::get_definition_block to
ClosureExprInnerTyped::get_definition_expr.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* expand/rust-cfg-strip.cc (CfgStrip::visit): Likewise.
* expand/rust-expand-visitor.cc (ExpandVisitor::visit):
Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Likewise.
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit):
Likewise.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit):
Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This should improve our canonical path handling, without requiring
further tweaks to ForeverStack. This may also help if, in the future, we
have to move canonical path calculation to later compilation phases for
proper handling of generics.
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc
(HIRCompileBase::compile_function): Since canonical paths
returned from nr2.0 now include the crate name, avoid prepending
the crate name again.
* backend/rust-compile-implitem.cc (CompileTraitItem::visit):
Use NameResolutionContext::to_canonical_path instead of
ForeverStack::to_canonical_path.
* backend/rust-compile-item.cc (CompileItem::visit): 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.cc
(TraitItemReference::get_type_from_fn): Likewise.
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Add
Crate and EnumItem instance visitors, handle canonical path
context scoping.
* resolve/rust-default-resolver.h (DefaultResolver::visit): Add
Crate and EnumItem instance visitors.
* resolve/rust-early-name-resolver-2.0.cc (Early::go): Visit
instances of Crate using the virtual member function visit.
* resolve/rust-forever-stack.h
(ForeverStack::to_canonical_path): Remove function declaration.
* resolve/rust-forever-stack.hxx
(ForeverStack::to_canonical_path): Remove function definition.
* resolve/rust-late-name-resolver-2.0.cc (Late::go): Visit
instances of Crate using the virtual member function visit.
* resolve/rust-name-resolution-context.cc
(CanonicalPathRecordCrateRoot::as_path): New function definition.
(CanonicalPathRecordNormal::as_path): Likewise.
(CanonicalPathRecordLookup::as_path): Likewise.
(CanonicalPathRecordImpl::as_path): Likewise.
(CanonicalPathRecordTraitImpl::as_path): Likewise.
(NameResolutionContext::NameResolutionContext): Initialize
member variable canonical_ctx.
* resolve/rust-name-resolution-context.h: Include "rust-item.h".
(class NameResolutionContext): Forward declare class.
(class CanonicalPathRecord): New class.
(class CanonicalPathRecordWithParent): Likewise.
(class CanonicalPathRecordCrateRoot): Likewise.
(class CanonicalPathRecordNormal): Likewise.
(class CanonicalPathRecordLookup): Likewise.
(class CanonicalPathRecordImpl): Likewise.
(class CanonicalPathRecordTraitImpl): Likewise.
(class CanonicalPathCtx): Likewise.
(NameResolutionContext::canonical_ctx): New member variable.
(NameResolutionContext::to_canonical_path): New member function.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::go):
Visit instances of Crate with the virtual member function visit.
(TopLevel::visit): Handle canonical path context scoping for
external crates, use DefaultResolver::visit when visiting
instances of StructStruct.
* util/rust-canonical-path.h (CanonicalPath::new_seg): Take path
parameter by-value, as a duplicate instance will be constructed
regardless.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove canonical_paths1.rs.
|
|
gcc/rust/ChangeLog:
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Use
visit_impl_type to visit the self types of impl blocks.
* resolve/rust-default-resolver.h
(DefaultResolver::visit_impl_type): New member function
declaration.
* resolve/rust-late-name-resolver-2.0.cc (Late::Late):
Initialize member variable block_big_self.
(Late::visit_impl_type): New member function definition.
(Late::visit): Check for Self while inside impl block self
types.
* resolve/rust-late-name-resolver-2.0.h (Late::visit_impl_type):
New member function.
(Late::block_big_self): New member variable.
gcc/testsuite/ChangeLog:
* rust/compile/issue-3671.rs: Remove usage of Self.
* rust/compile/nr2/exclude: Remove issue-3671.rs.
* rust/compile/self-in-impl.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-forever-stack.h
(enum ResolutionMode): New.
(ForeverStack::get): Add a private overload that takes a
starting node as a parameter.
(ForeverStack::resolve_path): Replace boolean parameter
has_opening_scope_resolution with ResolutionMode parameter mode.
* resolve/rust-forever-stack.hxx
(ForeverStack::resolve_path): Likewise.
(ForeverStack::get): Add a private overload that takes a
starting node as a parameter.
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Add Visibility visitor.
* resolve/rust-late-name-resolver-2.0.h
(Late::visit): Likewise.
* resolve/rust-name-resolution-context.h
(NameResolutionContext::resolve_path): Rework overloading a bit
and accept ResolutionMode parameter.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove entries.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-expr.h: Declare AnonConst and ConstBlock and use them.
* ast/rust-ast-full-decls.h: Likewise.
* ast/rust-ast.cc: Add implementation for AnonConst and ConstBlock.
* ast/rust-ast.h: Likewise.
* ast/rust-ast-collector.cc (TokenCollector::visit): Likewise.
* ast/rust-ast-collector.h: Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast-visitor.h: Likewise.
* expand/rust-derive.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-expr.cc (translate_operand_const): Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
* resolve/rust-ast-resolve-expr.h: Likewise.
* resolve/rust-ast-resolve-expr.cc: Likewise.
|
|
gcc/rust/ChangeLog:
* resolve/rust-default-resolver.cc
(DefaultResolver::visit_if_let_patterns): New function
definition.
(DefaultResolver::visit): New IfLetExpr visitor definition.
* resolve/rust-default-resolver.h
(DefaultResolver::visit_if_let_patterns): New function
declaration.
(DefaultResolver::visit): New IfLetExpr visitor declaration.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Remove
IfLetExpr visitor definition.
(Late::visit_if_let_patterns): New function definition.
* resolve/rust-late-name-resolver-2.0.h (Late::visit): Remove
IfLetExpr visitor declaration.
(Late::visit_if_let_patterns): New function declaration.
* resolve/rust-name-resolution-context.h (BindingSource::IfLet):
New enumerator.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Undefined attribute macros have no proc macro definition, which results
in a failing `rust_assert`. This changes that assert to an if statement,
that returns early if there is no proc macro definition. Fixes #3661.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes): rust_assert to if
gcc/testsuite/ChangeLog:
* rust/compile/issue-3661.rs: Test NR2 has expected behavior
Signed-off-by: Tom Schollenberger <tss2344@g.rit.edu>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): Only visit the path of an instance
of Visibility if the instance has a path.
* ast/rust-ast.h
(SimplePath::SimplePath): Make sure constructors are explicit.
* resolve/rust-early-name-resolver-2.0.cc
(Early::visit_attributes): Pass entire paths to
NameResolutionContext::resolve_path.
(Early::visit): Likewise and avoid copying a path.
* resolve/rust-forever-stack.hxx
(ForeverStack::resolve_path): Assert that at least one path
segment has been passed in.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
It changes declaration and switch case indentation to follow GNU coding
style.
gcc/rust/ChangeLog:
* ast/rust-ast-builder-type.cc (ASTTypeBuilder::visit): Reindent.
* ast/rust-ast-builder.cc (Builder::new_generic_args): Likewise.
* ast/rust-ast-collector.cc (TokenCollector::visit): Likewise.
* ast/rust-ast-dump.h (debug): Likewise.
* ast/rust-ast-formatting.h (indent_spaces): Likewise.
(get_string_in_delims): Likewise.
(get_mode_dump_desc): Likewise.
(append_attributes): Likewise.
(unquote_string): Likewise.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
* ast/rust-ast.cc (Attribute::get_traits_to_derive): Likewise.
(UseTreeGlob::as_string): Likewise.
(UseTreeList::as_string): Likewise.
(AttributeParser::parse_path_meta_item): Likewise.
(FormatArgs::set_outer_attrs): Likewise.
* ast/rust-ast.h (operator<<): Likewise.
* ast/rust-cond-compilation.h: Likewise.
* ast/rust-desugar-apit.cc: Likewise.
* ast/rust-fmt.h (collect_pieces): Likewise.
(clone_pieces): Likewise.
* ast/rust-pattern.h (tokenid_to_rangekind): Likewise.
* backend/rust-compile-context.cc (Context::type_hasher): Likewise.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* backend/rust-compile-intrinsic.cc (get_identifier): Likewise.
(offset_handler): Likewise.
(sizeof_handler): Likewise.
(transmute_handler): Likewise.
(rotate_handler): Likewise.
(wrapping_op_handler_inner): Likewise.
(op_with_overflow_inner): Likewise.
(uninit_handler): Likewise.
(move_val_init_handler): Likewise.
(assume_handler): Likewise.
(discriminant_value_handler): Likewise.
(variant_count_handler): Likewise.
(prefetch_data_handler): Likewise.
(atomic_store_handler_inner): Likewise.
(atomic_load_handler_inner): Likewise.
(unchecked_op_inner): Likewise.
(copy_handler_inner): Likewise.
(expect_handler_inner): Likewise.
(try_handler_inner): Likewise.
* backend/rust-compile-pattern.cc (compile_range_pattern_bound): Likewise.
(CompilePatternCheckExpr::visit): Likewise.
(CompilePatternBindings::visit): Likewise.
(CompilePatternLet::visit): Likewise.
* backend/rust-compile-var-decl.h: Likewise.
* backend/rust-constexpr.cc (verify_constant): Likewise.
(find_array_ctor_elt): Likewise.
(array_index_cmp): Likewise.
(potential_constant_expression_1): Likewise.
(unshare_constructor): Likewise.
(maybe_save_constexpr_fundef): Likewise.
(returns): Likewise.
(breaks): Likewise.
(continues): Likewise.
(switches): Likewise.
(constant_value_1): Likewise.
(decl_constant_value): Likewise.
(non_const_var_error): Likewise.
(eval_constant_expression): Likewise.
(constexpr_fn_retval): Likewise.
(eval_store_expression): Likewise.
(eval_call_expression): Likewise.
(eval_binary_expression): Likewise.
(get_function_named_in_call): Likewise.
(eval_statement_list): Likewise.
(extract_string_elt): Likewise.
(eval_conditional_expression): Likewise.
(eval_bit_field_ref): Likewise.
(eval_loop_expr): Likewise.
(eval_switch_expr): Likewise.
(eval_unary_expression): Likewise.
(get_or_insert_ctor_field): Likewise.
(eval_and_check_array_index): Likewise.
* backend/rust-constexpr.h (maybe_save_constexpr_fundef): Likewise.
* backend/rust-mangle-v0.cc (v0_path): Likewise.
(v0_complex_type_prefix): Likewise.
* backend/rust-mangle.h (legacy_mangle_item): Likewise.
(v0_mangle_item): Likewise.
* backend/rust-tree.cc (convert_to_void): Likewise.
(find_parameter_packs_r): Likewise.
(rs_tree_equal): Likewise.
(publicly_uniquely_derived_p): Likewise.
(instantiation_dependent_expression_p): Likewise.
(type_has_nontrivial_copy_init): Likewise.
(is_normal_capture_proxy): Likewise.
(is_bitfield_expr_with_lowered_type): Likewise.
(undeduced_auto_decl): Likewise.
(require_deduced_type): Likewise.
(gt_pch_nx): Likewise.
(lvalue_kind): Likewise.
* backend/rust-tree.h (LANG_DECL_MIN_CHECK): Likewise.
(LANG_DECL_FN_CHECK): Likewise.
(LANG_DECL_NS_CHECK): Likewise.
(LANG_DECL_PARM_CHECK): Likewise.
(LANG_DECL_DECOMP_CHECK): Likewise.
(resort_type_member_vec): Likewise.
(convert_to_void): Likewise.
(mark_discarded_use): Likewise.
(mark_exp_read): Likewise.
(mark_use): Likewise.
(mark_rvalue_use): Likewise.
(mark_lvalue_use): Likewise.
(mark_lvalue_use_nonread): Likewise.
(convert_from_reference): Likewise.
(maybe_warn_nodiscard): Likewise.
(expr_loc_or_loc): Likewise.
(expr_loc_or_input_loc): Likewise.
(get_fndecl_from_callee): Likewise.
(pointer_offset_expression): Likewise.
(is_empty_class): Likewise.
(is_really_empty_class): Likewise.
(rs_type_quals): Likewise.
(init_modules): Likewise.
(lookup_add): Likewise.
(ovl_make): Likewise.
(struct c_fileinfo): Likewise.
(get_fileinfo): Likewise.
(cxx_make_type): Likewise.
(build_cplus_array_type): Likewise.
(comptypes): Likewise.
(rs_build_qualified_type_real): Likewise.
(vector_targets_convertible_p): Likewise.
(get_class_binding_direct): Likewise.
(lang_check_failed): Likewise.
(check_for_uninitialized_const_var): Likewise.
(cp_fold_maybe_rvalue): Likewise.
(fold_offsetof): Likewise.
(fold_non_dependent_expr): Likewise.
(in_immediate_context): Likewise.
(cxx_mark_addressable): Likewise.
(decl_constant_value): Likewise.
(is_class_type): Likewise.
(fold_builtin_is_pointer_inverconvertible_with_class): Likewise.
(c_common_type_for_mode): Likewise.
(next_common_initial_seqence): Likewise.
(fold_builtin_is_corresponding_member): Likewise.
(maybe_constant_value): Likewise.
(rs_walk_subtrees): Likewise.
(make_tree_vector): Likewise.
(release_tree_vector): Likewise.
(location_of): Likewise.
(maybe_constant_init): Likewise.
(explain_invalid_constexpr_fn): Likewise.
(literal_type_p): Likewise.
(maybe_constexpr_fn): Likewise.
(fold_non_dependent_init): Likewise.
* checks/errors/borrowck/polonius/rust-polonius.h (polonius_run): Likewise.
(FFIVector__new): Likewise.
(FFIVector__new_vec_pair): Likewise.
(FFIVector__new_vec_triple): Likewise.
(FFIVector__push): Likewise.
(FFIVector__push_vec_triple): Likewise.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc
(ExprStmtBuilder::visit): Likewise.
* checks/errors/borrowck/rust-bir-builder-pattern.cc
(PatternBindingBuilder::visit): Likewise.
* checks/errors/borrowck/rust-bir-dump.cc (Dump::visit): Likewise.
* checks/errors/borrowck/rust-bir-fact-collector.h (points): Likewise.
* checks/errors/borrowck/rust-bir-place.h: Likewise.
* checks/errors/borrowck/rust-bir-visitor.h: Likewise.
* checks/errors/privacy/rust-privacy-check.cc (saw_errors): Likewise.
* checks/errors/privacy/rust-privacy-ctx.h (rust_privacy_ctx_test): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::check_for_privacy_violation): Likewise.
(PrivacyReporter::check_base_type_privacy): Likewise.
(PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-reachability.cc (ReachabilityVisitor::visit): Likewise.
* checks/errors/privacy/rust-visibility-resolver.cc
(VisibilityResolver::resolve_visibility): Likewise.
* checks/errors/rust-hir-pattern-analysis.cc (Constructor::is_covered_by): Likewise.
(PlaceInfo::specialize): Likewise.
(WitnessPat::to_string): Likewise.
(WitnessMatrix::apply_constructor): Likewise.
(lower_pattern): Likewise.
(lower_tuple_pattern): Likewise.
(lower_struct_pattern): Likewise.
* checks/errors/rust-hir-pattern-analysis.h (check_match_usefulness): Likewise.
* expand/rust-cfg-strip.cc (CfgStrip::maybe_strip_generic_args): Likewise.
* expand/rust-derive-eq.cc (DeriveEq::visit_enum): Likewise.
* expand/rust-derive.cc: Likewise.
* expand/rust-expand-format-args.cc (expand_format_args): Likewise.
* expand/rust-expand-visitor.h (is_derive): Likewise.
(is_builtin): Likewise.
* expand/rust-macro-builtins-asm.cc (expand_inline_asm_strings): Likewise.
* expand/rust-macro-builtins-asm.h (parse_asm): Likewise.
(check_identifier): Likewise.
(check_and_set): Likewise.
(parse_label): Likewise.
(parse_llvm_outputs): Likewise.
(parse_llvm_inputs): Likewise.
(parse_llvm_clobbers): Likewise.
(parse_llvm_options): Likewise.
* expand/rust-macro-builtins-helpers.h (make_macro_path_str): Likewise.
(make_token): Likewise.
(make_string): Likewise.
(macro_end_token): Likewise.
(parse_single_string_literal): Likewise.
(source_relative_path): Likewise.
(load_file_bytes): Likewise.
* expand/rust-macro-expand.cc (MacroExpander::match_fragment): Likewise.
(MacroExpander::match_matcher): Likewise.
(MacroExpander::match_n_matches): Likewise.
* expand/rust-macro-substitute-ctx.cc (SubstituteCtx::substitute_token): Likewise.
* expand/rust-proc-macro.h (load_macros): Likewise.
(generate_proc_macro_decls_symbol): Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_generic_args): Likewise.
(ASTLoweringBase::lower_range_pattern_bound): Likewise.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Likewise.
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Likewise.
* hir/rust-ast-lower.h (struct_field_name_exists): Likewise.
(translate_visibility): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/rust-hir-dump.h (debug): Likewise.
* hir/tree/rust-hir.cc (UseTreeGlob::as_string): Likewise.
(UseTreeList::as_string): Likewise.
* lex/rust-lex.cc (Lexer::parse_escape): Likewise.
(Lexer::parse_utf8_escape): Likewise.
* lex/rust-lex.h (rust_input_source_test): Likewise.
* lex/rust-token.cc (RS_TOKEN_KEYWORD_2015): Likewise.
* lex/rust-token.h (get_token_description): Likewise.
(token_id_to_str): Likewise.
(token_id_is_keyword): Likewise.
(token_id_keyword_string): Likewise.
(get_type_hint_string): Likewise.
(nfc_normalize_token_string): Likewise.
* metadata/rust-export-metadata.cc (PublicInterface::write_to_path): Likewise.
* metadata/rust-import-archive.cc: Likewise.
* metadata/rust-imports.h (add_search_path): Likewise.
* parse/rust-cfg-parser.h (parse_cfg_option): Likewise.
(rust_cfg_parser_test): Likewise.
* parse/rust-parse-impl.h (Parser::skip_generics_right_angle): Likewise.
(Parser::parse_attr_input): Likewise.
(Parser::parse_macro_match): Likewise.
(Parser::parse_visibility): Likewise.
(Parser::parse_module): Likewise.
(Parser::parse_use_tree): Likewise.
(Parser::parse_generic_param): Likewise.
(Parser::parse_struct): Likewise.
(Parser::parse_enum_item): Likewise.
(Parser::parse_inherent_impl_item): Likewise.
(Parser::parse_external_item): Likewise.
(Parser::parse_generic_arg): Likewise.
(Parser::parse_type_path_segment): Likewise.
(Parser::parse_expr_stmt): Likewise.
(Parser::parse_if_expr): Likewise.
(Parser::parse_if_let_expr): Likewise.
(Parser::parse_type): Likewise.
(Parser::parse_for_prefixed_type): Likewise.
(Parser::parse_slice_or_array_type): Likewise.
(Parser::parse_type_no_bounds): Likewise.
(Parser::parse_range_pattern_bound): Likewise.
(Parser::parse_pattern_no_alt): Likewise.
(Parser::parse_grouped_or_tuple_pattern): Likewise.
(Parser::parse_ident_leading_pattern): Likewise.
(Parser::parse_tuple_struct_items): Likewise.
(Parser::parse_stmt_or_expr): Likewise.
(Parser::parse_struct_expr_field): Likewise.
(Parser::null_denotation): Likewise.
(Parser::left_denotation): Likewise.
(Parser::parse_closure_expr_pratt): Likewise.
* parse/rust-parse.cc (peculiar_fragment_match_compatible): Likewise.
(is_match_compatible): Likewise.
* parse/rust-parse.h (extract_module_path): Likewise.
(is_match_compatible): Likewise.
* resolve/rust-ast-resolve-expr.cc (translate_operand): Likewise.
* resolve/rust-ast-resolve-item.cc (flatten_glob): Likewise.
(flatten_rebind): Likewise.
(flatten_list): Likewise.
(flatten): Likewise.
* resolve/rust-ast-resolve-item.h (rust_simple_path_resolve_test): Likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): Likewise.
(resolve_range_pattern_bound): Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise.
(ResolveTypeToCanonicalPath::visit): Likewise.
* resolve/rust-ast-resolve.cc (saw_errors): Likewise.
* resolve/rust-early-name-resolver-2.0.cc (Early::finalize_rebind_import): Likewise.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (flatten_glob): Likewise.
* rust-backend.h (init): Likewise.
(debug): Likewise.
(get_identifier_node): Likewise.
(wchar_type): Likewise.
(get_pointer_size): Likewise.
(raw_str_type): Likewise.
(integer_type): Likewise.
(float_type): Likewise.
(pointer_type): Likewise.
(reference_type): Likewise.
(immutable_type): Likewise.
(function_type): Likewise.
(function_type_variadic): Likewise.
(function_ptr_type): Likewise.
(struct_type): Likewise.
(union_type): Likewise.
(array_type): Likewise.
(named_type): Likewise.
(type_field_offset): Likewise.
(var_expression): Likewise.
(float_constant_expression): Likewise.
(string_constant_expression): Likewise.
(char_constant_expression): Likewise.
(wchar_constant_expression): Likewise.
(boolean_constant_expression): Likewise.
(convert_expression): Likewise.
(struct_field_expression): Likewise.
(compound_expression): Likewise.
(conditional_expression): Likewise.
(negation_expression): Likewise.
(arithmetic_or_logical_expression): Likewise.
(arithmetic_or_logical_expression_checked): Likewise.
(comparison_expression): Likewise.
(lazy_boolean_expression): Likewise.
(constructor_expression): Likewise.
(array_constructor_expression): Likewise.
(array_initializer): Likewise.
(array_index_expression): Likewise.
(call_expression): Likewise.
(init_statement): Likewise.
(assignment_statement): Likewise.
(return_statement): Likewise.
(if_statement): Likewise.
(loop_expression): Likewise.
(exit_expression): Likewise.
(statement_list): Likewise.
(exception_handler_statement): Likewise.
(block): Likewise.
(block_add_statements): Likewise.
(global_variable): Likewise.
(global_variable_set_init): Likewise.
(local_variable): Likewise.
(parameter_variable): Likewise.
(static_chain_variable): Likewise.
(temporary_variable): Likewise.
(label): Likewise.
(function): Likewise.
(function_defer_statement): Likewise.
(function_set_parameters): Likewise.
(write_global_definitions): Likewise.
(fill_in_fields): Likewise.
* rust-diagnostics.cc (expand_format): Likewise.
(expand_message): Likewise.
(va_constructor): Likewise.
* rust-diagnostics.h (RUST_ATTRIBUTE_GCC_DIAG): Likewise.
(rust_open_quote): Likewise.
(rust_close_quote): Likewise.
(rust_debug_loc): Likewise.
* rust-gcc.cc (non_zero_size_type): Likewise.
* rust-object-export.h (rust_field_alignment): Likewise.
(rust_read_export_data): Likewise.
(rust_write_export_data): Likewise.
* rust-session-manager.cc (saw_errors): Likewise.
(rust_get_linemap): Likewise.
(validate_crate_name): Likewise.
(Session::load_extern_crate): Likewise.
* rust-session-manager.h (rust_crate_name_validation_test): Likewise.
* rust-system.h (rust_preserve_from_gc): Likewise.
(rust_localize_identifier): Likewise.
* rust-target.h (rust_add_target_info): Likewise.
* typecheck/rust-autoderef.cc:
* typecheck/rust-casts.cc (TypeCastRules::cast_rules): Likewise.
* typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion): Likewise.
(TypeCoercionRules::coerce_unsafe_ptr): Likewise.
(TypeCoercionRules::coerce_borrowed_pointer): Likewise.
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): Likewise.
(TraitItemReference::is_object_safe): Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
(typecheck_inline_asm_operand): Likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit): Likewise.
(TypeCheckImplItemWithTrait::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::apply_trait_bounds): Likewise.
(ResolveWhereClauseItem::visit): Likewise.
* typecheck/rust-hir-type-check.cc (saw_errors): Likewise.
(TraitItemReference::get_type_from_fn): Likewise.
* typecheck/rust-type-util.h (query_type): Likewise.
(types_compatable): Likewise.
(unify_site): Likewise.
(unify_site_and): Likewise.
(coercion_site): Likewise.
(try_coercion): Likewise.
(cast_site): Likewise.
* typecheck/rust-tyty-bounds.cc:
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise.
* typecheck/rust-tyty-cmp.h:
* typecheck/rust-tyty-variance-analysis.h (query_field_regions): Likewise.
* typecheck/rust-tyty.cc (BaseType::is_unit): Likewise.
(BaseType::has_substitutions_defined): Likewise.
(BaseType::needs_generic_substitutions): Likewise.
(BaseType::get_subst_argument_mappings): Likewise.
(InferType::default_type): Likewise.
(InferType::apply_primitive_type_hint): Likewise.
* typecheck/rust-tyty.h (is_primitive_type_kind): Likewise.
* typecheck/rust-unify.cc (UnifyRules::expect_inference_variable): Likewise.
(UnifyRules::expect_adt): Likewise.
(UnifyRules::expect_str): Likewise.
(UnifyRules::expect_reference): Likewise.
(UnifyRules::expect_pointer): Likewise.
(UnifyRules::expect_param): Likewise.
(UnifyRules::expect_array): Likewise.
(UnifyRules::expect_slice): Likewise.
(UnifyRules::expect_fndef): Likewise.
(UnifyRules::expect_fnptr): Likewise.
(UnifyRules::expect_tuple): Likewise.
(UnifyRules::expect_bool): Likewise.
(UnifyRules::expect_char): Likewise.
(UnifyRules::expect_int): Likewise.
(UnifyRules::expect_uint): Likewise.
(UnifyRules::expect_float): Likewise.
(UnifyRules::expect_isize): Likewise.
(UnifyRules::expect_usize): Likewise.
(UnifyRules::expect_never): Likewise.
(UnifyRules::expect_placeholder): Likewise.
(UnifyRules::expect_projection): Likewise.
(UnifyRules::expect_dyn): Likewise.
(UnifyRules::expect_closure): Likewise.
(UnifyRules::expect_opaque): Likewise.
* util/rust-abi.h (get_abi_from_string): Likewise.
(get_string_from_abi): Likewise.
* util/rust-attributes.cc (check_doc_attribute): Likewise.
* util/rust-base62.h (base62_integer): Likewise.
* util/rust-dir-owner.h (get_file_subdir): Likewise.
* util/rust-edition.h (get_rust_edition): Likewise.
* util/rust-punycode.h (encode_punycode): Likewise.
(rust_punycode_encode_test): Likewise.
* util/rust-token-converter.cc (convert): Likewise.
(from_tokenstream): Likewise.
* util/rust-token-converter.h (convert): Likewise.
(convert_literal): Likewise.
* util/rust-unicode.h (is_alphabetic): Likewise.
(is_ascii_only): Likewise.
(is_numeric): Likewise.
(is_nfc_qc_no): Likewise.
(is_nfc_qc_maybe): Likewise.
(nfc_quick_check): Likewise.
(rust_nfc_qc_test): Likewise.
(rust_utf8_normalize_test): Likewise.
(rust_utf8_property_test): Likewise.
* util/rust-unwrap-segment.h (unwrap_segment_node_id): Likewise.
libgrust/ChangeLog:
* libproc_macro_internal/ffistring.h (FFIString__new): Likewise.
(FFIString__drop): Likewise.
* libproc_macro_internal/ident.h (Ident__new): Likewise.
(Ident__new_raw): Likewise.
(Ident__drop): Likewise.
(Ident__clone): Likewise.
* libproc_macro_internal/literal.h (Literal__from_string): Likewise.
* libproc_macro_internal/proc_macro.h (bridge_is_available): Likewise.
* libproc_macro_internal/tokenstream.h (TokenStream__new): Likewise.
(TokenStream__with_capacity): Likewise.
(TokenSream__push): Likewise.
(TokenStream__from_string): Likewise.
(TokenStream__clone): Likewise.
(TokenStream__drop): Likewise.
|
|
gcc/rust/ChangeLog:
* ast/rust-path.cc
(TypePath::make_debug_string): Add definition.
* ast/rust-path.h
(TypePath::make_debug_string): Add declaration.
* resolve/rust-default-resolver.cc
(DefaultResolver::visit): Adjust InherentImpl and TraitImpl
visitors to better handle associated item scope.
* resolve/rust-default-resolver.h
(DefaultResolver::maybe_insert_big_self): Add.
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Adjust type path resolution errors.
* resolve/rust-rib.h
(Rib::Kind): Add Generics kind.
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Remove InherentImpl and TraitImpl visitor
overrides.
(TopLevel::maybe_insert_big_self): Add override in order to add
a definition of 'Self'.
* resolve/rust-toplevel-name-resolver-2.0.h
(TopLevel::visit): Remove InherentImpl and TraitImpl visitor
overrides.
(TopLevel::maybe_insert_big_self): Add override.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove entries.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): Make call to EnumItem visitor from
EnumItem derived class visitors non-virtual.
* ast/rust-collect-lang-items.cc
(CollectLangItems::visit): Handle visitation of classes derived
from EnumItem.
* ast/rust-collect-lang-items.h
(CollectLangItems::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Call DefaultResolver::visit on EnumItem
instances.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-ast-resolve-item.cc
(ResolveItem::visit): Use the return values of
CanonicalPath::inherent_impl_seg and
CanonicalPath::trait_impl_projection_seg more directly.
* util/rust-canonical-path.h
(CanonicalPath::trait_impl_projection_seg): Append "<impl "
instead of "<" to the beginning of the returned path segment.
(CanonicalPath::inherent_impl_seg): Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Argument position impl traits are simply syntatic sugar for generics. This
adds a new desugar pass to do this. So for example:
fn foo(a: impl Value, b: impl Value) -> i32
Is desugared into:
fn foo<T: Value, U: Value> (a: T, b: U) -> i32
So it just works like any normal generic function. There are more complex cases such as:
fn foo(_value: impl Bar<Baz = impl Foo>) -> i32
Which has a generic argument binding which needs to be turned into a where constraint:
fn foo<T, U>(_value: T) -> i32
where
T: Bar<Baz = U>,
U: Foo,
Fixes Rust-GCC#2015
Fixes Rust-GCC#1487
Fixes Rust-GCC#3454
Fixes Rust-GCC#1482
gcc/rust/ChangeLog:
* Make-lang.in: new desugar file
* ast/rust-ast.cc (ImplTraitTypeOneBound::as_string): its a unique_ptr now
(FormatArgs::set_outer_attrs): reformat
* ast/rust-path.h: remove has_generic_args assertion (can be empty because of desugar)
* ast/rust-type.h (class ImplTraitTypeOneBound): add copy ctor and use unique_ptr
* hir/rust-ast-lower-type.cc (ASTLoweringType::visit): update to use unique_ptr
* parse/rust-parse-impl.h (Parser::parse_type): reuse the existing unique_ptr instead
(Parser::parse_type_no_bounds): likewise
(Parser::parse_pattern): likewise
* resolve/rust-ast-resolve-type.cc (ResolveType::visit): its a unique_ptr now
* rust-session-manager.cc (Session::compile_crate): call desugar
* ast/rust-desugar-apit.cc: New file.
* ast/rust-desugar-apit.h: New file.
gcc/testsuite/ChangeLog:
* rust/compile/issue-2015.rs: fully supported now
* rust/compile/nr2/exclude: nr2 cant handle some of these
* rust/compile/issue-1487.rs: New test.
* rust/compile/issue-3454.rs: New test.
* rust/execute/torture/impl_desugar-2.rs: New test.
* rust/execute/torture/impl_desugar.rs: New test.
* rust/execute/torture/impl_trait1.rs: New test.
* rust/execute/torture/impl_trait2.rs: New test.
* rust/execute/torture/impl_trait3.rs: New test.
* rust/execute/torture/impl_trait4.rs: New test.
* rust/execute/torture/issue-1482.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::Late): False initialize the
funny_error field.
|
|
No functional change intended.
gcc/c-family/ChangeLog:
* c-common.cc: Update usage of "diagnostic_info" to explicitly
refer to "diagnostics::diagnostic_info".
* c-opts.cc: Likewise.
gcc/c/ChangeLog:
* c-errors.cc: Update usage of "diagnostic_info" to explicitly
refer to "diagnostics::diagnostic_info".
gcc/cp/ChangeLog:
* constexpr.cc: Update usage of "diagnostic_info" to explicitly
refer to "diagnostics::diagnostic_info".
* cp-tree.h: Likewise.
* error.cc: Likewise.
* module.cc: Likewise.
gcc/d/ChangeLog:
* d-diagnostic.cc: Likewise.
gcc/ChangeLog:
* diagnostic.h: Eliminate "diagnostic_info" typedef.
* diagnostics/context.cc: Update usage of "diagnostic_info" to
explicitly refer to "diagnostics::diagnostic_info".
* langhooks.cc: Likewise.
* libgdiagnostics.cc: Likewise.
* rtl-error.cc: Likewise.
* substring-locations.cc: Likewise.
* toplev.cc: Likewise.
* tree-diagnostic.cc: Likewise.
* tree-diagnostic.h: Likewise.
gcc/fortran/ChangeLog:
* cpp.cc: Update usage of "diagnostic_info" to explicitly refer to
"diagnostics::diagnostic_info".
* error.cc: Likewise.
gcc/jit/ChangeLog:
* dummy-frontend.cc: Update usage of "diagnostic_info" to
explicitly refer to "diagnostics::diagnostic_info".
gcc/m2/ChangeLog:
* gm2-gcc/m2linemap.cc: Update usage of "diagnostic_info" to
explicitly refer to "diagnostics::diagnostic_info".
* gm2-gcc/rtegraph.cc: Likewise.
gcc/rust/ChangeLog:
* resolve/rust-ice-finalizer.cc: Update usage of "diagnostic_info"
to explicitly refer to "diagnostics::diagnostic_info".
* resolve/rust-ice-finalizer.h: Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/plugin/show_template_tree_color_plugin.cc: Update usage
of "diagnostic_info" to explicitly refer to
"diagnostics::diagnostic_info".
* gcc.dg/plugin/diagnostic_group_plugin.cc: Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise.
* gcc.dg/plugin/location_overflow_plugin.cc: Likewise.
libcc1/ChangeLog:
* context.cc: Update usage of "diagnostic_info" to explicitly
refer to "diagnostics::diagnostic_info".
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
|
|
No functional change intended.
gcc/ChangeLog:
* Makefile.in: Replace diagnostic.def with diagnostics/kinds.def.
* config/aarch64/aarch64.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* config/i386/i386-options.cc: Likewise.
* config/s390/s390.cc: Likewise.
* diagnostic-core.h: Replace typedef diagnostic_t with
enum class diagnostics::kind in diagnostics/kinds.h and include
it.
* diagnostic-global-context.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* diagnostic.cc: Likewise.
* diagnostic.h: Likewise.
* diagnostics/buffering.cc: Likewise.
* diagnostics/buffering.h: Likewise.
* diagnostics/context.h: Likewise.
* diagnostics/diagnostic-info.h: Likewise.
* diagnostics/html-sink.cc: Likewise.
* diagnostic.def: Move to...
* diagnostics/kinds.def: ...here and update for diagnostic_t
becoming enum class diagnostics::kind.
* diagnostics/kinds.h: New file, based on material in
diagnostic-core.h.
* diagnostics/lazy-paths.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* diagnostics/option-classifier.cc: Likewise.
* diagnostics/option-classifier.h: Likewise.
* diagnostics/output-spec.h: Likewise.
* diagnostics/paths-output.cc: Likewise.
* diagnostics/sarif-sink.cc: Likewise.
* diagnostics/selftest-context.cc: Likewise.
* diagnostics/selftest-context.h: Likewise.
* diagnostics/sink.h: Likewise.
* diagnostics/source-printing.cc: Likewise.
* diagnostics/text-sink.cc: Likewise.
* diagnostics/text-sink.h: Likewise.
* gcc.cc: Likewise.
* libgdiagnostics.cc: Likewise.
* lto-wrapper.cc: Likewise.
* opts-common.cc: Likewise.
* opts-diagnostic.h: Likewise.
* opts.cc: Likewise.
* rtl-error.cc: Likewise.
* substring-locations.cc: Likewise.
* toplev.cc: Likewise.
gcc/ada/ChangeLog:
* gcc-interface/trans.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
gcc/analyzer/ChangeLog:
* pending-diagnostic.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* program-point.cc: Likewise.
gcc/c-family/ChangeLog:
* c-common.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* c-format.cc: Likewise.
* c-lex.cc: Likewise.
* c-opts.cc: Likewise.
* c-pragma.cc: Likewise.
* c-warn.cc: Likewise.
gcc/c/ChangeLog:
* c-errors.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* c-parser.cc: Likewise.
* c-typeck.cc: Likewise.
gcc/cobol/ChangeLog:
* util.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
gcc/cp/ChangeLog:
* call.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* constexpr.cc: Likewise.
* cp-tree.h: Likewise.
* decl.cc: Likewise.
* error.cc: Likewise.
* init.cc: Likewise.
* method.cc: Likewise.
* module.cc: Likewise.
* parser.cc: Likewise.
* pt.cc: Likewise.
* semantics.cc: Likewise.
* typeck.cc: Likewise.
* typeck2.cc: Likewise.
gcc/d/ChangeLog:
* d-diagnostic.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
gcc/fortran/ChangeLog:
* cpp.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* error.cc: Likewise.
* options.cc: Likewise.
gcc/jit/ChangeLog:
* dummy-frontend.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
gcc/m2/ChangeLog:
* gm2-gcc/m2linemap.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* gm2-gcc/rtegraph.cc: Likewise.
gcc/rust/ChangeLog:
* backend/rust-tree.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* backend/rust-tree.h: Likewise.
* resolve/rust-ast-resolve-expr.cc: Likewise.
* resolve/rust-ice-finalizer.cc: Likewise.
* resolve/rust-ice-finalizer.h: Likewise.
* resolve/rust-late-name-resolver-2.0.cc: Likewise.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Update for
diagnostic_t becoming enum class diagnostics::kind.
* gcc.dg/plugin/expensive_selftests_plugin.cc: Likewise.
* gcc.dg/plugin/location_overflow_plugin.cc: Likewise.
* lib/gcc-dg.exp: Likewise.
libcpp/ChangeLog:
* internal.h: Update comment for diagnostic_t becoming
enum class diagnostics::kind.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
|
|
No functional change intended.
gcc/ada/ChangeLog:
* gcc-interface/misc.cc: Update for diagnostic_context becoming
diagnostics::context.
gcc/analyzer/ChangeLog:
* program-point.cc: : Update for diagnostic_context becoming
diagnostics::context, and for diagnostic_source_print_policy
becoming diagnostics::source_print_policy.
gcc/c-family/ChangeLog:
* c-common.h: Update for diagnostic_context becoming
diagnostics::context.
* c-opts.cc: Likewise.
gcc/c/ChangeLog:
* c-objc-common.cc: Update for diagnostic_context becoming
diagnostics::context.
* c-tree.h: Likewise.
gcc/ChangeLog:
* coretypes.h: Update for diagnostic_context becoming
diagnostics::context.
* diagnostic-global-context.cc: Likewise.
* diagnostic.cc: Likewise. Also for diagnostic_option_classifier
becoming diagnostics::option_classifier.
* diagnostic.h (diagnostic_text_starter_fn): Rename to...
(diagnostics::text_starter_fn): ...this, and move to
diagnostics/context.h.
(get_printer): Rename to...
(diagnostics::get_printer): ...this, and move to
diagnostics/context.h.
(class diagnostic_option_manager): Rename to...
(class diagnostics::option_manager): ...this, and move to
diagnostics/context.h.
(class diagnostic_option_classifier): Rename to...
(class diagnostics::option_classifier): ...this, and move to
diagnostics/context.h.
(struct diagnostic_source_printing_options): Rename to...
(struct diagnostics::source_printing_options): ...this, and move
to diagnostics/context.h.
(class diagnostic_column_policy): Rename to...
(class diagnostics::column_policy): ...this, and move to
diagnostics/context.h.
(class diagnostic_location_print_policy): Rename to...
(class diagnostics::location_print_policy): ...this, and move to
diagnostics/context.h.
(class html_label_writer): Rename to...
(class diagnostics::html_label_writer): ...this, and move to
diagnostics/context.h.
(class diagnostic_source_print_policy): Rename to...
(class diagnostics::source_print_policy): ...this, and move to
diagnostics/context.h.
(struct diagnostic_counters): Rename to...
(struct diagnostics::counters): ...this, and move to
diagnostics/context.h.
(class diagnostic_context): Rename to...
(class diagnostics::context): ...this, and move to
diagnostics/context.h.
(diagnostic_text_starter): Rename to...
(diagnostics::text_starter): ...this, and move to
diagnostics/context.h.
(diagnostic_start_span): Rename to...
(diagnostics::start_span): ...this, and move to
diagnostics/context.h.
(diagnostic_text_finalizer): Rename to...
(diagnostics::text_finalizer): ...this, and move to
diagnostics/context.h.
Include "diagnostics/context.h".
* diagnostics/buffering.h: Update for diagnostic_context becoming
diagnostics::context; similarly for diagnostic_counters.
* diagnostics/client-data-hooks.h: Likewise.
* diagnostics/context.h: New file, taken from material in
diagnostic.h.
* diagnostics/html-sink.cc: : Update for diagnostic_context
becoming diagnostics::context.
* diagnostics/html-sink.h: Likewise.
* diagnostics/lazy-paths.cc: Likewise for
diagnostic_option_manager.
* diagnostics/output-file.h: Likewise for diagnostic_context.
* diagnostics/output-spec.cc: Likewise.
* diagnostics/output-spec.h: Likewise.
* diagnostics/paths-output.cc: Likewise.
* diagnostics/sarif-sink.cc: Likewise.
* diagnostics/sarif-sink.h: Likewise.
* diagnostics/sink.h: Likewise.
* diagnostics/source-printing.cc: Likewise.
* diagnostics/text-sink.cc: Likewise.
* diagnostics/text-sink.h: Likewise.
* gcc-rich-location.h: Likewise.
* gcc.cc: Likewise.
* gdbinit.in: Likewise.
* langhooks-def.h: Likewise.
* langhooks.cc: Likewise.
* langhooks.h: Likewise.
* libgdiagnostics.cc: Likewise.
* optc-gen.awk: Likewise.
* opth-gen.awk: Likewise.
* opts-common.cc: Likewise.
* opts-diagnostic.cc: Likewise.
* opts-diagnostic.h: Likewise.
* opts-global.cc: Likewise.
* opts.cc: Likewise.
* opts.h: Likewise.
* selftest-diagnostic.cc: Likewise.
* selftest-diagnostic.h: Likewise.
* toplev.cc: Likewise.
* tree-diagnostic-client-data-hooks.cc: Likewise.
* tree-diagnostic.cc: Likewise.
* tree-diagnostic.h: Likewise.
gcc/cp/ChangeLog:
* cp-tree.h: Update for diagnostic_context becoming
diagnostics::context.
* error.cc: Likewise.
* module.cc: Likewise.
gcc/fortran/ChangeLog:
* error.cc: Update for diagnostic_context becoming
diagnostics::context.
gcc/jit/ChangeLog:
* dummy-frontend.cc: Update for diagnostic_context becoming
diagnostics::context.
* jit-playback.h: Likewise.
gcc/rust/ChangeLog:
* resolve/rust-ast-resolve-expr.cc: Update for diagnostic_text_finalizer
becoming diagnostics::text_finalizer.
* resolve/rust-late-name-resolver-2.0.cc: Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/plugin/show_template_tree_color_plugin.cc: Update for
moves to namespace diagnostics.
* gcc.dg/plugin/diagnostic_group_plugin.cc: Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise.
* gcc.dg/plugin/location_overflow_plugin.cc: Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
|
|
Within gcc/
move diagnostic-buffer.h to diagnostics/buffering.h
move diagnostic-format-html.cc to diagnostics/html-sink.cc
move diagnostic-format-html.h to diagnostics/html-sink.h
move diagnostic-format-sarif.cc to diagnostics/sarif-sink.cc
move diagnostic-format-sarif.h to diagnostics/sarif-sink.h
move diagnostic-format.h to diagnostics/sink.h
move diagnostic-format-text.cc to diagnostics/text-sink.cc
move diagnostic-format-text.h to diagnostics/text-sink.h
renaming various types including:
Old name: New name:
diagnostic_output_format diagnostics::sink
diagnostic_buffer diagnostics::buffer
diagnostic_per_format_buffer diagnostics::per_sink_buffer
diagnostic_text_output_format diagnostics::text_sink
sarif_output_format diagnostics::sarif_sink
diagnostic_sarif_format_buffer diagnostics::sarif_sink_buffer
html_output_format diagnostics::html_sink
diagnostic_html_format_buffer diagnostics::html_sink_buffer
No functional change intended.
gcc/ChangeLog:
* Makefile.in (OBJS): Replace diagnostic-format-html.o with
diagnostics/html-sink.o, diagnostic-format-sarif.o with
diagnostics/sarif-sink.o, and diagnostic-format-text.o with
diagnostics/text-sink.o.
* coretypes.h (class diagnostic_text_output_format): Replace
with...
(class diagnostics::text_sink): ...this.
* diagnostic-global-context.cc: Update for move of diagnostics
output formats into namespace "diagnostics", as "sinks".
* diagnostic-macro-unwinding.cc: Likewise.
* diagnostic-macro-unwinding.h: Likewise.
* diagnostic-show-locus.cc: Likewise.
* diagnostic.cc: Likewise.
* diagnostic.h: Likewise.
* diagnostic-buffer.h: Rename to...
* diagnostics/buffering.h: ...this, updating for above changes.
* diagnostics/client-data-hooks.h: Likewise.
* diagnostics/digraphs.cc: Likewise.
* diagnostic-format-html.cc: Rename to...
* diagnostics/html-sink.cc: ...this, updating for above changes.
* diagnostic-format-html.h: Rename to...
* diagnostics/html-sink.h: ...this, updating for above changes.
* diagnostics/lazy-paths.cc: Likewise.
* diagnostics/metadata.h: Likewise.
* diagnostics/output-spec.cc: Likewise.
* diagnostics/output-spec.h: Likewise.
* diagnostics/paths-output.cc: Likewise.
* diagnostics/paths.h: Likewise.
* diagnostic-format-sarif.cc: Rename to...
* diagnostics/sarif-sink.cc: ...this, updating for above changes.
* diagnostic-format-sarif.h: Rename to...
* diagnostics/sarif-sink.h: ...this, updating for above changes.
* diagnostic-format.h: Rename to...
* diagnostics/sink.h: ...this, updating for above changes.
* diagnostics/state-graphs-to-dot.cc: Likewise.
* diagnostic-format-text.cc: Rename to...
* diagnostics/text-sink.cc: ...this, updating for above changes.
* diagnostic-format-text.h: Rename to...
* diagnostics/text-sink.h: ...this, updating for above changes.
* gcc.cc: Likewise.
* langhooks-def.h: Likewise.
* langhooks.cc: Likewise.
* langhooks.h: Likewise.
* libgdiagnostics.cc: Likewise.
* opts-diagnostic.cc: Likewise.
* opts.cc: Likewise.
* selftest-diagnostic.cc: Likewise.
* selftest-run-tests.cc: Likewise.
* selftest.h: Likewise.
* tree-diagnostic-client-data-hooks.cc: Likewise.
* tree-diagnostic.cc: Likewise.
gcc/analyzer/ChangeLog:
* ana-state-to-diagnostic-state.cc: Update for move of
diagnostics output formats into namespace "diagnostics" as
"sinks".
* bounds-checking.cc: Likewise.
* call-details.cc: Likewise.
* checker-event.cc: Likewise.
* checker-event.h: Likewise.
* diagnostic-manager.cc: Likewise.
* diagnostic-manager.h: Likewise.
* infinite-loop.cc: Likewise.
* infinite-recursion.cc: Likewise.
* pending-diagnostic.h: Likewise.
* region-model.cc: Likewise.
* sm-taint.cc: Likewise.
gcc/c-family/ChangeLog:
* c-opts.cc: Update for move of diagnostics output formats into
namespace "diagnostics" as "sinks".
gcc/cp/ChangeLog:
* cp-tree.h: Update for move of diagnostics output formats into
namespace "diagnostics" as "sinks".
* error.cc: Likewise.
gcc/fortran/ChangeLog:
* error.cc: Update for move of diagnostics output formats into
namespace "diagnostics" as "sinks".
* gfortran.h: Likewise.
gcc/jit/ChangeLog:
* dummy-frontend.cc: Update for move of diagnostics output formats
into namespace "diagnostics" as "sinks".
gcc/rust/ChangeLog:
* resolve/rust-ice-finalizer.cc: Update for move of diagnostics
output formats into namespace "diagnostics" as "sinks".
* resolve/rust-ice-finalizer.h: Likewise.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_group_plugin.cc: Update for move of
diagnostics output formats into namespace "diagnostics" as
"sinks".
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise.
* gcc.dg/plugin/location_overflow_plugin.cc: Likewise.
libcc1/ChangeLog:
* context.cc: Update for move of diagnostics output formats into
namespace "diagnostics" as "sinks".
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): Visit the loop labels of
WhileLetLoopExpr instances before visiting their scrutinee
expressions.
* resolve/rust-early-name-resolver-2.0.cc
(Early::resolve_glob_import): Pass the glob import's path
directly to NameResolutionContext::resolve_path.
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Remove unnecessary call to
Identifier::as_string.
(flatten_glob): Improve handling of cases where a glob use tree
has no path.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This commit introduce a new public function to visit function parameters
in the default visitor. It allows visitors derived from DefaultVisitor
to override only a small part of the default visitor.
gcc/rust/ChangeLog:
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit_function_params):
Add specialized function to visit function parameters.
(DefaultASTVisitor::visit): Remove parameter visit and call specialized
function instead.
* ast/rust-ast-visitor.h: Add function prototye.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Remove
function.
(Late::visit_function_params): Override specialized visit function.
* resolve/rust-late-name-resolver-2.0.h: Add overriden function
prototype.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Binding context may be stacked when a new binding group is introduced
within a const expression.
gcc/rust/ChangeLog:
* resolve/rust-name-resolution-context.h: Use BindingLayer instead.
* resolve/rust-name-resolution-context.cc (BindingLayer::BindingLayer):
Add new constructor for binding layer.
(BindingLayer::bind_test): Add a function to test a binding constraint.
(BindingLayer::push): Push a new binding group.
(BindingLayer::and_binded): Add function to test and-binding
constraint.
(BindingLayer::or_binded): Add function to test or-binding constraints.
(BindingLayer::insert_ident): Insert a new identifier in the current
binding group.
(BindingLayer::merge): Merge current binding group with it's parent.
(BindingLayer::get_source): Get the source of the current binding
group.
* resolve/rust-late-name-resolver-2.0.cc: Use stacked context for
binding group.
* util/rust-stacked-contexts.h: Add mutable peek function.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add binding
creation in visitor.
* resolve/rust-late-name-resolver-2.0.h: Add function prototypes.
* resolve/rust-name-resolution-context.h: Add binding context.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
We need to differentiate bindings types, so the same binding cannot be
reused multiple time in a product binding.
gcc/rust/ChangeLog:
* resolve/rust-name-resolution-context.h (struct Binding): Add Binding
struct to differentiate Or and Product bindings in patterns.
(enum class): Add Binding kind.
(class BindingContext): Add binding context with Binding stack.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Add visit
function for TypeParam.
* resolve/rust-default-resolver.h: Add function prototype.
* resolve/rust-forever-stack.h: Add function to check for forward
declaration ban.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Check forward
declarations.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): Remove error kind
and change function call.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Change call name.
* ast/rust-path.cc (ConstGenericParam::as_string): Likewise.
* ast/rust-path.h: Remove error kind.
* hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit): Change call
name.
* parse/rust-parse-impl.h (Parser::parse_generic_param): Use optional
on parsing failure.
(Parser::parse_generic_arg): Likewise.
(Parser::parse_path_generic_args): Likewise.
* parse/rust-parse.h: Likewise.
* resolve/rust-ast-resolve-type.h: Change call name.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Change error
message.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove passing test from exclusion list.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|