Skip to content

Commit 199e60a

Browse files
committed
Remove unused type InteriorSafety.
1 parent b850046 commit 199e60a

File tree

3 files changed

+8
-37
lines changed

3 files changed

+8
-37
lines changed

src/librustc/middle/mem_categorization.rs

+4-17
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ pub use self::InteriorKind::*;
6565
pub use self::FieldName::*;
6666
pub use self::ElementKind::*;
6767
pub use self::MutabilityCategory::*;
68-
pub use self::InteriorSafety::*;
6968
pub use self::AliasableReason::*;
7069
pub use self::Note::*;
7170
pub use self::deref_kind::*;
@@ -1385,12 +1384,6 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
13851384
}
13861385
}
13871386

1388-
#[derive(Copy, Clone, Debug)]
1389-
pub enum InteriorSafety {
1390-
InteriorUnsafe,
1391-
InteriorSafe
1392-
}
1393-
13941387
#[derive(Clone, Debug)]
13951388
pub enum Aliasability {
13961389
FreelyAliasable(AliasableReason),
@@ -1404,8 +1397,8 @@ pub enum AliasableReason {
14041397
AliasableClosure(ast::NodeId), // Aliasable due to capture Fn closure env
14051398
AliasableOther,
14061399
UnaliasableImmutable, // Created as needed upon seeing ImmutableUnique
1407-
AliasableStatic(InteriorSafety),
1408-
AliasableStaticMut(InteriorSafety),
1400+
AliasableStatic,
1401+
AliasableStaticMut,
14091402
}
14101403

14111404
impl<'tcx> cmt_<'tcx> {
@@ -1469,16 +1462,10 @@ impl<'tcx> cmt_<'tcx> {
14691462
}
14701463

14711464
cat_static_item(..) => {
1472-
let int_safe = if ty::type_interior_is_unsafe(ctxt, self.ty) {
1473-
InteriorUnsafe
1474-
} else {
1475-
InteriorSafe
1476-
};
1477-
14781465
if self.mutbl.is_mutable() {
1479-
FreelyAliasable(AliasableStaticMut(int_safe))
1466+
FreelyAliasable(AliasableStaticMut)
14801467
} else {
1481-
FreelyAliasable(AliasableStatic(int_safe))
1468+
FreelyAliasable(AliasableStatic)
14821469
}
14831470
}
14841471

src/librustc/middle/ty.rs

-4
Original file line numberDiff line numberDiff line change
@@ -3733,10 +3733,6 @@ impl fmt::Debug for TypeContents {
37333733
}
37343734
}
37353735

3736-
pub fn type_interior_is_unsafe<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> bool {
3737-
type_contents(cx, ty).interior_unsafe()
3738-
}
3739-
37403736
pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents {
37413737
return memoized(&cx.tc_cache, ty, |ty| {
37423738
tc_ty(cx, ty, &mut FnvHashMap())

src/librustc_borrowck/borrowck/gather_loans/mod.rs

+4-16
Original file line numberDiff line numberDiff line change
@@ -191,23 +191,11 @@ fn check_aliasability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
191191
/* Uniquely accessible path -- OK for `&` and `&mut` */
192192
Ok(())
193193
}
194-
(mc::Aliasability::FreelyAliasable(mc::AliasableStatic(safety)), ty::ImmBorrow) => {
195-
// Borrow of an immutable static item:
196-
match safety {
197-
mc::InteriorUnsafe => {
198-
// If the static item contains an Unsafe<T>, it has interior
199-
// mutability. In such cases, another phase of the compiler
200-
// will ensure that the type is `Sync` and then trans will
201-
// not put it in rodata, so this is ok to allow.
202-
Ok(())
203-
}
204-
mc::InteriorSafe => {
205-
// Immutable static can be borrowed, no problem.
206-
Ok(())
207-
}
208-
}
194+
(mc::Aliasability::FreelyAliasable(mc::AliasableStatic), ty::ImmBorrow) => {
195+
// Borrow of an immutable static item.
196+
Ok(())
209197
}
210-
(mc::Aliasability::FreelyAliasable(mc::AliasableStaticMut(..)), _) => {
198+
(mc::Aliasability::FreelyAliasable(mc::AliasableStaticMut), _) => {
211199
// Even touching a static mut is considered unsafe. We assume the
212200
// user knows what they're doing in these cases.
213201
Ok(())

0 commit comments

Comments
 (0)