Skip to content

Conversation

andyleiserson
Copy link
Contributor

Fixes #7536

This is an alternative to #7554, which generates a warning on unreachable statements. Reasons to take this simpler change instead are that the diagnostic infrastructure is not mature yet, and it is likely that eventual fixes to uniformity analysis (#4369) will also need to consider unreachable statements, so it may make more sense to emit an unreachable statements diagnostic from within the uniformity analysis implementation.

Testing
Adds a test that an unreachable statement after return is permitted and still contributes to global use. Also enables some relevant CTS tests.

Squash or Rebase? Squash

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

Allow unreachable statements after return/break/continue/discard.

Fixes gfx-rs#7536
Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

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

Looks good, let's land it!

@teoxoy teoxoy enabled auto-merge (squash) May 28, 2025 15:31
@teoxoy teoxoy merged commit f34dfd9 into gfx-rs:trunk May 28, 2025
38 checks passed
@andyleiserson andyleiserson deleted the statements-after-return-2 branch May 28, 2025 17:52
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.

"Instructions after return" is reported incorrectly
2 participants