Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from Rust-GCC:master #2

Open
wants to merge 10,000 commits into
base: master
Choose a base branch
from
Open

Conversation

pull[bot]
Copy link

@pull pull bot commented Nov 14, 2022

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull bot assigned cepawiel Nov 14, 2022
@pull pull bot added the ⤵️ pull label Nov 14, 2022
@pull pull bot requested a review from cepawiel November 14, 2022 19:24
CohenArthur and others added 27 commits June 18, 2024 12:24
gcc/rust/ChangeLog:

	* ast/rust-ast-fragment.h (enum class): Add InvocKind and AsmKind enums.
	* ast/rust-macro.h: Switch semicolon boolean to InvocKind enum.
	* expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise.
	* expand/rust-macro-builtins-asm.cc (MacroBuiltin::asm_handler): Likewise.
	(parse_asm): Likewise.
	* expand/rust-macro-builtins-asm.h (parse_asm): Likewise.
	* expand/rust-macro-builtins-format-args.cc (MacroBuiltin::format_args_handler): Likewise.
	* expand/rust-macro-builtins-include.cc (MacroBuiltin::include_bytes_handler): Likewise.
	(MacroBuiltin::include_str_handler): Likewise.
	(MacroBuiltin::include_handler): Likewise.
	* expand/rust-macro-builtins-location.cc (MacroBuiltin::file_handler): Likewise.
	(MacroBuiltin::column_handler): Likewise.
	(MacroBuiltin::line_handler): Likewise.
	* expand/rust-macro-builtins-log-debug.cc (MacroBuiltin::assert_handler): Likewise.
	* expand/rust-macro-builtins-utility.cc (MacroBuiltin::compile_error_handler): Likewise.
	(MacroBuiltin::concat_handler): Likewise.
	(MacroBuiltin::env_handler): Likewise.
	(MacroBuiltin::cfg_handler): Likewise.
	(MacroBuiltin::stringify_handler): Likewise.
	* expand/rust-macro-builtins.cc (format_args_maker): Likewise.
	(enum class): Likewise.
	(inline_asm_maker): Likewise.
	(MacroBuiltin::sorry): Likewise.
	(MacroBuiltin::proc_macro_builtin): Likewise.
	* expand/rust-macro-builtins.h: Likewise.
	* expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Likewise.
	(MacroExpander::expand_eager_invocations): Likewise.
	(MacroExpander::expand_invoc): Likewise.
	* expand/rust-macro-expand.h (struct MacroExpander): Likewise.
gcc/testsuite/ChangeLog:

	* rust/compile/inline_asm_outside_unsafe.rs: New test.
gcc/rust/ChangeLog:

	* hir/tree/rust-hir-expr.h:
	Added ExprType::InlineAsm
	* hir/tree/rust-hir.h:
	Added ExprType::InlineAsm
gcc/rust/ChangeLog:

	* ast/rust-ast-collector.cc (TokenCollector::visit):
	Handle case for RAW_STRING_LITERAL.
	* ast/rust-ast.cc (AttributeParser::parse_meta_item_inner):
	Likewise.
	(AttributeParser::parse_literal): Likewise.
	* ast/rust-ast.h: Likewise.
	* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_literal):
	Likewise.
	* lex/rust-lex.cc (Lexer::parse_raw_string): Likewise.
	* lex/rust-token.cc (Token::as_string): Likewise.
	* lex/rust-token.h (enum PrimitiveCoreType): Likewise.
	* parse/rust-parse-impl.h (Parser::parse_attr_input): Likewise.
	(Parser::parse_literal_expr): Likewise.
	(Parser::parse_pattern_no_alt): Likewise.

