Age | Commit message (Collapse) | Author | Files | Lines |
|
gcc/rust/ChangeLog:
* util/rust-lang-item.h: Add new lang items.
* util/rust-lang-item.cc: Likewise.
|
|
gcc/rust/ChangeLog:
* util/rust-lang-item.h: Add Sync marker trait.
* util/rust-lang-item.cc: Likewise.
|
|
If additional trait bounds aren't auto traits, then the typechecker
must error out (Rust-GCC#3008)
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-type.cc: Add TODO note.
|
|
gcc/rust/ChangeLog:
* resolve/rust-ast-resolve-type.cc (ResolveTypeToCanonicalPath::visit): Resolve additional
trait bounds.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Error out properly on unresolved
type-path instead of crashing.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Exclude additional-trait-bounds2 for different error message.
* rust/compile/additional-trait-bounds1.rs: New test.
* rust/compile/additional-trait-bounds2.rs: New test.
* rust/compile/additional-trait-bounds2nr2.rs: New test.
|
|
Regression checks for Rust-GCC#1399
gcc/testsuite/ChangeLog:
* rust/compile/multiline-string.rs: New test.
* rust/execute/torture/multiline-string.rs: New test.
|
|
gcc/rust/ChangeLog:
* typecheck/rust-hir-path-probe.cc: Fix typos.
* typecheck/rust-hir-path-probe.h: Likewise.
* typecheck/rust-hir-type-check-path.cc: Likewise.
|
|
Added rules to allow type casting pointer as integer types (u*,i*)
and integer types to be casted as pointer.
gcc/rust/ChangeLog:
* typecheck/rust-casts.cc (TypeCastRules::cast_rules): Add rule.
gcc/testsuite/ChangeLog:
* rust/compile/ptr_int_cast.rs: New test.
Signed-off-by: Nobel Singh <nobel2073@gmail.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-item.h: I have changed helper constructor for typepath
to be a delegating constructor.
Signed-off-by: Sri Ganesh Thota <sriganeshthota12345@gmail.com>
|
|
In order to handle the tuple pattern of: fn test ((x _) : (i32, i32)) -> i32 { x }
we need to recognize that ABI wise this function still takes a tuple as the parameter
to this function its just how we can address the "pattern" of the tuple changes.
So reall if this was C it would look like:
void test (struct tuple_type __prameter)
{
return __parameter.0
}
The code here reuses our existing pattern code so that we generate these implicit
bindings of the paramter with a field access so any time x is referenced it's really
just emplacing __parameter.0 for the field access into the struct which is a tuple.
Fixes Rust-GCC#2847
gcc/rust/ChangeLog:
* backend/rust-compile-fnparam.cc (CompileFnParam::visit): compile tuple patterns
(CompileSelfParam::compile): update return type
(CompileFnParam::create_tmp_param_var): return Bvariable not tree to stop ICE
* backend/rust-compile-fnparam.h: update prototype
* backend/rust-compile-pattern.cc (CompilePatternBindings::visit): implement TuplePattern
* backend/rust-compile-pattern.h: update prototype
gcc/testsuite/ChangeLog:
* rust/compile/issue-2847.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Fixes Rust-GCC#3229
gcc/rust/ChangeLog:
* rust-gcc.cc (operator_to_tree_code): ! expressions are BIT_NOT_EXPR
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
We moved to a bootstrap requirement of C++11 in GCC 11, 8 years after
support was stable in GCC 4.8.
It is now 8 years since C++14 was the default mode in GCC 6 (and 9 years
since support was complete in GCC 5), and we have a few bits of optional
C++14 code in the compiler, so it seems a good time to update the bootstrap
requirement again.
The big benefit of the change is the greater constexpr power, but C++14 also
added variable templates, generic lambdas, lambda init-capture, binary
literals, and numeric literal digit separators.
C++14 was feature-complete in GCC 5, and became the default in GCC 6. 5.4.0
bootstraps trunk correctly; trunk stage1 built with 5.3.0 breaks in
eh_data_format_name due to PR69995.
gcc/ChangeLog:
* doc/install.texi (Prerequisites): Update to C++14.
ChangeLog:
* configure.ac: Update requirement to C++14.
* configure: Regenerate.
|
|
gcc/rust/ChangeLog:
* ast/rust-path.h: Adapt children of Path to fix some NodeId issues.
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): New.
* resolve/rust-late-name-resolver-2.0.h: New.
|
|
gcc/rust/ChangeLog:
* hir/rust-ast-lower-type.cc (ASTLowerTypePath::translate): Adapt to
handle lang item paths.
(ASTLowerTypePath::visit): Likewise.
(ASTLowerTypePath::translate_type_path): New.
(ASTLowerTypePath::translate_lang_item_type_path): New.
* hir/rust-ast-lower-type.h: Adapt to handle lang item paths.
* resolve/rust-ast-resolve-type.h: Likewise.
|
|
gcc/rust/ChangeLog:
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Adapt resolver
to lang item paths.
* resolve/rust-ast-resolve-type.h: Likewise.
|
|
gcc/rust/ChangeLog:
* ast/rust-item.h: Add new method to specifically get a type-path.
* ast/rust-path.cc (LangItemPath::as_string): Implement properly.
* hir/rust-ast-lower-type.cc (ASTLowerTypePath::translate): Adapt
visitor to use the new LangItemPath.
* hir/rust-ast-lower-type.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Likewise.
* resolve/rust-ast-resolve-type.h: Likewise.
|
|
gcc/rust/ChangeLog:
* expand/rust-derive-copy.cc: Use new LangItemPath for derive(Copy).
|
|
This commit adds a new kind of Path, changes the base Path class and turns TypePath
into a child of the base Path class.
gcc/rust/ChangeLog:
* ast/rust-path.h (class LangItemPath): New.
(class TypePath): Adapt to accomodate LangItemPath.
* ast/rust-ast.cc (TraitImpl::as_string): Use new checks for lang items.
(QualifiedPathType::as_string): Likewise.
(FormatArgs::set_outer_attrs): Likewise.
* ast/rust-item.h (class TraitImpl): Likewise.
|
|
gcc/rust/ChangeLog:
* resolve/rust-forever-stack.h
(ForeverStack::find_starting_point): Use type
'std::reference_wrapper<Node> &' instead of 'Node &' for
parameter starting_point.
* resolve/rust-forever-stack.hxx
(ForeverStack::find_starting_point): Likewise.
(ForeverStack::resolve_path): Handle change to
ForeverStack::find_starting_point.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
Remove unused capture in lambda.
|
|
gcc/rust/ChangeLog:
* util/rust-attributes.h (class Attributes): New.
* util/rust-attributes.cc: Implement Attributes::is_known().
* ast/rust-collect-lang-items.cc (is_known_attribute): Remove.
(get_lang_item_attr): Call Attributes::is_known() instead.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_outer_attributes): Likewise.
(ASTLoweringBase::is_known_attribute): Remove.
|
|
gcc/rust/ChangeLog:
* Make-lang.in: Add new object file.
* rust-session-manager.cc (Session::compile_crate): Call CollectLangItems.
* ast/rust-collect-lang-items.cc: New file.
* ast/rust-collect-lang-items.h: New file.
|
|
gcc/rust/ChangeLog:
* util/rust-hir-map.h: Keep a NodeId mappings for lang items.
* util/rust-hir-map.cc (Mappings::insert_lang_item_node): New function.
(Mappings::lookup_lang_item_node): Likewise.
|
|
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): add missing check for no return value
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Fixes Rust-GCC#266
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: nr2 cant handle this
* rust/compile/issue-266.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
These are ported from the c-family code c-warn.cc and c/c-typchk.cc
Fixes Rust-GCC#2394
gcc/rust/ChangeLog:
* backend/rust-constexpr.cc (eval_store_expression): check for null
(eval_call_expression): remove bad warning
* rust-gcc.cc (arithmetic_or_logical_expression): add warnings
gcc/testsuite/ChangeLog:
* rust/compile/issue-2394.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
The code here was wrongly assuming the decl type from the folding of the
expression would be the type of the constant decl. This is not the case for
unsized coercions for slices, where the expression here is a reference to
an array then we require the coercion to fix the result up to the expected
type.
Fixes Rust-GCC#1525
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc: apply coercion site to result
* backend/rust-compile-base.h: update prototype
* backend/rust-compile-implitem.cc (CompileTraitItem::visit): send in coercion info
* backend/rust-compile-item.cc (CompileItem::visit): likewise
gcc/testsuite/ChangeLog:
* rust/compile/issue-1525.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
This was a handy debug assertion but only works for valid rust code. This
needs to handle the case where the type is not resolved which is a valid
case.
Fixes Rust-GCC#2423
gcc/rust/ChangeLog:
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): remove assertions
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: nr2 can't handle this
* rust/compile/issue-2423.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-visitor.h: Replace context with StackedContexts.
* ast/rust-ast-visitor.cc (ContextualASTVisitor::visit): Use new APIs.
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Likewise.
|
|
gcc/rust/ChangeLog:
* util/rust-stacked-contexts.h: Add new method to see what context we are currently in.
|
|
Both TraitItemFunc::has_definition() and TraitItemFunc::has_block_defined()
were exactly the same implementation, so remove one.
gcc/rust/ChangeLog:
* hir/tree/rust-hir-item.h: Remove TraitItemFunc::has_block_defined()
* backend/rust-compile-implitem.cc (CompileTraitItem::visit):
Call TraitItemFunc::has_definition() instead.
* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
* checks/errors/rust-hir-pattern-analysis.cc (PatternChecker::visit): Likewise.
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
* typecheck/rust-hir-trait-resolve.cc (ResolveTraitItemToRef::visit): Likewise.
|
|
gcc/rust/ChangeLog:
* util/rust-hir-map.h: Move definitions from header...
* util/rust-hir-map.cc: ...to source file.
|
|
gcc/rust/ChangeLog:
* util/rust-lang-item.h: Fix comment location to align with other comments.
|
|
We cannot apply aligned or packed after layout_type is called you need
to set this up first then call it.
Fixes Rust-GCC#3260
gcc/rust/ChangeLog:
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): call lauout type directly
* rust-backend.h (struct_type): add optional layout parameter
(union_type): likewise
(fill_in_fields): likewise
* rust-gcc.cc (struct_type): likewise
(union_type): likewise
(fill_in_fields): only layout if we required
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Fixes Rust-GCC#3261
gcc/rust/ChangeLog:
* typecheck/rust-casts.cc (TypeCastRules::cast_rules): allow casts to float
gcc/testsuite/ChangeLog:
* rust/compile/issue-3261.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
TypePaths have special handling for Self where we can look at the current ctx
for more acurate TypeAlias information if required. We cant do this for Impl
contexts but not for Traits as we might as well fall back to the TypePathProbe.
The other issue was the dyn type comming in because Foo::foo and Foo is a trait
reference we represent this as a dyn type as the root resolved path but then find
the associated impl block for this but we cannot do this when we have resolved to
a Dyn because this is just a representation that we know we are talking about a
trait not because we are actually working with a real Dyn type.
Fixes Rust-GCC#2907
gcc/rust/ChangeLog:
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): track trait
* typecheck/rust-hir-type-check-implitem.cc: trait block
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): dont when dyn
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): look at Self contenxt
(TypeCheckType::resolve_root_path): track if Self
(TypeCheckType::resolve_associated_type): look at current context for associated types
* typecheck/rust-hir-type-check-type.h: change prototype
* typecheck/rust-hir-type-check.h (class TypeCheckBlockContextItem):
new context system to track current state
* typecheck/rust-typecheck-context.cc (TypeCheckContext::have_block_context): likewise
(TypeCheckContext::peek_block_context): likewise
(TypeCheckContext::push_block_context): likewise
(TypeCheckContext::pop_block_context): likewise
(TypeCheckBlockContextItem::Item::Item): likewise
(TypeCheckBlockContextItem::TypeCheckBlockContextItem): likewise
(TypeCheckBlockContextItem::is_impl_block): likewise
(TypeCheckBlockContextItem::is_trait_block): likewise
(TypeCheckBlockContextItem::get_impl_block): likewise
(TypeCheckBlockContextItem::get_trait): likewise
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: nr2 cant handle this
* rust/compile/issue-2907.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): add missing null checks
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc: Prepend crate name to function's ir
name.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove passing tests from exclude list.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-name-resolver.cc: Include options.txt.
(Resolver::insert_resolved_name): Assert that name resolution
2.0 is disabled.
(Resolver::lookup_resolved_name): Likewise.
(Resolver::insert_resolved_type): Likewise.
(Resolver::lookup_resolved_type): Likewise.
(Resolver::insert_resolved_label): Likewise.
(Resolver::lookup_resolved_label): Likewise.
(Resolver::insert_resolved_macro): Likewise.
(Resolver::lookup_resolved_macro): Likewise.
(Resolver::insert_resolved_misc): Likewise.
(Resolver::lookup_resolved_misc): Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This is a special case in Rust and the ! type can unify with pretty much
anything its almost a inference variable and a unit-type for special cases.
Fixes Rust-GCC/gccrs#3231
Fixes Rust-GCC/gccrs#2567
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (check_match_scrutinee): check for empty match
(CompileExpr::visit): fix assertion
* checks/errors/rust-hir-pattern-analysis.cc (check_match_usefulness): check for empty
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): resolve to !
gcc/testsuite/ChangeLog:
* rust/compile/exhaustiveness1.rs: remove bad check
* rust/compile/issue-2567-1.rs: New test.
* rust/compile/issue-2567-2.rs: New test.
* rust/compile/issue-2567-3.rs: New test.
* rust/compile/issue-3231.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): add guards
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
System includes shall use rust-system header instead.
gcc/rust/ChangeLog:
* ast/rust-stmt.h: Remove stdlib include and use rust-system instead.
* backend/rust-compile-expr.cc: Likewise.
* backend/rust-mangle-legacy.cc: Likewise.
* backend/rust-mangle-v0.cc: Likewise.
* hir/rust-hir-dump.cc: Likewise.
* typecheck/rust-hir-type-check-type.cc: Likewise.
* typecheck/rust-tyty.cc: Likewise.
* typecheck/rust-tyty.h: Likewise.
* util/rust-common.h: Likewise.
* util/rust-token-converter.cc: Likewise.
* util/rust-token-converter.h: Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
I probably missed a few spots, but this should cover most of the type
checker.
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-expr.cc: Add includes.
(TypeCheckExpr::visit): Use name resolver 2.0.
(TypeCheckExpr::resolve_operator_overload): Likewise.
(TypeCheckExpr::resolve_fn_trait_call): Likewise.
* typecheck/rust-hir-type-check-path.cc
(TypeCheckExpr::visit): Likewise.
(TypeCheckExpr::resolve_segments): Likewise.
* typecheck/rust-hir-type-check-type.cc
(TypeCheckType::resolve_segments): Likewise.
(ResolveWhereClauseItem::visit): Likewise.
(TypeCheckType::visit): Avoid usage of
Resolver::get_unit_type_node_id when handling TupleType, use
name resolver 2.0 when handling QualifiedPathInType.
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): Call DefaultResolver::visit when visiting
TypePath.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove entries.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::check_for_privacy_violation): Use name
resolver 2.0.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove entries.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): Change call.
(CompileExpr::resolve_operator_overload): Update function arguments.
* backend/rust-compile-expr.h: Change the function's prototype to use
a reference wrapper instead of a reference within the optional.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
GCC 4.8 complains about the initializer list.
gcc/rust/ChangeLog:
* typecheck/rust-tyty.h: Change initializer list to default constructor
call.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Clang on macos as well as GCC 4.8 complains when those templates are
missing.
gcc/rust/ChangeLog:
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Add template
to tl::optional.
* hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit): Likewise.
* typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::visit):
Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Condition was inverted, we should retrieve the locus only if we have a
pattern.
gcc/rust/ChangeLog:
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Do not
get a reference if the pattern does not exist.
(TypeCheckMethodCallExpr::check): Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Refactor some optional initializer in the lowering stage to make them
more readable.
gcc/rust/ChangeLog:
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Change the
ternary expression with a more readable if.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|