Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
gcc/rust/ChangeLog:
* Make-lang.in (rust-readonly-check2.cc):
Add read-only check on HIR
* checks/errors/rust-readonly-check2.cc (ReadonlyChecker):
Add read-only check on HIR
* checks/errors/rust-readonly-check2.h (ReadonlyChecker):
Add read-only check on HIR
Signed-off-by: Ryutaro Okada <1015ryu88@gmail.com>
|
|
gcc/rust/ChangeLog:
* hir/tree/rust-hir-visitor.cc (DefaultHIRVisitor::walk):
Call base class's accept_vis method
Signed-off-by: Ryutaro Okada <1015ryu88@gmail.com>
|
|
gcc/rust/ChangeLog:
* hir/tree/rust-hir-visitor.cc (DefaultHIRVisitor::walk):
Add check before calling `get_trait_ref()`
Signed-off-by: Ryutaro Okada <1015ryu88@gmail.com>
|
|
gcc/rust/ChangeLog:
* expand/rust-macro-builtins-helpers.cc
(try_extract_string_literal_from_fragment): Perform static_cast
to AST::LiteralExpr only after it's verified that an AST::Expr
is a literal.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This doesn't handle rustc_args_required_const, but it does allow us to
recognize it as a valid attribute.
gcc/rust/ChangeLog:
* util/rust-attribute-values.h
(Attributes::RUSTC_ARGS_REQUIRED_CONST): New constexpr variable.
* util/rust-attributes.cc (__definitions): New entry for
RUSTC_ARGS_REQUIRED_CONST.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast.cc (AttributeParser::parse_meta_item_inner):
Handle removal of AttributeParser-specific functions.
(AttributeParser::parse_path_meta_item): Likewise.
(AttributeParser::parse_meta_item_seq): Likewise.
(AttributeParser::parse_meta_item_lit): Likewise.
(AttributeParser::parse_literal): Remove function.
(AttributeParser::parse_simple_path): Likewise.
(AttributeParser::parse_simple_path_segment): Likewise.
(AttributeParser::peek_token): Likewise.
(AttributeParser::skip_token): Likewise.
* ast/rust-macro.h (AttributeParser::parse_simple_path):
Likewise.
(AttributeParser::parse_simple_path_segment): Likewise.
(AttributeParser::parse_literal): Likewise.
(AttributeParser::peek_token): Likewise.
(AttributeParser::skip_token): Likewise.
* parse/rust-parse.h (Parser): Make AttributeParser a friend
class.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): Add proper handling
of the node.
* rust-backend.h (lookup_field): Declare it.
* rust-gcc.cc (lookup_field): Add forked implementation from gcc/c/.
gcc/testsuite/ChangeLog:
* rust/execute/torture/offset_of1.rs: New test.
|
|
gcc/rust/ChangeLog:
* ast/rust-ast.cc (AttributeParser::parse_path_meta_item): Catch
parse_expr returning nullptr and remove defunct comment.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This should reduce incremental compile times when modifying
rust-parse-impl.h and not rust-parse.h.
gcc/rust/ChangeLog:
* Make-lang.in (GRS_OBJS): Add entries.
* parse/rust-parse-impl.h: Adjust header comment.
(Parser::parse_lifetime_params_objs): Fix bug and add comment.
(Parser::unexpected_token): Likewise.
* parse/rust-parse.h: Remove inclusion of "rust-parse-impl.h".
* parse/rust-parse-impl-lexer.cc: New file.
* parse/rust-parse-impl-macro.cc: New file.
* parse/rust-parse-impl-proc-macro.cc: New file.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit):
Fix object copying issue causing pointer inconsistency
Signed-off-by: Ryutaro Okada <1015ryu88@gmail.com>
|
|
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>
|
|
gcc/rust/ChangeLog:
* typecheck/rust-tyty-subst.cc (SubstitutionRef::infer_substitions): remove debug
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* typecheck/rust-type-util.cc (unify_site_and): improve debug
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
This old can_eq interface was an old method to try and check if types can match up
by taking into account generics but its not maintained properly and we already have
a new wrapper Resolver::types_compatable (type, type, locus, emit_errors) which
just calls unify_site_and infer with commit false. There are only a few places left
to update.
One minor downside is that i need to remove const in some places because the unify
interface is non const. Ideally we would want to avoid writing a seperate const unify
anyway so i think this is not ideal but fine for us.
gcc/rust/ChangeLog:
* typecheck/rust-autoderef.cc: remove useless assertion
* typecheck/rust-coercion.cc (TypeCoercionRules::coerce_unsafe_ptr): refactor
(TypeCoercionRules::coerce_borrowed_pointer): remove FIXME this is fine
* typecheck/rust-hir-inherent-impl-overlap.h: use types_compatable
* typecheck/rust-hir-path-probe.cc (PathProbeType::PathProbeType): remove const
(PathProbeType::Probe): likewise
(PathProbeImplTrait::PathProbeImplTrait): likewise
(PathProbeImplTrait::Probe): likewise
* typecheck/rust-hir-path-probe.h: likewise
* typecheck/rust-hir-type-check-base.cc (walk_types_to_constrain): likewise
* typecheck/rust-hir-type-check-base.h: likewise
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): use types_compatable
* typecheck/rust-hir-type-check.h: remove const
* typecheck/rust-typecheck-context.cc (TypeCheckContext::insert_associated_impl_mapping):
likewise
(TypeCheckContext::lookup_associated_impl_mapping_for_self): remove can_Eq
* typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::is_equal): likewise
* typecheck/rust-tyty-subst.cc (SubstitutionArg::get_tyty): remove const version
* typecheck/rust-tyty-subst.h: likewise
* typecheck/rust-tyty.cc (BaseType::get_root): likewise
* typecheck/rust-tyty.h: likewise
gcc/testsuite/ChangeLog:
* rust/compile/generics8.rs: extra error message
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* typecheck/rust-tyty-subst.cc: track the const generic
* typecheck/rust-tyty.cc (ConstType::is_equal): finish the is_equal
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Flag was left uninitialized within default constructor.
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::Dump): Initialize flag.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::ASTLoweringPattern):
flag was not initialized in the constructor.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit): Remove
use after move.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* expand/rust-macro-builtins-helpers.cc: Remove use after move.
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>
|
|
The substitution code was not taking into account the const generic
arguments for checking the max bounds of total available parameters.
Fixes Rust-GCC#3546
gcc/rust/ChangeLog:
* typecheck/rust-tyty-subst.cc: fix check for total arguments
gcc/testsuite/ChangeLog:
* rust/compile/issue-3546.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
We already support const infer so this just creates a fresh tyty::infer_var
for the const element type and then a ConstKind::Infer type for the const
type wrapper and the existing plumbing handles this.
Fixes Rust-GCC#3885
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): create infer variable
gcc/testsuite/ChangeLog:
* rust/compile/issue-3885.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): check for expression
* hir/tree/rust-hir.cc (AnonConst::as_string): likewise
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): check for value
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): formatting
* typecheck/rust-tyty-variance-analysis-private.h: likewise
* typecheck/rust-tyty.cc (VariantDef::clone): likewise
(VariantDef::monomorphized_clone): likewise
* typecheck/rust-tyty.h: likewise
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
In order to support const generics we map the declarations to a ConstType this
means we reuse all our existing type coercion, unification code and generic
substitutions code to support this with minimal impact.
This patch adds support for:
1. Default const generics
2. Infer const generics
3. ADTType suport
4. unconstrained checks
5. ensure types of the const generic and default
6. validation if passing a const argument to a type argument
Lots of test cases now work and new ones added. More work is needed to support this
on functions and method resolution of impls like Foo<1> vs Foo<2> once thats in we
can look to support some of the const generic array impls next.
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc: useful debug
* backend/rust-compile-stmt.cc (CompileStmt::visit): likewise
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): fold the capacity into ConstType
* hir/tree/rust-hir-generic-param.h: make const
* hir/tree/rust-hir-path.h: take into account const arguments now
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): needs const
* typecheck/rust-hir-type-check-base.h: add error handling for const supported locations
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): const type the arrays
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): update
(TypeCheckImplItem::visit): likewise
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): likewise
(TypeCheckItem::resolve_impl_block_substitutions): likewise
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): wrap up const type
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise
(TypeResolveGenericParam::visit): likewise
(TypeResolveGenericParam::apply_trait_bounds): remove HIR::Generic from Param
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): cleanup
* typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::SubstitutionParamMapping):
handle const generics
(SubstitutionParamMapping::get_type_representation): likewise
(SubstitutionParamMapping::param_has_default_ty): likewise
(SubstitutionParamMapping::get_default_ty): likewise
(SubstitutionRef::infer_substitions): likewise
* typecheck/rust-tyty-subst.h: likewise
* typecheck/rust-tyty-util.cc (TyVar::get_implicit_const_infer_var): new helper
* typecheck/rust-tyty-util.h (class ConstType): likewise
* typecheck/rust-tyty.cc (BaseType::is_concrete): check for array const concrete
(ArrayType::as_string): update to const
(ArrayType::handle_substitions): likewise
(ParamType::ParamType): likewise
(ParamType::get_generic_param): likewise
(ParamType::clone): likewise
(ConstType::ConstType): likewise
(ConstType::set_value): likewise
(ConstType::clone): likewise
(ConstType::get_generic_param): likewise
(generate_tree_str): new helper to pretty print gimple
(ConstType::get_name): uses the generate_tree_str
(ConstType::handle_substitions): handle const infer's
* typecheck/rust-tyty.h (RUST_TYTY): likewise
* typecheck/rust-unify.cc (UnifyRules::expect_array): likewise
(UnifyRules::expect_const): likewise
gcc/testsuite/ChangeLog:
* rust/compile/const_generics_3.rs: this works now
* rust/compile/const_generics_5.rs: likewise
* rust/compile/const_generics_8.rs: move the failure to another test case
* rust/compile/const_generics_10.rs: New test.
* rust/compile/const_generics_11.rs: New test.
* rust/compile/const_generics_12.rs: New test.
* rust/compile/const_generics_13.rs: New test.
* rust/compile/const_generics_14.rs: New test.
* rust/compile/const_generics_15.rs: New test.
* rust/compile/const_generics_16.rs: New test.
* rust/compile/const_generics_9.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
This patch is all about just putting in the boiler plate for the new
BaseGeneric TyTy::ConstType. Nothing is really change but just the
nessecary cogs added to the machine.
gcc/rust/ChangeLog:
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): error_mark_node for const types
* backend/rust-compile-type.h: boilerplate
* checks/errors/borrowck/rust-bir-fact-collector.h: likewise
* checks/errors/borrowck/rust-bir-place.h: likewise
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_base_type_privacy):
likewise
* typecheck/rust-substitution-mapper.cc (SubstMapperInternal::visit): likewise
* typecheck/rust-substitution-mapper.h: likewise
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_marker_builtins): likewise
* typecheck/rust-tyty-call.h: likewise
* typecheck/rust-tyty-cmp.h (class ConstCmp): likewise
* typecheck/rust-tyty-variance-analysis-private.h: likewise
* typecheck/rust-tyty-visitor.h: likewise
* typecheck/rust-tyty.cc (TypeKindFormat::to_string): likewise
(BaseType::is_unit): likewise
(BaseType::has_substitutions_defined): likewise
(BaseType::needs_generic_substitutions): likewise
(ConstType::ConstType): likewise
(ConstType::accept_vis): likewise
(ConstType::as_string): likewise
(ConstType::can_eq): likewise
(ConstType::clone): likewise
(ConstType::get_symbol): likewise
(ConstType::get_generic_param): likewise
(ConstType::can_resolve): likewise
(ConstType::resolve): likewise
(ConstType::get_name): likewise
(ConstType::is_equal): likewise
(ConstType::handle_substitions): likewise
* typecheck/rust-tyty.h (enum TypeKind): new tyty_kind
(class ConstType): new type
* typecheck/rust-unify.cc (UnifyRules::go): Handle a const type unify
(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_placeholder): likewise
(UnifyRules::expect_projection): likewise
(UnifyRules::expect_dyn): likewise
(UnifyRules::expect_closure): likewise
(UnifyRules::expect_const): likewise
* typecheck/rust-unify.h: new expect_const_type handler
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
In order to support const generics we need to abstract away some of the specific
ParamType to a BaseGeneric type so we can easily reuse our existing substitution
bits for const generics which will mean creating a TyTy::ConstType to wrap up
the gcc tree but also represent a const inference and the const decl.
gcc/rust/ChangeLog:
* backend/rust-compile-intrinsic.cc (sizeof_handler): refactor types
(op_with_overflow_inner): likewise
(uninit_handler): likewise
(move_val_init_handler): likewise
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): likewise
* typecheck/rust-hir-trait-resolve.cc: likewise
* typecheck/rust-hir-type-check-base.cc: likewise
* typecheck/rust-hir-type-check-item.cc: likewise
* typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::is_equal): likewise
* typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::get_param_ty): likewise
(SubstitutionArg::get_param_mapping): likewise
(SubstitutionRef::prepare_higher_ranked_bounds): likewise
(SubstitutionRef::monomorphize): likewise
* typecheck/rust-tyty-subst.h (class BaseGeneric): new generic base
* typecheck/rust-tyty.cc (VariantDef::clone): likewise
(VariantDef::monomorphized_clone): refactor
(ADTType::is_equal): likewise
(FnType::is_equal): likewise
(ParamType::ParamType): likewise
* typecheck/rust-tyty.h (class ParamType): likewise
(class BaseGeneric): new base class impl
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
We dont need to do this resolve we can just let the ParamType's sort this
out.
gcc/rust/ChangeLog:
* typecheck/rust-tyty.cc (ADTType::is_equal): let param::is_eq do this
(FnType::is_equal): remove whitespace
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
This is an initial patch required to refactor our generics code to be
simpler and more abstract so we return the HIR::GenericParam in ParamMappings
instead of assuming its a TypeParam so we can slowly introduce ConstGenericParam
into this same flow.
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-base.cc: check for type param
* typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::SubstitutionParamMapping):
return HIR::GenericParam base class
(SubstitutionParamMapping::get_generic_param): likewise
(SubstitutionParamMapping::get_type_representation): new helper
(SubstitutionParamMapping::param_has_default_ty): check for param type
(SubstitutionParamMapping::get_default_ty): likewise
* typecheck/rust-tyty-subst.h: get the locus from the subst HIR::GenericParam now
* typecheck/rust-tyty-variance-analysis.cc (GenericTyPerCrateCtx::debug_print_solutions):
likwise
(GenericTyVisitorCtx::process_type): likewise
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
We assert that struct expressions during code-gen must be of TyTy::ADTType
but we can simply just check for this and return error_mark_node to make
this safe.
Fixes Rust-GCC#3960
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): check for ADTType instead of assert
gcc/testsuite/ChangeLog:
* rust/compile/issue-3960.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* checks/lints/rust-lint-unused-var.cc (check_decl):
Do not warn about unused `self` parameter.
Signed-off-by: Ryutaro Okada <1015ryu88@gmail.com>
|
|
gcc/rust/ChangeLog:
* Make-lang.in:
* ast/rust-expression-yeast.cc (ExpressionYeast::dispatch_loops): Call DesugarWhileLet.
* ast/rust-desugar-while-let.cc: New file.
* ast/rust-desugar-while-let.h: New file.
gcc/testsuite/ChangeLog:
* rust/compile/while_let1.rs: New test.
|
|
gcc/rust/ChangeLog:
* ast/rust-ast.cc (AttrInputMacro::operator=): Add return type.
* ast/rust-expr.h: Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-desugar-for-loops.cc: Remove functions implemented in AST::Builder.
* ast/rust-desugar-for-loops.h: Likewise.
|
|
gcc/rust/ChangeLog:
* hir/rust-ast-lower-base.cc: Add rust_unreachable() when lowering desugared exprs.
* hir/rust-ast-lower-base.h: Mention this.
* hir/rust-ast-lower-block.h: Remove existing definitions.
* hir/rust-ast-lower-expr.cc: Likewise.
* hir/rust-ast-lower-expr.h: Likewise.
* hir/rust-ast-lower.cc: Likewise.
|
|
gcc/rust/ChangeLog:
* ast/rust-desugar-question-mark.cc (DesugarQuestionMark::go): Add assertion for the
expr's type.
* ast/rust-desugar-try-block.cc (DesugarTryBlock::go): Likewise.
|
|
gcc/rust/ChangeLog:
* ast/rust-desugar-for-loops.h: Adapt API and remove visitor.
* ast/rust-desugar-for-loops.cc: Likewise.
* ast/rust-expression-yeast.cc: Call DesugarForLoop.
* ast/rust-expression-yeast.h: Declare dispatch_loops function.
* rust-session-manager.cc (Session::expansion): Do not call for-loop desugar.
|
|
gcc/rust/ChangeLog:
* hir/tree/rust-hir-expr.h (class OffsetOf): New.
* hir/tree/rust-hir-expr.cc: Define its methods.
* hir/tree/rust-hir-expr-abstract.h: Add ExprType::OffsetOf.
* hir/tree/rust-hir-full-decls.h (class OffsetOf): Declare it.
* backend/rust-compile-block.h: Add handling for OffsetOf.
* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
* backend/rust-compile-expr.h: Likewise.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Likewise.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.h (RUST_BIR_BUILDER_EXPR_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 (RUST_PRIVACY_REPORTER_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-expr.cc (ASTLoweringExpr::visit): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* hir/rust-hir-dump.h: Likewise.
* hir/tree/rust-hir-visitor.cc (DefaultHIRVisitor::walk): Likewise.
* hir/tree/rust-hir-visitor.h: Likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise.
* typecheck/rust-hir-type-check-expr.h (RUST_HIR_TYPE_CHECK_EXPR): Likewise.
gcc/testsuite/ChangeLog:
* rust/compile/offset_of2.rs: New test.
|
|
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:
|
|
gcc/rust/ChangeLog:
* rust-diagnostics.h (struct Error): Add disambiguation.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
A missing comma between inline assembly templates did not throw an error
and looped indefinitely.
gcc/rust/ChangeLog:
* expand/rust-macro-builtins-asm.cc (parse_format_strings): Emit an
error when expecting a comma.
gcc/testsuite/ChangeLog:
* rust/compile/issue-4006.rs: New test.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Remove namespace comment after classes and structs.
gcc/rust/ChangeLog:
* checks/errors/borrowck/rust-bir-fact-collector.h: Remove spurious
comment.
* checks/errors/rust-feature.cc: Likewise.
* util/optional.h: Likewise.
* expand/rust-token-tree-desugar.cc (TokenTreeDesugar::visit): Remove
semicolons on namespace.
* expand/rust-token-tree-desugar.h: Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-base.cc
(TypeCheckBase::TypeCheckBase): Remove initialization of
resolver field.
* typecheck/rust-hir-type-check-base.h
(TypeCheckBase::resolver): Remove field.
* typecheck/rust-hir-trait-resolve.cc: Remove "options.h"
include.
(TraitResolver::resolve_path_to_trait): Assume name resolution
2.0 is always enabled.
* typecheck/rust-hir-type-check-enumitem.cc: Remove "options.h"
include.
(TypeCheckEnumItem::visit): Assume name resolution 2.0 is always
enabled.
* typecheck/rust-hir-type-check-expr.cc: Remove "options.h"
include.
(TypeCheckExpr::visit): Assume name resolution 2.0 is always
enabled.
(TypeCheckExpr::resolve_operator_overload): Likewise.
(TypeCheckExpr::resolve_fn_trait_call): Likewise.
* typecheck/rust-hir-type-check-implitem.cc: Remove "options.h"
include.
(TypeCheckImplItem::visit): Assume name resolution 2.0 is always
enabled.
* typecheck/rust-hir-type-check-item.cc: Remove "options.h"
include.
(TypeCheckItem::visit): Assume name resolution 2.0 is always
enabled.
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::visit):
Likewise.
(TypeCheckExpr::resolve_root_path): Likewise.
(TypeCheckExpr::resolve_segments): Likewise.
* typecheck/rust-hir-type-check-pattern.cc: Remove "options.h"
include.
(TypeCheckPattern::visit): Assume name resolution 2.0 is always
enabled.
* typecheck/rust-hir-type-check-type.cc
(TypeCheckType::resolve_root_path): Likewise.
(ResolveWhereClauseItem::visit): Likewise.
* typecheck/rust-hir-type-check.cc: Remove "options.h" include.
(TraitItemReference::get_type_from_fn): Assume name resolution
2.0 is always enabled.
* typecheck/rust-type-util.cc (query_type): Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Inline assembly was incomplete and input/output from inout or split in
out were not handled.
gcc/rust/ChangeLog:
* backend/rust-compile-asm.cc (get_out_expr): Return valid output from
an operand.
(CompileAsm::asm_construct_outputs): Handle every output
(get_in_expr): Return valid input from an operand.
(CompileAsm::asm_construct_inputs): Handle every input
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Previously inline assembly expected identifiers instead of expression.
gcc/rust/ChangeLog:
* expand/rust-macro-builtins-asm.cc (parse_reg_operand_inout): Parse
expressions and build split in out.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): Dump inline assembly fields
* hir/tree/rust-hir-expr.h: Add non const getter and avoid operand copy
from getters.
* hir/tree/rust-hir-visitor.cc (DefaultHIRVisitor::walk): Use non const
reference.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* expand/rust-macro-builtins-asm.cc (expand_inline_asm_strings): Handle
transformation for indexed positional arguments.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|