Signed-off-by: ansh <[email protected]>
gcc/rust/ChangeLog:

	* expand/rust-macro-builtins-asm.cc (parse_clobber_abi):
	Finish incorporating expected of parse_reg_operand
	(parse_reg): Likewise.
	(parse_reg_operand): Likewise.
	(parse_reg_operand_in): Likewise.
	(parse_reg_operand_out): Likewise.
	(parse_reg_operand_lateout): Likewise.
	(parse_reg_operand_const): Likewise.
	(parse_reg_operand_inout): Likewise.
	(parse_reg_operand_sym): Likewise.
	(MacroBuiltin::asm_handler): Likewise.
	(parse_asm_arg): Likewise.
	(parse_asm): Likewise.
	(parse_format_strings): Likewise.
	(validate): Likewise.
	* expand/rust-macro-builtins-asm.h (class InlineAsmParseError): Likewise.
	(enum InlineAsmParseError): Likewise.
	(validate): Likewise.
	(parse_format_strings): Likewise.
	(parse_reg_operand_in): Likewise.
	(parse_reg_operand_out): Likewise.
	(parse_reg_operand_lateout): Likewise.
	(parse_reg_operand_inout): Likewise.
	(parse_reg_operand_inlateout): Likewise.
	(parse_reg_operand_const): Likewise.
	(parse_reg_operand_sym): Likewise.
gcc/rust/ChangeLog:

	* expand/rust-macro-builtins-asm.cc (parse_reg_operand_in):
	Finish expected parse_reg_operand
	(parse_reg_operand_unexpected): Likewise
	* expand/rust-macro-builtins-asm.h (parse_reg_operand_unexpected): Likewise

Signed-off-by: badumbatish <[email protected]>
gcc/rust/ChangeLog:

	* expand/rust-macro-builtins-asm.cc (check_and_set):
	Scaffold expected on parse_options and asm_arg
	(parse_options): Likewise
	(parse_asm_arg): Likewise
	* expand/rust-macro-builtins-asm.h (check_and_set): Likewise
	(parse_label): Likewise

Signed-off-by: badumbatish <[email protected]>
Added tl::expected to parse_operand by implementing the validation
inside the parse_reg_operand function.

gcc/rust/ChangeLog:

	* ast/rust-expr.h:
	Added tl::expected to parse_operand
	* expand/rust-macro-builtins-asm.cc (parse_reg): Likewise.
	(parse_reg_operand): Likewise.
	(parse_reg_operand_const): Likewise.
	(parse_reg_operand_inout): Likewise.
	(parse_asm_arg): Likewise.
	* expand/rust-macro-builtins-asm.h: Likewise.

Signed-off-by: badumbatish <[email protected]>
gcc/rust/ChangeLog:

	* expand/rust-macro-builtins-asm.cc (parse_clobber_abi):
	added comments
	(parse_options): Likewise
	(parse_asm_arg): Likewise
	(parse_asm): Likewise
	* expand/rust-macro-builtins-asm.h: Likewise

gcc/testsuite/ChangeLog:

	* rust/compile/inline_asm_illegal_options.rs: new test
	* rust/compile/inline_asm_illegal_operands.rs: New test.
	This is expected to fail but we couldn't resolve parse_expr()'s
	general functionality yet

Signed-off-by: badumbatish <[email protected]>
gcc/rust/ChangeLog:

	* expand/rust-macro-builtins-asm.h (enum InlineAsmParseError):
	Add WARN_UNUSED_RESULT parse error
	(enum WARN_UNUSED_RESULT): Likewise.

Signed-off-by: badumbatish <[email protected]>
gcc/rust/ChangeLog:

	* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
	Addresses warning, put warn unused in right place
	(parse_reg_operand_inout): Likewise.
	(parse_asm_arg): Likewise.
	* expand/rust-macro-builtins-asm.h (enum WARN_UNUSED_RESULT): Likewise.
	(enum InlineAsmParseError): Likewise.
	(validate): Likewise.
	(parse_asm_arg): Likewise.
	(parse_format_strings): Likewise.
	(parse_clobber_abi): Likewise.
	(parse_reg_operand): Likewise.
	(parse_reg_operand_in): Likewise.
	(parse_reg_operand_out): Likewise.
	(parse_reg_operand_lateout): Likewise.
	(parse_reg_operand_inout): Likewise.
	(parse_reg_operand_inlateout): Likewise.
	(parse_reg_operand_const): Likewise.
	(parse_reg_operand_sym): Likewise.
	(parse_reg_operand_unexpected): Likewise.
	(parse_asm): Likewise.
	(check_and_set): Likewise.
	(parse_options): Likewise.
	(parse_reg): Likewise.
	(parse_format_string): Likewise.

Signed-off-by: badumbatish <[email protected]>
gcc/rust/ChangeLog:

	* expand/rust-macro-builtins-asm.cc (parse_asm):
	Clean up monadic operations on expected<>

Signed-off-by: badumbatish <[email protected]>
gcc/rust/ChangeLog:

	* ast/rust-expr.h (struct TupleTemplateStr):
	Store parse result of parse_format_string(s)
	* expand/rust-macro-builtins-asm.cc (parse_format_strings):
	Likewise

Signed-off-by: badumbatish <[email protected]>
gcc/rust/ChangeLog:

	* ast/rust-expr.h (struct AnonConst):
	Safe-guard InlineAsm structs
	(struct InlineAsmOperand): Likewise.
	* expand/rust-macro-builtins-asm.cc (parse_reg_operand_in):
	Likewise.
	(parse_reg_operand_out): Likewise.
	(parse_reg_operand_inout): Likewise.

Signed-off-by: badumbatish <[email protected]>
ChangeLog:

	* .github/workflows/ccpp.yml:
	Pin node16 by allowing old version
gcc/rust/ChangeLog:
	* ast/rust-expr.h:
	Remove unnecessary include.

Signed-off-by: Liam Naddell <[email protected]>
The visitor was still using the as_string() method.

gcc/rust/ChangeLog:

	* hir/rust-hir-dump.cc (Dump::do_matcharm): New.
	(Dump::do_matchcase): New.
	(Dump::visit(MatchExpr)): Adjust, don't use as_string.
	* hir/rust-hir-dump.h (Dump::do_matcharm, Dump::do_matchcase): New.

Signed-off-by: Marc Poulhiès <[email protected]>
ChangeLog:

	* .github/workflows/ccpp.yml: Switch to nightly version of rustc
	to use unstable features, namely extern types for FFI.

gcc/rust/ChangeLog:

	* Make-lang.in: Compile new file, rust-polonius.cc
	* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs: Opaque
	type to represent FFIVector from C++.
	* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi_generated.rs:
	Change types of fields in Output.
	* checks/errors/borrowck/ffi-polonius/src/lib.rs: Added helper
	functions to contruct Polonius output on C++ side,
	used helpers to contruct Polonius output on C++ side.
	* checks/errors/borrowck/polonius/rust-polonius-ffi.h (make_vector):
	FFIVector is a wrapper around std::vector for transfering data
	from Rust to C++.
	(struct Output): Use pointers to FFIVector instead of bool to
	store Polonius output data.
	* checks/errors/borrowck/polonius/rust-polonius.h (FFIVector__new):
	Helper function.
	(FFIVector__new_vec_pair): Likewise.
	(FFIVector__new_vec_triple): Likewise.
	(FFIVector__push): Likewise.
	(FFIVector__push_vec_pair): Likewise.
	(FFIVector__push_vec_triple): Likewise.
	* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
	Convert FFIVector to std::vector representation for easier
	navigation.
	* checks/errors/borrowck/polonius/rust-polonius.cc: New file,
	implementation of helper functions.

Signed-off-by: Kushal Pal <[email protected]>
libgrust/ChangeLog:

	* libformat_parser/Cargo.toml:
	Used crate-type instead of depricated crate_type.
	* libformat_parser/generic_format_parser/src/lib.rs:
	Remove dead code.
	* libformat_parser/src/lib.rs: Likewise.

Signed-off-by: Kushal Pal <[email protected]>
gcc/rust/ChangeLog:

	* Make-lang.in: Compile new file.
	* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
	Use new class to report errors.
	* checks/errors/borrowck/rust-borrow-checker-diagnostics.cc: New file.
	* checks/errors/borrowck/rust-borrow-checker-diagnostics.h:
	New file, adds new class.

Signed-off-by: Kushal Pal <[email protected]>
gcc/rust/ChangeLog:
	* hir/tree/rust-hir-expr.h: Add new get_operator_str method in
	ArithmeticOrLogicalExpr and CompoundAssignmentExpr
	* hir/tree/rust-hir.cc: Likewise
	* typecheck/rust-hir-type-check-expr.cc: Improve error message for
	operator expressions to display the correct operator symbol

gcc/testsuite/ChangeLog:
	* rust/compile/shadow1.rs: Fix test for new error message

Signed-off-by: Antonio Gomes <[email protected]>
First scan with "rg -v '\\r' gcc/testsuite/rust | rg 'dg-output'"

gcc/testsuite/ChangeLog:

	* rust/execute/torture/issue-2187.rs:
	Update pattern with \r* for dg-output tests
	* rust/execute/xfail/macro1.rs: Likewise
The CI failed to compile some recent code that requires a nightly
feature. This change allows the CI to use a nightly compiler instead.

ChangeLog:

	* .github/workflows/bootstrap.yml: Install nightly rustc.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
gcc/rust/ChangeLog:
	* typecheck/rust-hir-type-check-expr.cc:
	Fix ICE caused by not finding enum variant by adding new error
	message

gcc/testsuite/ChangeLog:
	* rust/compile/issue-3046.rs:
	Add test for new error message

Signed-off-by: Liam Naddell <[email protected]>
Change the assert of (expr != nullptr) to
(this->expr != nullptr) because we assigned (std::move(expr)) to
this->expr, no need to assert expr

gcc/rust/ChangeLog:

	* ast/rust-expr.h (struct AnonConst):
	Change assertion of constructor
	(struct InlineAsmOperand):
	Change assertion of constructor
gcc/rust/ChangeLog:

	* ast/rust-fmt.cc (Pieces::collect):
	Added options for ParseMode
	* ast/rust-fmt.h (collect_pieces): Likewise.
	(struct Pieces): Likewise.
	* expand/rust-macro-builtins-format-args.cc (MacroBuiltin::format_args_handler):
	Likewise.

libgrust/ChangeLog:

	* libformat_parser/generic_format_parser/src/lib.rs: Likewise.
	* libformat_parser/src/bin.rs: Likewise.
	* libformat_parser/src/lib.rs: Likewise.
gcc/rust/ChangeLog:

	* ast/rust-fmt.h (enum ParseMode):
	Drop typedef in Cpp

libgrust/ChangeLog:

	* libformat_parser/generic_format_parser/src/lib.rs:
	Remove repr(C)
	* libformat_parser/src/bin.rs: Use ffi
	* libformat_parser/src/lib.rs: pub ffi, create ParseMode and match
	rustc's parse mode
P-E-P and others added 30 commits November 20, 2024 13:36
The HIR made heavy use of pair and other unamed types which can be
difficult to read.

gcc/rust/ChangeLog:

	* backend/rust-compile-base.cc: Use FnParam getter.
	* backend/rust-compile-expr.cc (CompileExpr::visit): Likewise.
	* backend/rust-compile-intrinsic.cc: Likewise.
	* backend/rust-compile-type.cc: Likewise.
	* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit):
	Only visit childrens if not missing.
	* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Use
	a reference instead of a raw pointer.
	* hir/tree/rust-hir-expr.h: Add presence function for return
	expression.
	* hir/tree/rust-hir-item.h: Remove take_param_name.
	* hir/tree/rust-hir.h: Make mapping getter const.
	* typecheck/rust-hir-dot-operator.cc (MethodResolver::Select): Use
	getter.
	* typecheck/rust-hir-type-check-expr.cc: Likewise.
	* typecheck/rust-hir-type-check-implitem.cc: Use FnParam vector instead
	of std::pair of Pattern and BaseType.
	* typecheck/rust-hir-type-check-item.cc: Likewise.
	* typecheck/rust-hir-type-check.cc: Likewise.
	* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Use getters.
	(TypeCheckMethodCallExpr::check): Likewise.
	* typecheck/rust-tyty-cmp.h: Likewise.
	* typecheck/rust-tyty.cc: Use FnParam.
	* typecheck/rust-tyty.h (class FnParam): Add FnParam to handle function
	parameters instead of handling std::pairs.
	* typecheck/rust-unify.cc (UnifyRules::expect_fndef): Use getters.
	(UnifyRules::expect_fnptr): Likewise.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
Refactor the hir tree files to remove raw pointer usage and most forward
declarations. Move implementation out of headers and split headers into
smaller and more manageable units.

gcc/rust/ChangeLog:

	* Make-lang.in: Add new files.
	* hir/tree/rust-hir-item.h: Move Item definition and remove
	implementations to their corresponding cc file.
	* hir/tree/rust-hir-expr.h: Move implementation to the corresponding
	cc file.
	* hir/tree/rust-hir-path.h: Likewise.
	* hir/tree/rust-hir-pattern.h: Likewise.
	* hir/tree/rust-hir-stmt.h: Likewise.
	* hir/tree/rust-hir-type.h: Likewise.
	* hir/tree/rust-hir-visitor.h: Likewise.
	* hir/tree/rust-hir.h: Likewise.
	* hir/tree/rust-hir.cc (Crate::Crate): Add implementations from Crate
	and remove ConstGenericParam implementations to move them to their
	own file.
	* hir/tree/rust-hir-attrs.h: New file.
	* hir/tree/rust-hir-bound-abstract.h: New file.
	* hir/tree/rust-hir-bound.h: New file.
	* hir/tree/rust-hir-expr-abstract.h: New file.
	* hir/tree/rust-hir-expr.cc: New file.
	* hir/tree/rust-hir-generic-param.cc: New file.
	* hir/tree/rust-hir-generic-param.h: New file.
	* hir/tree/rust-hir-item.cc: New file.
	* hir/tree/rust-hir-literal.h: New file.
	* hir/tree/rust-hir-node.h: New file.
	* hir/tree/rust-hir-path.cc: New file.
	* hir/tree/rust-hir-pattern-abstract.h: New file.
	* hir/tree/rust-hir-simple-path.h: New file.
	* hir/tree/rust-hir-stmt.cc: New file.
	* hir/tree/rust-hir-trait-bound.h: New file.
	* hir/tree/rust-hir-type-abstract.cc: New file.
	* hir/tree/rust-hir-type-abstract.h: New file.
	* hir/tree/rust-hir-type-no-bounds.h: New file.
	* hir/tree/rust-hir-type.cc: New file.
	* hir/tree/rust-hir-visibility.h: New file.
	* hir/tree/rust-hir-visitable.h: New file.
	* checks/lints/rust-lint-marklive.h: Use References.
	* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Reformat
	vectors.
	* hir/rust-hir-dump.cc (Dump::visit): Use reference.
	* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve):
	Use references.
	* typecheck/rust-tyty-bounds.cc: Likewise.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
A variant being moved lead to a null being created and a segfault later
down the line.

gcc/rust/ChangeLog:

	* backend/rust-compile-expr.cc (CompileExpr::visit): Call getter
	instead of size function.
	* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit):
	Only check privacy if the type is present.
	* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Use an optional.
	* hir/tree/rust-hir-generic-param.h: Assert type before getting it.
	* hir/tree/rust-hir-item.h: Assert pointers before dereference, fix
	has_type condition.
	* hir/tree/rust-hir-path.h: Add more assertions.
	* hir/tree/rust-hir-stmt.cc: Change constructor with optionals.
	* hir/tree/rust-hir-stmt.h: Use optionals over smart pointers to
	emphasize these fields might be missing.
	* hir/tree/rust-hir.cc (LetStmt::as_string): Use getters.
	* typecheck/rust-hir-type-check-expr.cc: Clone structures to prevent
	parent's fields from being nulled by the move operation.
	* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Use
	optionals.
	* typecheck/rust-tyty.cc: Likewise.
	* typecheck/rust-tyty.h: Likewise.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
gcc/rust/ChangeLog:

	* hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit): Forward
	an optional to the constructor.
	* hir/tree/rust-hir-item.cc (TypeParam::TypeParam): Use an optional
	in the constructor.
	(TypeParam::operator=): Ensure the TypeParam has a type properly.
	(TypeParam::get_type_mappings): Likewise.
	* hir/tree/rust-hir-item.h: Wrap the type smart pointer into an
	optional.
	* hir/tree/rust-hir.cc (TypeParam::as_string): Unwrap optional type
	correctly.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
FnParam type where monomorphized during cloning.

gcc/rust/ChangeLog:

	* typecheck/rust-tyty.h: Reverse monomorphization during cloning and
	make a new function to explicitly monomorphize.
	* typecheck/rust-tyty.cc: Use monomorphization when required.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Issue references shall now be used with the Rust GCC prefix in order to
avoid mixing gccrs issues and GCC bugzilla PRs.

ChangeLog:

	* .github/workflows/commit-format.yml: Add a new step to detect issue
	references in commit messages.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
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 <[email protected]>
gcc/rust/ChangeLog:

	* hir/rust-hir-dump.cc (Dump::visit): add guards

Signed-off-by: Philip Herron <[email protected]>
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 #3231
Fixes #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 <[email protected]>
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 <[email protected]>
We are using github merge queues for some time now, instead of bors.
Remove unmaintained files, and remove bors mentions.

ChangeLog:

	* .github/bors_log_expected_warnings: Move to...
	* .github/log_expected_warnings: ...here.
	* .github/workflows/ccpp.yml:
	* .github/workflows/ccpp32alpine.yml:
	* CONTRIBUTING.md:
	* README.md:
	* .github/bors.toml: Removed.

Signed-off-by: Marc Poulhiès <[email protected]>
GCC's baseline was changed from C++11 -> C++14 and GCC 4.8 -> GCC 5.4
in r15-4719-ga9ec1bc06bd3cc, so adjust the baseline CI job accordingly.

One quirk here is that the Ubuntu image we're using in CI has 5.5.0
rather than 5.4.0. But I think we can eat that difference.

ChangeLog:
	* .github/workflows/ccpp.yml: Use GCC 5.5 instead of GCC 4.8.
ChangeLog:

	* .github/workflows/Remark.yml: Use v4.
	* .github/workflows/bootstrap.yml: Likewise.
	* .github/workflows/ccpp.yml: Likewise.
	* .github/workflows/ccpp32alpine.yml: Likewise.
	* .github/workflows/clang-format.yml: Likewise.
	* .github/workflows/commit-format.yml: Likewise.
	* .github/workflows/docker.yml: Likewise.

Signed-off-by: Marc Poulhiès <[email protected]>
Use a GCC 5.4.0 built from Compiler Explorer and execute everything on
ubuntu 22.04.
Use the caching framework provided by github to avoid downloading every
time from Compiler Explorer's servers.

ChangeLog:

	* .github/workflows/ccpp.yml: Adjust to use gcc-5 on ubuntu 22.04.

Signed-off-by: Marc Poulhiès <[email protected]>
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 <[email protected]>
ChangeLog:

	* README.md: Add fedora deps.

Signed-off-by: Jarkko Sakkinen <[email protected]>
gcc/rust/ChangeLog:

	* hir/rust-hir-dump.cc (Dump::visit): add missing null checks

Signed-off-by: Philip Herron <[email protected]>
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 #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 <[email protected]>
Fixes #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 <[email protected]>
We cannot apply aligned or packed after layout_type is called you need
to set this up first then call it.

Fixes #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 <[email protected]>
gcc/rust/ChangeLog:

	* util/rust-lang-item.h: Fix comment location to align with other comments.
gcc/rust/ChangeLog:

	* util/rust-hir-map.h: Move definitions from header...
	* util/rust-hir-map.cc: ...to source file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.