rustc_middle: Remove Visibility::Invisible
This commit is contained in:
parent
332cc8fb75
commit
fc3f3c304b
10 changed files with 43 additions and 53 deletions
|
@ -293,7 +293,7 @@ fn skip_stability_check_due_to_privacy(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
|||
|
||||
// These are not visible outside crate; therefore
|
||||
// stability markers are irrelevant, if even present.
|
||||
ty::Visibility::Restricted(..) | ty::Visibility::Invisible => true,
|
||||
ty::Visibility::Restricted(..) => true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -169,14 +169,10 @@ impl<'tcx> FieldDef {
|
|||
param_env: ty::ParamEnv<'tcx>,
|
||||
) -> DefIdForest<'tcx> {
|
||||
let data_uninhabitedness = move || self.ty(tcx, substs).uninhabited_from(tcx, param_env);
|
||||
// FIXME(canndrew): Currently enum fields are (incorrectly) stored with
|
||||
// `Visibility::Invisible` so we need to override `self.vis` if we're
|
||||
// dealing with an enum.
|
||||
if is_enum {
|
||||
data_uninhabitedness()
|
||||
} else {
|
||||
match self.vis {
|
||||
Visibility::Invisible => DefIdForest::empty(),
|
||||
Visibility::Restricted(from) => {
|
||||
let forest = DefIdForest::from_id(from);
|
||||
let iter = Some(forest).into_iter().chain(Some(data_uninhabitedness()));
|
||||
|
|
|
@ -268,8 +268,6 @@ pub enum Visibility {
|
|||
Public,
|
||||
/// Visible only in the given crate-local module.
|
||||
Restricted(DefId),
|
||||
/// Not visible anywhere in the local crate. This is the visibility of private external items.
|
||||
Invisible,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable, TyEncodable, TyDecodable)]
|
||||
|
@ -366,8 +364,6 @@ impl Visibility {
|
|||
let restriction = match self {
|
||||
// Public items are visible everywhere.
|
||||
Visibility::Public => return true,
|
||||
// Private items from other crates are visible nowhere.
|
||||
Visibility::Invisible => return false,
|
||||
// Restricted items are visible in an arbitrary local module.
|
||||
Visibility::Restricted(other) if other.krate != module.krate => return false,
|
||||
Visibility::Restricted(module) => module,
|
||||
|
@ -380,7 +376,6 @@ impl Visibility {
|
|||
pub fn is_at_least<T: DefIdTree>(self, vis: Visibility, tree: T) -> bool {
|
||||
let vis_restriction = match vis {
|
||||
Visibility::Public => return self == Visibility::Public,
|
||||
Visibility::Invisible => return true,
|
||||
Visibility::Restricted(module) => module,
|
||||
};
|
||||
|
||||
|
@ -392,7 +387,6 @@ impl Visibility {
|
|||
match self {
|
||||
Visibility::Public => true,
|
||||
Visibility::Restricted(def_id) => def_id.is_local(),
|
||||
Visibility::Invisible => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue