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

gccrs: match arms are a LUB #3360

Merged
merged 1 commit into from
Jan 10, 2025
Merged

gccrs: match arms are a LUB #3360

merged 1 commit into from
Jan 10, 2025

Conversation

philberty
Copy link
Member

Unify rules are not the same as coercion rules. The coercion of ! is allowed to any type but not for a unify site which is different.

gcc/rust/ChangeLog:

* backend/rust-compile-expr.cc (CompileExpr::visit): implement coercion
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): this is a least upper bound coercion
* typecheck/rust-unify.cc (UnifyRules::go): remove unify ! coercion

Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like I had to add the bit in rust-unify.cc for some other testcase, but if nothing is failing then I'm completely fine with it. LGTM!

Unify rules are not the same as coercion rules. The coercion of ! is
allowed to any type but not for a unify site which is different.

Match arms are another least upper bound coercion.

gcc/rust/ChangeLog:

	* backend/rust-compile-expr.cc (CompileExpr::visit): implement coercion
	* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): this is an LUB
	* typecheck/rust-unify.cc (UnifyRules::go): remove unify ! coercion

Signed-off-by: Philip Herron <[email protected]>
@philberty philberty enabled auto-merge January 10, 2025 09:10
@philberty philberty added this pull request to the merge queue Jan 10, 2025
auto-merge was automatically disabled January 10, 2025 09:35

Pull Request is not mergeable

auto-merge was automatically disabled January 10, 2025 09:38

Pull Request is not mergeable

auto-merge was automatically disabled January 10, 2025 09:42

Pull Request is not mergeable

Merged via the queue into master with commit b4a525c Jan 10, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants