Skip to content

gccrs: Prevent warning on "unreachable" items - #4785

Merged
philberty merged 1 commit into
Rust-GCC:masterfrom
powerboat9:unreach-item
Aug 16, 2026
Merged

gccrs: Prevent warning on "unreachable" items#4785
philberty merged 1 commit into
Rust-GCC:masterfrom
powerboat9:unreach-item

Conversation

@powerboat9

Copy link
Copy Markdown
Collaborator

Items declared in a block expression can't be unreachable.

Items declared in a block expression can't be unreachable.

gcc/rust/ChangeLog:

	* hir/rust-ast-lower.cc (ASTLoweringBlock::visit): Check if a
	statement is an item before warning.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>

@philberty philberty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@philberty
philberty added this pull request to the merge queue Aug 16, 2026
Merged via the queue into Rust-GCC:master with commit e9dac80 Aug 16, 2026
13 checks passed
@powerboat9
powerboat9 deleted the unreach-item branch August 17, 2026 00:10
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.

2 participants