Skip to content

Conversation

@powerboat9
Copy link
Collaborator

Should fix #2495

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-expr.cc
	(TypeCheckExpr::visit): Expect if conditions to have type bool.

gcc/testsuite/ChangeLog:

	* rust/compile/type-if.rs: New test.

Signed-off-by: Owen Avery <[email protected]>
Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

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

LGTM i wonder if it is infact a coercion/cast-site in rustc for this case lets go with unify for now

@philberty philberty added the bug label Sep 2, 2023
@philberty philberty added this to the GCC 14 Stage 3 milestone Sep 2, 2023
@philberty philberty added this pull request to the merge queue Sep 2, 2023
Merged via the queue into Rust-GCC:master with commit cc42db3 Sep 2, 2023
@powerboat9 powerboat9 deleted the fix-if branch September 2, 2023 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

ICE - when if contains &str instead of bool

2 participants