mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 06:23:25 +00:00
Correct visibility check
This commit is contained in:
parent
1a580a3396
commit
1fa9d5e07b
1 changed files with 4 additions and 10 deletions
|
@ -149,17 +149,11 @@ impl UninhabitedFrom<'_> {
|
||||||
subst: &Substitution,
|
subst: &Substitution,
|
||||||
is_enum: bool,
|
is_enum: bool,
|
||||||
) -> ControlFlow<VisiblyUninhabited> {
|
) -> ControlFlow<VisiblyUninhabited> {
|
||||||
let target_mod = self.target_mod;
|
if is_enum || vis.is_visible_from(self.db.upcast(), self.target_mod) {
|
||||||
let mut data_uninhabitedness =
|
let ty = ty.clone().substitute(Interner, subst);
|
||||||
|| ty.clone().substitute(Interner, subst).visit_with(self, DebruijnIndex::INNERMOST);
|
ty.visit_with(self, DebruijnIndex::INNERMOST)
|
||||||
if is_enum {
|
|
||||||
data_uninhabitedness()
|
|
||||||
} else {
|
} else {
|
||||||
match vis {
|
CONTINUE_OPAQUELY_INHABITED
|
||||||
Visibility::Module(mod_id) if mod_id == target_mod => data_uninhabitedness(),
|
|
||||||
Visibility::Module(_) => CONTINUE_OPAQUELY_INHABITED,
|
|
||||||
Visibility::Public => data_uninhabitedness(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue