Skip to content

Attempt merge queue of dkm/bump-2025-06-26 #3983

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

Closed

Conversation

CohenArthur
Copy link
Member

This is a PR to a copy of master to see how using github for these bumps would work. Tagging @dkm for the experiment.

philberty and others added 30 commits July 15, 2025 20:26
This updates the contributor guide to let people know the update applys to
gccrs.

Co-authored-by: CohenArthur <[email protected]>
Co-authored-by: Marc Poulhiès <[email protected]>
... to that used in 'CONTRIBUTING.md'.
They will stick around for 90 days (as per GitHub default limits).

     https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts

Signed-off-by: Ben Boeckel <[email protected]>
Addresses Rust-GCC#487
Remark.yml contains the workflow and .remarkrc is the linter's config file.
Signed-off-by: M V V S Manoj Kumar <[email protected]>
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 [email protected]
…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
<Rust-GCC#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 <Rust-GCC#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 <[email protected]>
... to match Rust container image's base image

Signed-off-by: Zixing Liu <[email protected]>
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.
The Remark CI is breaking for seemingly unrelated reasons regarding
JavaScript syntax. Let's disable it in the meantime and investigate so
that our PRs can still get proper feedback
... update Node.js to the latest LTS branch
This is to gate PR's which might break builds on 32bit systems.

Addresses Rust-GCC#1439
Change the CI requirements to have seperate jobs for 64 and 32 bit testing.
It also runs both combinations on the gcc4.8 build job. Bors only requires
the normal build check 64bit job to pass to minimize impact.
powerboat9 and others added 25 commits July 15, 2025 20:26
This is the first patch in a set intended to fully remove name
resolution 1.0. As such, it should leave name resolution 1.0 technically
available but broken.

gcc/rust/ChangeLog:

	* backend/rust-compile-context.cc (Context::Context): Remove
	initialization of resolver field.
	* backend/rust-compile-context.h (Context::get_resolver): Remove
	function.
	(Context::resolver): Remove field.
	* backend/rust-compile-expr.cc (CompileExpr::visit): Assume name
	resolution 2.0 is always enabled.
	(CompileExpr::generate_closure_function): Likewise.
	* backend/rust-compile-implitem.cc (CompileTraitItem::visit):
	Likewise.
	* backend/rust-compile-item.cc (CompileItem::visit): Likewise.
	* backend/rust-compile-resolve-path.cc
	(ResolvePathRef::resolve): Likewise.

Signed-off-by: Owen Avery <[email protected]>
DefaultResolver already handles StructStruct in a more correct fashion.

gcc/rust/ChangeLog:

	* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Remove
	override for StructStruct visitor.
	* resolve/rust-late-name-resolver-2.0.h (Late::visit): Likewise.

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

	* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Replace
	usages of reinterpret_cast with static_cast.

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

	* parse/rust-parse-impl.h: Add enum prefix.
	* parse/rust-parse.h (enum ParseSelfError): Change from enum...
	(enum class): To enum class.

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

	* expand/rust-macro-builtins-format-args.cc
	(format_args_parse_arguments): Accept a RAW_STRING_LITERAL token
	as the first argument.

Signed-off-by: Owen Avery <[email protected]>
This doesn't do anything beyond creating TryExpr and parsing them, so
try expressions shouldn't be able to make it past AST lowering yet.

gcc/rust/ChangeLog:

	* ast/rust-ast-collector.cc (TokenCollector::visit): Add visitor
	for TryExpr.
	* ast/rust-ast-collector.h (TokenCollector::visit): Likewise.
	* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
	* ast/rust-ast-visitor.h (ASTVisitor::visit): Likewise.
	(DefaultASTVisitor::visit): Likewise.
	* expand/rust-derive.h (DeriveVisitor::visit): Likewise.
	* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
	* hir/rust-ast-lower-base.h (ASTLoweringBase::visit): Likewise.
	* resolve/rust-ast-resolve-base.cc (ResolverBase::visit):
	Likewise.
	* resolve/rust-ast-resolve-base.h (ResolverBase::visit):
	Likewise.
	* ast/rust-ast-full-decls.h (class TryExpr): New forward class
	declaration.
	* ast/rust-ast.cc (TryExpr::as_string): New function.
	(TryExpr::accept_vis): Likewise.
	* ast/rust-expr.h (class TryExpr): New class.
	* parse/rust-parse.h (Parser::parse_try_expr): New function.
	* parse/rust-parse-impl.h (Parser::parse_try_expr): Likewise.
	(Parser::null_denotation_not_path): Use parse_try_expr to parse
	try expressions.

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

	* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Check that the WhileLet has a label
	before visiting it.

gcc/testsuite/ChangeLog:

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

	* resolve/rust-late-name-resolver-2.0.cc (Late::visit): New visitor.
	* resolve/rust-late-name-resolver-2.0.h: Declare it.
	* resolve/rust-name-resolution-context.h (enum class): New binding context.
This patch adds proper folding to the const expression for array capacity we
already have the const folding mechanics and the query system needed to handle cases
where the capacity is a function call in a const context. This leverages and pulls the
gcc tree capacity into the TyTy::ArrayType so it can be used for more typechecking and
eventually doing more const generics work.

Addresses Rust-GCC#3885
Fixes Rust-GCC#3882

gcc/rust/ChangeLog:

	* backend/rust-compile-base.cc (HIRCompileBase::query_compile_const_expr): new wrapper
	* backend/rust-compile-base.h: add prototype
	* backend/rust-compile-context.cc (Context::get): singleton helper
	* backend/rust-compile-context.h: likewise
	* backend/rust-compile-type.cc (TyTyResolveCompile::visit): handle infer's that can default
	* rust-session-manager.cc (Session::compile_crate): create the gcc context earlier for tychk
	* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): const fold it
	* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise
	* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): likewise
	* typecheck/rust-tyty.cc (BaseType::monomorphized_clone): fix constructor call
	(ArrayType::as_string): print capacity
	(ArrayType::clone): fix constructor call
	* typecheck/rust-tyty.h: track capacity
	* typecheck/rust-unify.cc (UnifyRules::expect_array): check the capacities

gcc/testsuite/ChangeLog:

	* rust/compile/all-cast.rs: shows array capacity now
	* rust/compile/arrays2.rs: likewise
	* rust/compile/const3.rs: fix error message
	* rust/compile/const_generics_3.rs: disable until typecheck we get proper errors now!
	* rust/compile/usize1.rs: proper capacity error message

Signed-off-by: Philip Herron <[email protected]>
This is an invalid test case but we just need a guard for the missing
borrow expression.

Fixes Rust-GCC#3874

gcc/rust/ChangeLog:

	* ast/rust-ast-collector.cc (TokenCollector::visit): check for missing borrow
	* ast/rust-expr.h: add helper

gcc/testsuite/ChangeLog:

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

Signed-off-by: Philip Herron <[email protected]>
This commit implements basic type checking support for SlicePattern, based on rustc's
check_pat_slice function.

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit(SlicePattern)):
		Implement initial type checking for SlicePattern.

Signed-off-by: Yap Zhi Heng <[email protected]>
This change is made to ensure that LiteralPatterns in SlicePattern are type-checked
against the scrutinee array/slice's element type properly.

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc(TypeCheckPattern::visit(LiteralPattern)):
		Check LiteralPattern's type against its parent.

Signed-off-by: Yap Zhi Heng <[email protected]>
Fix narrowing:

  -../../gcc/rust/checks/errors/borrowck/rust-borrow-checker-diagnostics.cc:145:46:
  warning: narrowing conversion of ‘loan’ from ‘Rust::Polonius::Loan’ {aka
  ‘long unsigned int’} to ‘uint32_t’ {aka ‘unsigned int’} [-Wnarrowing]

gcc/rust/ChangeLog:
	* checks/errors/borrowck/rust-bir-place.h (LoanId::value): Make
	it size_t to match Loan's base type.

Signed-off-by: Marc Poulhiès <[email protected]>
After previous change, removed the last warning from the
expected file.

ChangeLog:

	* .github/glibcxx_ubuntu64b_log_expected_warnings: Remove warning.
	* .github/log_expected_warnings: Likewise.

Signed-off-by: Marc Poulhiès <[email protected]>
This was a nasty issue to debug, the issue was very eager type bounds
checking. So for example:

  pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs>

The super trait of PartialEq<Rhs> is a generic substitution and we reuse
our bounds code here for normal generic bounds and generics an invalid
bounds check was occuring when PartialEq<Rhs> was getting substituted becase
this is a trait doing proper bounds checking is not valid here because this
is telling us about the bounds in this case.

Fixes Rust-GCC#3836

gcc/rust/ChangeLog:

	* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): track is super trait
	* typecheck/rust-hir-type-bounds.h: refactor bounds scan
	* typecheck/rust-hir-type-check-base.h: track from super trait
	* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise
	* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::is_bound_satisfied_for_type): refactor
	(TypeBoundsProbe::scan): likewise
	(TypeBoundPredicate::apply_generic_arguments): likewise
	* typecheck/rust-tyty-subst.cc: optional bounds checking on parm subst
	* typecheck/rust-tyty-subst.h: likewise
	* typecheck/rust-tyty.h: likewise

gcc/testsuite/ChangeLog:

	* rust/compile/derive_partial_ord1.rs: this is now fully supported
	* rust/execute/torture/basic_partial_ord1.rs: add missing i32 impl
	* rust/execute/torture/basic_partial_ord2.rs: likewise
	* rust/compile/issue-3836.rs: New test.
	* rust/execute/torture/issue-3836.rs: New test.
	* rust/execute/torture/partial-ord-6.rs: New test.

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

	* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Check for a label
	before visiting it.
…rcions

This case:

    let i = 1;
    let j = i as i64;

'i' is meant to default to i32 but the inference was making both of these
i64 because the code was prefering coercion logic which can end up with a
default unify which causes the ?integer to unify with i64 making them both
i64.

But all we need to do is allow the simple cast rules to run first then
fallback to coercions but special consideration has to be made to ensure
that if there are dyn objects needed then this needs a unsize coercion, but
also we need to ensure the underlying types are a valid simple cast too
otherwise these also need to fallback to the coercion code.

Fixes Rust-GCC#2680

gcc/rust/ChangeLog:

	* typecheck/rust-casts.cc (TypeCastRules::resolve): optional emit_error flag
	(TypeCastRules::check): try the simple cast rules then fallback to coercions
	(TypeCastRules::check_ptr_ptr_cast): ensure the underlying's
	(TypeCastRules::emit_cast_error): make this a static helper
	* typecheck/rust-casts.h: new emit_error prototype

gcc/testsuite/ChangeLog:

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

Signed-off-by: Philip Herron <[email protected]>
We just had a typo returning ok true when it should have been false.

Fixes Rust-GCC#3876

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::visit): fix typo

gcc/testsuite/ChangeLog:

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

Signed-off-by: Philip Herron <[email protected]>
Fixes Rust-GCC#3599

gcc/testsuite/ChangeLog:

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

Signed-off-by: Philip Herron <[email protected]>
Fixes Rust-GCC#3144

gcc/testsuite/ChangeLog:

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

Signed-off-by: Philip Herron <[email protected]>
Fixes Rust-GCC#1048

gcc/testsuite/ChangeLog:

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

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

	* util/rust-attribute-values.h: Add declarations for them.
	* util/rust-attributes.cc: Add definitions.
We have more complex test cases already but this will close out this issue.

Fixes Rust-GCC#2005

gcc/testsuite/ChangeLog:

	* rust/execute/torture/issue-2005.rs: New test.

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

	* typecheck/rust-hir-type-check-pattern.cc(TypeCheckPattern::visit(SlicePattern)):
		Implement size checking for SlicePattern when type checking against array parent

Signed-off-by: Yap Zhi Heng <[email protected]>
…25-06-26

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.
@CohenArthur CohenArthur added this pull request to the merge queue Jul 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Jul 18, 2025
@CohenArthur CohenArthur added this pull request to the merge queue Jul 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Jul 18, 2025
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.