Skip to content

Conversation

dkm
Copy link
Member

@dkm dkm commented Oct 8, 2025

This is a sync with upstream GCC:

-- gerris 🦀

@dkm dkm force-pushed the gerris/rebase/2025-10-08 branch 2 times, most recently from d65e0fc to 6b23cb7 Compare October 8, 2025 08:37
@dkm
Copy link
Member Author

dkm commented Oct 8, 2025

FTR, I've rebased/squash all my CI stuff for sending mails + added a commit to bump the macos dep.

@dkm
Copy link
Member Author

dkm commented Oct 8, 2025

@powerboat9 doesn't seem to work for macos... Do we really want to have a WIP branch in our CI?

@dkm dkm self-assigned this Oct 8, 2025
@dkm
Copy link
Member Author

dkm commented Oct 8, 2025

And FTR, before pushing this, I'll fix the mail workflow to really skip too-big PR and check that the label checking really works.

@dkm dkm force-pushed the gerris/rebase/2025-10-08 branch from 6b23cb7 to 0554e02 Compare October 8, 2025 18:43
@thesamesam
Copy link
Contributor

IMO having macOS in there is too brittle for now because we're combining 3 trees in cases like this (gccrs, gcc upstream, iain's WIP fork).

@dkm
Copy link
Member Author

dkm commented Oct 9, 2025

I'll give it one more chance. iains is going to rebase his branch and fix the conflicts. I'll then rebase my branch over a more recent revision and everything should "just work"®

philberty and others added 21 commits October 9, 2025 20:42
Addresses #487
Remark.yml contains the workflow and .remarkrc is the linter's config file.
Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
Apparently everyone but me knows how to do that; I'm now documenting it for my
own future use.
This script tries to isolate our changes to GCC minus the changes to
gcc/config so that we can visualize our development history.
This should prevent new warnings from appearing silently

Signed-off-by: Daniel del Castillo delcastillodelarosadaniel@gmail.com
…obs.build-and-check'

That's what I use in my local development enviroment, and I suppose I'll
be the main one touching this file semi-regularly in context of
<#247> "Rebasing against GCC".
…uild-and-check'

This avoids the supposed issue that in case that 'make' fails, the whole
'jobs.build-and-check' stops, and 'Build logs' isn't executed, and thus there's
no indication in the GitHub UI why 'make' failed.

Using a shell pipeline is OK; the exit code of 'make' isn't lost, as per
<https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell>,
'bash' is being run with '-o pipefail'.
…w warnings' step

Run it in scratch directory, too, to not pollute the pristine sources
directory.  Point to <#1026> in case of
failure.
As Thomas Schwinge pointed out, GCC 4.8 is the minimum version to be
used for building current GCC, meaning that we should make an effort to
support it before we consider upstreaming or backporting. The main
differences are probably a less powerful standard template library or
small compilation differences.
This adds a version of the build-and-check job that runs with clang on
macOS.
This will provide some synchronization for output lines, and so will
make comparisons with known warnings as part of CI more reliable.
... when the workflow is ran in a forked repository

Signed-off-by: Zixing Liu <liushuyu011@gmail.com>
Signed-off-by: Zixing Liu <liushuyu011@gmail.com>
... to match Rust container image's base image

Signed-off-by: Zixing Liu <liushuyu011@gmail.com>
Sometimes, the GCCRS_BUILD file would end up empty. I believe this is
due to how Dockerfiles work in that there was a "race condition" between
the two `RUN` commands. Hopefully this should fix it.
philberty and others added 25 commits October 9, 2025 20:42
This was an old chunk of code to try and sort out the Self type on resolving
methods for impl blocks. But this is not required when our unify code works
properly.

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-expr.cc: remove old hack

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
We need to check for errors on the number of copies expression before
trying to const fold it otherwise it will just fail in the const evaluator.

Fixes #4165

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): check for error

gcc/testsuite/ChangeLog:

	* rust/compile/issue-4165.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
self params dont have a type unless used within impl blocks. Rustc as far as I
can tell in this senario generics a synthetic param of type Self in this senario
so that it keeps consistent error diagnostic for number of parameters but the
logic for what the parameter typpe should be seems unclear.

Fixes #3592

gcc/rust/ChangeLog:

	* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): add error diagnostic

gcc/testsuite/ChangeLog:

	* rust/compile/issue-3592.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
This changes the assertion into a valid error diagnostic.

Fixes #3538

gcc/rust/ChangeLog:

	* backend/rust-compile-resolve-path.cc: add error diag

gcc/testsuite/ChangeLog:

	* rust/compile/issue-3538.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
This new workflow is used to send emails to the gcc-patches@ mailing list
after every merged PR.

For each merged PR:
- remove commits touching files not to-be-upstreamed (e.g. github
workflow, README.md, ...)
- send a mail series

Each mail contains explanation + links to commits on the github project.

Authors of commits will be put in Cc: of emails.

Configure it by setting the following secrets in github:
- PATCH_TO: the "To:" field for the emails
- PATCH_CC: optional "Cc:"
- SMTP_FROM, SMTP_PASSWORD, SMTP_PORT, SMTP_SERVER, STMP_USERNAME: self explanatory

ChangeLog:

	* .github/workflows/send-emails.yml: New file.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
Builtin metavars are not in the fragment, the compiler should not emit
an error message.

gcc/rust/ChangeLog:

	* expand/rust-macro-substitute-ctx.cc (is_builtin_metavariable): Add
	function to check builtin metavars knowledge.
	(SubstituteCtx::check_repetition_amount): Do not process missing
	fragment.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Emitting the errors later means some error could be emitted multiple
times.

gcc/rust/ChangeLog:

	* expand/rust-macro-expand.cc (transcribe_expression): Emit error
	early.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/ChangeLog:

	* expand/rust-macro-expand.cc: Forward invocation tree locus to
	substitution context.
	* expand/rust-macro-substitute-ctx.cc: Use origin location for expanded
	tokens.
	* expand/rust-macro-substitute-ctx.h (class SubstituteCtx): Save
	invocation location.

gcc/testsuite/ChangeLog:

	* rust/compile/macros/mbe/macro58.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/ChangeLog:

	* expand/rust-expand-visitor.cc: Remove old visitors.
	* expand/rust-expand-visitor.h: Likewise, plus inherit from PointerVisitor.
gcc/rust/ChangeLog:

	* backend/rust-compile-extern.h: Add includes.
	(CompileExternItem::visit): Use get_link_name.
	(CompileExternItem::get_link_name): New static member function.
	* util/rust-attribute-values.h (Attributes::LINK_NAME): New
	static constexpr member variable.
	* util/rust-attributes.cc (__definitions): New entry for
	LINK_NAME.
	* util/rust-ggc.cc: Include "rust-ast.h".
	(Ident::Ident): Add overload for Rust::Identifier.
	* util/rust-ggc.h (class Identifier): Forward declare.
	(Ident::Ident): Add overload for Rust::Identifier.

gcc/testsuite/ChangeLog:

	* rust/execute/torture/link-name.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/ChangeLog:

	* ast/rust-pattern.h (StructPatternElements): Rename has_struct_pattern_etc
	to has_rest_pattern, and has_etc to has_rest to signify presense of rest
	patterns more clearly.
	* ast/rust-pattern.cc (StructPatternElements::as_string): Rename variables
	accordingly.
	* ast/rust-ast-collector.cc: Rename variables accordingly.
	* expand/rust-cfg-strip.cc: Rename variables accordingly.
	* parse/rust-parse-impl.h: Rename variable accordingly.
	* hir/tree/rust-hir-pattern.h (StructPatternElements): Add a boolean to track
	presense of rest pattern.
	* hir/rust-ast-lower-pattern.cc (visit(StructPattern)): Add support for
	lowering rest pattern to HIR.
	* typecheck/rust-hir-type-check-pattern.cc (visit(StructPattern)): Remove
	size check when rest pattern is present.

Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
Previously, type checking of StructPattern will throw an error if it is used
to match against a tuple struct, even though it is possible to do so in rustc.

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (visit(StructPattern)): Add type check
	support for StructPatterns matching against a TUPLE type ADT.
	* backend/rust-compile-pattern.cc(CompilePatternBindings::visit(StructPattern)):
	Update assert to allow TUPLE type ADTs.
	* hir/tree/rust-hir.cc (StructPatternField::as_string()): Improve info dumped.

Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
This adds compilation of libcore up to the AST validation phase to the
testsuite.

gcc/testsuite/ChangeLog:

	* rust/core/core.exp: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Adds a test to verify extra parentheses are discarded, and the source is
compiled as expected.

Resolves: #2886

gcc/testsuite/ChangeLog:

	* rust/compile/issue-4148.rs: New test.

Signed-off-by: Elle Rhumsaa <elle@weathered-steel.dev>
gcc/rust/ChangeLog:

	* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit(TupleStructPattern)):
	Implement lowering of AST::TupleStructItemsHasRest to HIR.
	* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit(TupleStructPattern)):
	Add the respective type checking for AST::TupleStructItemsHasRest
	* checks/errors/rust-hir-pattern-analysis.cc (lower_tuple_pattern):
	Add respective pattern for HAS_REST case.

Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
gcc/rust/ChangeLog:

	* backend/rust-compile-pattern.cc: Add compilation support for TupleStructItemsHasRest
	in CompilePatternCheckExpr(TupleStructPattern) & CompilePatternBindings(TupleStructPattern)

Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (visit(TupleStructPattern)):
	Update error for mismatched number of fields to use rich_location.

Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
Path must be made of a single literal item, otherwise an error should be
thrown.

gcc/rust/ChangeLog:

	* util/rust-attributes.cc (AttributeChecker::check_attribute): Recurse
	within attr input for additional attribute checking.
	(AttributeChecker::visit): Remove empty definition in favor of default
	ast visitor definition.
	* util/rust-attributes.h: Remove now unused prototypes.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/ChangeLog:

	* ast/rust-ast.h: Add missing override modifier.
	* ast/rust-path.h: Likewise.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
We still don't know which location should be preferred over the other,
this means that nobody should rely on this function's return value.

gcc/rust/ChangeLog:

	* ast/rust-expr.h: Force crash when retrieving locus.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Add location for malformed attribute errors and avoid processing of
malformed attributes.

gcc/rust/ChangeLog:

	* ast/rust-ast.cc (AttrInputMetaItemContainer::separate_cfg_attrs):
	Avoid malformed attributes.
	* util/rust-attributes.cc (AttributeChecker::visit): Change location.

gcc/testsuite/ChangeLog:

	* rust/compile/attr_malformed_path.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Doc attribute checking was not performed on traits.

gcc/rust/ChangeLog:

	* util/rust-attributes.cc (check_doc_attribute): Change message.
	(AttributeChecker::visit): Add doc attribute checking on traits.

gcc/testsuite/ChangeLog:

	* rust/compile/attr_malformed_doc.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Converts an assert into an early return during AST parsing.

Resolves: #4145

gcc/rust/ChangeLog:

	* ast/rust-ast.cc (Module::process_file_path): empty module early return

Signed-off-by: Elle Rhumsaa <elle@weathered-steel.dev>
gcc/testsuite/ChangeLog:

	* rust/compile/issue-4145.rs: New test.

Signed-off-by: Elle Rhumsaa <elle@weathered-steel.dev>
This patch refactors the const generic type system to follow the same pattern
as regular type parameters. The monolithic ConstType is split into four
distinct types:

  ConstParamType (generic parameter placeholder)
  ConstValueType (resolved constant value)
  ConstInferType (inference variable)
  ConstErrorType (error sentinel)

gcc/rust/ChangeLog:

	* backend/rust-compile-expr.cc (CompileExpr::array_copied_expr): refactor to new classes
	* backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit): likewise
	(CompilePatternBindings::visit): likewise
	* backend/rust-compile-type.cc (TyTyResolveCompile::visit): likewise
	* backend/rust-compile-type.h: likewise
	* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): likewise
	* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise
	* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): likewise
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise
	* typecheck/rust-substitution-mapper.cc (SubstMapperInternal::visit): likewise
	* typecheck/rust-substitution-mapper.h: likewise
	* typecheck/rust-type-util.cc (unify_site_and): remove bad delete (alpine32)
	* typecheck/rust-tyty-call.h: refactor to new classes
	* typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::clone): likewise
	(SubstitutionRef::infer_substitions): likewise
	* typecheck/rust-tyty-util.cc (TyVar::get_implicit_const_infer_var): likewise
	* typecheck/rust-tyty-util.h: likewise
	* typecheck/rust-tyty-variance-analysis-private.h: likewise
	* typecheck/rust-tyty-visitor.h: likewise
	* typecheck/rust-tyty.cc (BaseType::destructure): likewise
	(BaseType::monomorphized_clone): likewise
	(BaseType::is_concrete): likewise
	(VariantDef::clone): likewise
	(VariantDef::monomorphized_clone): likewise
	(ArrayType::as_string): likewise
	(ArrayType::get_capacity): likewise
	(ArrayType::handle_substitions): likewise
	(generate_tree_str): likewise
	(ConstType::ConstType): likewise
	(ConstParamType::ConstParamType): likewise
	(ConstType::accept_vis): likewise
	(ConstParamType::const_kind): likewise
	(ConstParamType::get_symbol): likewise
	(ConstParamType::can_resolve): likewise
	(ConstParamType::resolve): likewise
	(ConstParamType::accept_vis): likewise
	(ConstType::set_value): likewise
	(ConstType::as_string): likewise
	(ConstParamType::as_string): likewise
	(ConstType::clone): likewise
	(ConstParamType::clone): likewise
	(ConstType::get_symbol): likewise
	(ConstParamType::get_name): likewise
	(ConstType::can_resolve): likewise
	(ConstParamType::is_equal): likewise
	(ConstType::resolve): likewise
	(ConstValueType::ConstValueType): likewise
	(ConstValueType::const_kind): likewise
	(ConstValueType::accept_vis): likewise
	(ConstValueType::as_string): likewise
	(ConstValueType::clone): likewise
	(ConstValueType::get_name): likewise
	(ConstValueType::is_equal): likewise
	(ConstValueType::get_value): likewise
	(ConstInferType::ConstInferType): likewise
	(ConstInferType::const_kind): likewise
	(ConstInferType::accept_vis): likewise
	(ConstType::get_name): likewise
	(ConstInferType::as_string): likewise
	(ConstInferType::clone): likewise
	(ConstInferType::get_name): likewise
	(ConstType::is_equal): likewise
	(ConstInferType::is_equal): likewise
	(ConstErrorType::ConstErrorType): likewise
	(ConstErrorType::const_kind): likewise
	(ConstType::handle_substitions): likewise
	(ConstErrorType::accept_vis): likewise
	(ConstErrorType::as_string): likewise
	(ConstErrorType::clone): likewise
	(ConstErrorType::get_name): likewise
	(ConstErrorType::is_equal): likewise
	* typecheck/rust-tyty.h (class BaseConstType): likewise
	(class ConstType): likewise
	(class ConstParamType): likewise
	(class ConstValueType): likewise
	(class ConstInferType): likewise
	(class ConstErrorType): likewise
	* typecheck/rust-unify.cc (UnifyRules::commit): likewise
	(UnifyRules::go): likewise
	(UnifyRules::expect_array): likewise
	(UnifyRules::expect_const): likewise
	* typecheck/rust-unify.h: likewise

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
@dkm dkm force-pushed the gerris/rebase/2025-10-08 branch from 0554e02 to 196a6a8 Compare October 9, 2025 18:43
dkm added 3 commits October 9, 2025 20:44
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
Cap the number of commits to 30. Anything above that is suspicious and we should not send 30 mails at once.
Note that github REST API has a limit of 250 elements in arrays, so "huge" PR is hard to handle anyway.

Also change the conditional to fix them (!!) and make it clearer.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
…se/2025-10-08

This branch has a no-op merge as the last commit:
 - one arm is the "current" development branch from github
 - the other arm is a rebased version of the "current" master branch onto a recent GCC's master

The merge is obtained with "git merge --strategy=ours" to only keep the changes from second arm.
@dkm dkm force-pushed the gerris/rebase/2025-10-08 branch from 196a6a8 to b31f7a5 Compare October 9, 2025 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.