Fix inhabitedness bug
This commit is contained in:
parent
7946597f75
commit
44a70f0221
1 changed files with 13 additions and 12 deletions
|
|
@ -186,18 +186,19 @@ impl<'a, 'gcx, 'tcx> FieldDef {
|
|||
substs: &'tcx Substs<'tcx>,
|
||||
is_enum: bool) -> NodeForrest
|
||||
{
|
||||
if let Visibility::PrivateExternal = self.vis {
|
||||
return NodeForrest::empty();
|
||||
}
|
||||
|
||||
let data_inhabitedness = self.ty(tcx, substs).uninhabited_from(visited, tcx);
|
||||
match self.vis {
|
||||
Visibility::Restricted(from) if !is_enum => {
|
||||
let node_set = NodeForrest::from_node(from);
|
||||
let iter = Some(node_set).into_iter().chain(Some(data_inhabitedness));
|
||||
NodeForrest::intersection(tcx, iter)
|
||||
},
|
||||
_ => data_inhabitedness,
|
||||
let mut data_uninhabitedness = move || self.ty(tcx, substs).uninhabited_from(visited, tcx);
|
||||
if is_enum {
|
||||
data_uninhabitedness()
|
||||
} else {
|
||||
match self.vis {
|
||||
Visibility::PrivateExternal => NodeForrest::empty(),
|
||||
Visibility::Restricted(from) => {
|
||||
let node_set = NodeForrest::from_node(from);
|
||||
let iter = Some(node_set).into_iter().chain(Some(data_uninhabitedness()));
|
||||
NodeForrest::intersection(tcx, iter)
|
||||
},
|
||||
Visibility::Public => data_uninhabitedness(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue