Skip to content

Conversation

@ShoyuVanilla
Copy link
Member

Fixes #18334

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 24, 2025
let r = match ty.kind() {
TyKind::Adt(adt, subst) => self.visit_adt(adt.def_id().0, subst),
TyKind::Never => BREAK_VISIBLY_UNINHABITED,
TyKind::Tuple(..) => ty.super_visit_with(self),
Copy link
Member Author

Choose a reason for hiding this comment

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

Tuple should be super-visited, as super-visit iterates over its field types

TyKind::Array(item_ty, len) => match try_const_usize(self.infcx.interner.db, len) {
Some(0) | None => CONTINUE_OPAQUELY_INHABITED,
Some(1..) => item_ty.super_visit_with(self),
Some(1..) => item_ty.visit_with(self),
Copy link
Member Author

Choose a reason for hiding this comment

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

But item_ty here should be directly visited

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Oct 24, 2025
Merged via the queue into rust-lang:master with commit 3748c16 Oct 24, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 24, 2025
@ShoyuVanilla ShoyuVanilla deleted the array-inhabit branch October 24, 2025 14:18
@lnicola lnicola changed the title fix: Fix a bug on inhabitedness checks for arrays fix: fix array inhabitedness check Oct 24, 2025
mendelsshop pushed a commit to mendelsshop/rust-analyzer that referenced this pull request Oct 27, 2025
fix: Fix a bug on inhabitedness checks for arrays
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.

False-Positive non-exhaustive pattern when Infallible is a trait bound and wrapped in certain types

3 participants