-
Notifications
You must be signed in to change notification settings - Fork 193
Fake PR to test the upstreaming of commit up to gerris/rebase/2025-11-12 #4282
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
Open
dkm
wants to merge
14
commits into
dkm/upstream-base
Choose a base branch
from
gerris/rebase/2025-11-12
base: dkm/upstream-base
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e06bccc to
cfa155b
Compare
Member
Author
|
@CohenArthur this should be ready for upstream. |
Member
Author
|
ah, not quite. There's a revert in there. |
An imbricated exported macro leads to a segfault. gcc/rust/ChangeLog: * metadata/rust-export-metadata.cc (ExportContext::emit_macro): Change method argument NodeId to AST::MacroRulesDefinition. * metadata/rust-export-metadata.h: Likewise. * util/rust-hir-map.cc (Mappings::insert_exported_macro): Insert AST::MacroRulesDefinition instead of NodeId. * util/rust-hir-map.h: Change methods declarations of exported macros. gcc/testsuite/ChangeLog: * rust/compile/issue-3617.rs: New test. Signed-off-by: Lucas Ly Ba <[email protected]>
GIMPLE output for literalpattern_neg.rs test case:
...
x = -55;
RUSTTMP.2 = x;
if (RUSTTMP.2 == 55) goto <D.113>; else goto <D.114>;
<D.113>:
{
RUSTTMP.1 = 1;
goto <D.107>;
}
<D.114>:
if (RUSTTMP.2 == -55) goto <D.115>; else goto <D.116>;
<D.115>:
{
RUSTTMP.1 = 0;
goto <D.107>;
}
<D.116>:
if (1 != 0) goto <D.117>; else goto <D.118>;
<D.117>:
{
RUSTTMP.1 = 1;
goto <D.107>;
}
...
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h (parse_literal_or_range_pattern): Parse minus sign
properly for LiteralPattern.
* ast/rust-pattern.h (LiteralPattern): Add has_minus boolean for LiteralPattern.
* hir/tree/rust-hir-pattern.h (LiteralPattern): Ditto.
* ast/rust-pattern.cc (LiteralPattern::as_string): Update to include minus sign
if present.
* hir/tree/rust-hir.cc (LiteralPattern::as_string): Ditto.
* hir/rust-ast-lower-pattern.cc (visit(LiteralPattern)): Pass has_minus boolean
from AST to HIR.
* backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit(LiteralPattern)):
Compile litexpr as negative if minus sign is present.
Signed-off-by: Yap Zhi Heng <[email protected]>
When a const generic with a default value is not trailing, emit an error. gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_generic_params): Emit an error when const generics with a default value is not trailing. gcc/testsuite/ChangeLog: * rust/compile/const_generics_17.rs: New test. * rust/compile/generics14.rs: New test. Signed-off-by: vishruth-thimmaiah <[email protected]>
…sitive
GIMPLE output for compile/issue-4242.rs:
...
x = 1;
RUSTTMP.2 = x;
_1 = RUSTTMP.2 >= -55;
_2 = RUSTTMP.2 < 0;
_3 = _1 & _2;
if (_3 != 0) goto <D.112>; else goto <D.113>;
<D.112>:
{
RUSTTMP.1 = 2;
goto <D.105>;
}
<D.113>:
_4 = RUSTTMP.2 >= -99;
_5 = RUSTTMP.2 < -55;
_6 = _4 & _5;
if (_6 != 0) goto <D.114>; else goto <D.115>;
<D.114>:
{
RUSTTMP.1 = 3;
goto <D.105>;
}
...
gcc/rust/ChangeLog:
* backend/rust-compile-pattern.cc (compile_range_pattern_bound): Set litexpr
to negative if has_minus is present in the RangePatternBoundLiteral param.
Signed-off-by: Yap Zhi Heng <[email protected]>
Checks whether upper bound of range is not lower or equal to the lower bound. gcc/rust/ChangeLog: * backend/rust-compile-pattern.cc(compilePatternCheckExpr::visit(RangePattern)): Add E0579 check to ensure that lower bound is always below upper bound. Signed-off-by: Yap Zhi Heng <[email protected]>
Const generics bind values which can be accessed like a normal path but the difference is that they can be true expression values not just type paths. This patch adds support to resolving a method inference which passes a generic value into the method and fixes some missed bugs along the way. The tricky part was that there is a case where in the return position of a method returning a const param type vs the type of the method there is a special case in the unify rules so that we unify the specified type of the const param type not the const param itself. gcc/rust/ChangeLog: * backend/rust-compile-resolve-path.cc: handle const param values * typecheck/rust-hir-type-check-item.cc: generate const infer vars when required * typecheck/rust-type-util.cc (unify_site_and): handle a null param cleanup * typecheck/rust-tyty-util.cc (TyVar::get_implicit_const_infer_var): helper interface * typecheck/rust-tyty-util.h: update header prototypes * typecheck/rust-tyty.cc (BaseType::is_concrete): correctly handle const types (ConstParamType::get_name): emit the specified type (ConstParamType::is_equal): fix recursion loop * typecheck/rust-unify.cc (UnifyRules::go): const infer vars need cleanup too * typecheck/rust-unify.h: support base generics gcc/testsuite/ChangeLog: * rust/execute/torture/const-generics-2.rs: New test. Signed-off-by: Philip Herron <[email protected]>
gcc/rust/ChangeLog: * ast/rust-ast.cc (Attribute::check_cfg_predicate): Make error. gcc/testsuite/ChangeLog: * rust/compile/issue-4267.rs: New test. Signed-off-by: Lucas Ly Ba <[email protected]>
gcc/rust/ChangeLog: * ast/rust-ast.cc (Attribute::check_cfg_predicate): add cfg path in condition gcc/testsuite/ChangeLog: * rust/compile/issue-4261.rs: New test. Signed-off-by: Lucas Ly Ba <[email protected]>
gcc/rust/ChangeLog: * ast/rust-ast.cc (MetaItemLitExpr::check_cfg_predicate): Make error. gcc/testsuite/ChangeLog: * rust/compile/issue-4222.rs: New test. Signed-off-by: Lucas Ly Ba <[email protected]>
Adds a proper check for missing patterns in while expressions. Fixes #4162 gcc/rust/ChangeLog: * parse/rust-parse-impl.h(Parser<ManagedTokenSource>::parse_while_let_loop_expr): Add check for missing pattern. gcc/testsuite/ChangeLog: * rust/compile/issue-4162.rs: New test. Signed-off-by: Lucas Ly Ba <[email protected]>
gcc/rust/ChangeLog: * ast/rust-ast.cc (Attribute::is_derive): Change is_derive method with its valid path. * util/rust-attribute-values.h: Delete redudant derive attribute. * util/rust-attributes.cc (AttributeChecker::check_inner_attribute): Helper method for check_inner_attributes (AttributeChecker::check_inner_attributes): Implement method for errors check. * util/rust-attributes.h: Add methods above in header. gcc/testsuite/ChangeLog: * rust/compile/issue-4212.rs: * rust/compile/issue-4219.rs: New test. Signed-off-by: Lucas Ly Ba <[email protected]>
When we were processing generic const param types on arrays the size type was overriding the const param decl because of a hirid reference mismatch Fixes #3879 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): fix mappings gcc/testsuite/ChangeLog: * rust/compile/const_generics_18.rs: New test. * rust/compile/const_generics_19.rs: New test. * rust/execute/torture/const-generics-3.rs: New test. * rust/execute/torture/const-generics-4.rs: New test. Signed-off-by: Philip Herron <[email protected]>
Impl items can have constants defined which could in turn be generic this was
not supported by gccrs and missed. So for example:
impl<T> Foo<T> {
const MAGIC: usize = mem::size_of::<T>();
}
This is a normal type parameter but in order to setup the generics we need to
create a synthetic TyTy::FnType so we can bind the parent's impl generics to
the type system and it just works like any other generic item at that point.
Then for example we have:
impl<const N: usize> Foo<N> {
const VALUE: usize = N;
}
Again we consistently bind the this const generic parameter the same way so
the lazy evaluation of the generic can take place.
gcc/rust/ChangeLog:
* backend/rust-compile-item.cc (CompileItem::visit): support the synthetic function consts
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::Resolve): likewise
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit): create the synth
* typecheck/rust-tyty.h: new flag for synthetic constant
gcc/testsuite/ChangeLog:
* rust/execute/torture/const-generics-5.rs: New test.
* rust/execute/torture/const-generics-6.rs: New test.
* rust/execute/torture/const-generics-7.rs: New test.
Signed-off-by: Philip Herron <[email protected]>
When we typecheck a trait impl block item, at the end we validate it against the trait definition by doing a final unify but if the type check fails on the the impl item it returns NULL here. The other issue was that if we fail to resolve the specified lifetime we return error early, this changes the typechecking to default to an anon lifetime so we can continue typechecking. Fixes #4188 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItemWithTrait::visit): null guard * typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): default to anon gcc/testsuite/ChangeLog: * rust/compile/issue-4188.rs: New test. Signed-off-by: Philip Herron <[email protected]>
cfa155b to
aa4982d
Compare
Member
Author
|
Ok, done, should be ok now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a fake PR, not meant to be merged. It tries to merge commits to upstream with an upstream base branch dkm/upstream-base.
We're only interested by the CI results.
-- gerris 🦀